Commit 22a81440 authored by vmpstr's avatar vmpstr Committed by Commit bot

cc: Don't allocate 0-size discardable memory.

This patch ensures that when processing images we don't try to allocate
0 bytes of discardable memory. For now, allocate 1 byte with a TODO
to skip these images altogether.

R=enne
BUG=579498
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review URL: https://codereview.chromium.org/1633933002

Cr-Commit-Position: refs/heads/master@{#371413}
parent 81c0851e
...@@ -318,8 +318,12 @@ ImageDecodeController::DecodeImageInternal(const ImageKey& key, ...@@ -318,8 +318,12 @@ ImageDecodeController::DecodeImageInternal(const ImageKey& key,
decoded_info.minRowBytes()); decoded_info.minRowBytes());
// Now scale the pixels into the destination size. // Now scale the pixels into the destination size.
SkImageInfo scaled_info = SkImageInfo::MakeN32Premul( // TODO(vmpstr): Once we support skipping images altogether, we can remove
key.target_size().width(), key.target_size().height()); // 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; scoped_ptr<base::DiscardableMemory> scaled_pixels;
{ {
TRACE_EVENT0( TRACE_EVENT0(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment