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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 ? frame->finalizePixelsAndGetImage() | 76 ? frame->finalizePixelsAndGetImage() |
77 : nullptr; | 77 : nullptr; |
78 } | 78 } |
79 sk_sp<SkImage> makeFromData(SkData* data, const SkIRect* subset) override { | 79 sk_sp<SkImage> makeFromData(SkData* data, const SkIRect* subset) override { |
80 return this->makeFromMemory(data->data(), data->size(), subset); | 80 return this->makeFromMemory(data->data(), data->size(), subset); |
81 } | 81 } |
82 }; | 82 }; |
83 | 83 |
84 PassRefPtr<PictureSnapshot> PictureSnapshot::load( | 84 PassRefPtr<PictureSnapshot> PictureSnapshot::load( |
85 const Vector<RefPtr<TilePictureStream>>& tiles) { | 85 const Vector<RefPtr<TilePictureStream>>& tiles) { |
86 ASSERT(!tiles.isEmpty()); | 86 DCHECK(!tiles.isEmpty()); |
87 Vector<sk_sp<SkPicture>> pictures; | 87 Vector<sk_sp<SkPicture>> pictures; |
88 pictures.reserveCapacity(tiles.size()); | 88 pictures.reserveCapacity(tiles.size()); |
89 FloatRect unionRect; | 89 FloatRect unionRect; |
90 for (const auto& tileStream : tiles) { | 90 for (const auto& tileStream : tiles) { |
91 SkMemoryStream stream(tileStream->data.begin(), tileStream->data.size()); | 91 SkMemoryStream stream(tileStream->data.begin(), tileStream->data.size()); |
92 SkiaImageDecoder factory; | 92 SkiaImageDecoder factory; |
93 sk_sp<SkPicture> picture = SkPicture::MakeFromStream(&stream, &factory); | 93 sk_sp<SkPicture> picture = SkPicture::MakeFromStream(&stream, &factory); |
94 if (!picture) | 94 if (!picture) |
95 return nullptr; | 95 return nullptr; |
96 FloatRect cullRect(picture->cullRect()); | 96 FloatRect cullRect(picture->cullRect()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 196 } |
197 | 197 |
198 std::unique_ptr<JSONArray> PictureSnapshot::snapshotCommandLog() const { | 198 std::unique_ptr<JSONArray> PictureSnapshot::snapshotCommandLog() const { |
199 const SkIRect bounds = m_picture->cullRect().roundOut(); | 199 const SkIRect bounds = m_picture->cullRect().roundOut(); |
200 LoggingCanvas canvas(bounds.width(), bounds.height()); | 200 LoggingCanvas canvas(bounds.width(), bounds.height()); |
201 m_picture->playback(&canvas); | 201 m_picture->playback(&canvas); |
202 return canvas.log(); | 202 return canvas.log(); |
203 } | 203 } |
204 | 204 |
205 } // namespace blink | 205 } // namespace blink |
OLD | NEW |