| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 namespace blink { | 54 namespace blink { |
| 55 | 55 |
| 56 PictureSnapshot::PictureSnapshot(PassRefPtr<const SkPicture> picture) | 56 PictureSnapshot::PictureSnapshot(PassRefPtr<const SkPicture> picture) |
| 57 : m_picture(picture) | 57 : m_picture(picture) |
| 58 { | 58 { |
| 59 } | 59 } |
| 60 | 60 |
| 61 static bool decodeBitmap(const void* data, size_t length, SkBitmap* result) | 61 static bool decodeBitmap(const void* data, size_t length, SkBitmap* result) |
| 62 { | 62 { |
| 63 std::unique_ptr<ImageDecoder> imageDecoder = ImageDecoder::create(static_cas
t<const char*>(data), length, | 63 std::unique_ptr<ImageDecoder> imageDecoder = ImageDecoder::create(ImageDecod
er::determineImageType(static_cast<const char*>(data), length), |
| 64 ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgno
red); | 64 ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileIgno
red); |
| 65 if (!imageDecoder) | 65 if (!imageDecoder) |
| 66 return false; | 66 return false; |
| 67 | 67 |
| 68 // No need to copy the data; this decodes immediately. | 68 // No need to copy the data; this decodes immediately. |
| 69 RefPtr<SegmentReader> segmentReader = SegmentReader::createFromSkData(adoptR
ef(SkData::NewWithoutCopy(data, length))); | 69 RefPtr<SegmentReader> segmentReader = SegmentReader::createFromSkData(adoptR
ef(SkData::NewWithoutCopy(data, length))); |
| 70 imageDecoder->setData(segmentReader.release(), true); | 70 imageDecoder->setData(segmentReader.release(), true); |
| 71 ImageFrame* frame = imageDecoder->frameBufferAtIndex(0); | 71 ImageFrame* frame = imageDecoder->frameBufferAtIndex(0); |
| 72 if (!frame) | 72 if (!frame) |
| 73 return true; | 73 return true; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 PassRefPtr<JSONArray> PictureSnapshot::snapshotCommandLog() const | 177 PassRefPtr<JSONArray> PictureSnapshot::snapshotCommandLog() const |
| 178 { | 178 { |
| 179 const SkIRect bounds = m_picture->cullRect().roundOut(); | 179 const SkIRect bounds = m_picture->cullRect().roundOut(); |
| 180 LoggingCanvas canvas(bounds.width(), bounds.height()); | 180 LoggingCanvas canvas(bounds.width(), bounds.height()); |
| 181 m_picture->playback(&canvas); | 181 m_picture->playback(&canvas); |
| 182 return canvas.log(); | 182 return canvas.log(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace blink | 185 } // namespace blink |
| OLD | NEW |