Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp

Issue 2807923002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/graphics (Closed)
Patch Set: rebase and fix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 union_rect; 89 FloatRect union_rect;
90 for (const auto& tile_stream : tiles) { 90 for (const auto& tile_stream : tiles) {
91 SkMemoryStream stream(tile_stream->data.begin(), tile_stream->data.size()); 91 SkMemoryStream stream(tile_stream->data.begin(), tile_stream->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 cull_rect(picture->cullRect()); 96 FloatRect cull_rect(picture->cullRect());
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 std::unique_ptr<JSONArray> PictureSnapshot::SnapshotCommandLog() const { 199 std::unique_ptr<JSONArray> PictureSnapshot::SnapshotCommandLog() const {
200 const SkIRect bounds = picture_->cullRect().roundOut(); 200 const SkIRect bounds = picture_->cullRect().roundOut();
201 LoggingCanvas canvas(bounds.width(), bounds.height()); 201 LoggingCanvas canvas(bounds.width(), bounds.height());
202 picture_->playback(&canvas); 202 picture_->playback(&canvas);
203 return canvas.Log(); 203 return canvas.Log();
204 } 204 }
205 205
206 } // namespace blink 206 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698