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

Unified Diff: cc/tiles/image_decode_controller.cc

Issue 1633933002: cc: Don't allocate 0-size discardable memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/image_decode_controller.cc
diff --git a/cc/tiles/image_decode_controller.cc b/cc/tiles/image_decode_controller.cc
index 7c1cf364a10b559249609901a60e7062e727a049..ad499fd50d9582e76707a0205da5e436ee591d93 100644
--- a/cc/tiles/image_decode_controller.cc
+++ b/cc/tiles/image_decode_controller.cc
@@ -318,8 +318,12 @@ ImageDecodeController::DecodeImageInternal(const ImageKey& key,
decoded_info.minRowBytes());
// Now scale the pixels into the destination size.
- SkImageInfo scaled_info = SkImageInfo::MakeN32Premul(
- key.target_size().width(), key.target_size().height());
+ // TODO(vmpstr): Once we support skipping images altogether, we can remove
+ // this and skip drawing images that are empty in size. crbug.com/581163
+ const gfx::Size& target_size =
+ key.target_size().IsEmpty() ? gfx::Size(1, 1) : key.target_size();
+ SkImageInfo scaled_info =
+ SkImageInfo::MakeN32Premul(target_size.width(), target_size.height());
scoped_ptr<base::DiscardableMemory> scaled_pixels;
{
TRACE_EVENT0(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698