Commit 0ea91078 authored by Fernando Serboncini's avatar Fernando Serboncini Committed by Commit Bot

Don't call ColorType if not needed

Bug: 898868
Change-Id: I067bf23c3838c6a7576dc91b090f79c12ce798ea
Reviewed-on: https://chromium-review.googlesource.com/c/1351427Reviewed-by: default avatarMohammad Reza Zakerinasab <zakerinasab@chromium.org>
Commit-Queue: Fernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611787}
parent 6fee6901
...@@ -175,19 +175,15 @@ bool DecodingImageGenerator::GetPixels(const SkImageInfo& dst_info, ...@@ -175,19 +175,15 @@ bool DecodingImageGenerator::GetPixels(const SkImageInfo& dst_info,
if (decoded && needs_color_xform) { if (decoded && needs_color_xform) {
TRACE_EVENT0("blink", "DecodingImageGenerator::getPixels - apply xform"); TRACE_EVENT0("blink", "DecodingImageGenerator::getPixels - apply xform");
SkPixmap src(decode_info, memory, adjusted_row_bytes); SkPixmap src(decode_info, memory, adjusted_row_bytes);
decoded = decoded = src.readPixels(target_info, memory, adjusted_row_bytes);
decoded && src.readPixels(target_info, memory, adjusted_row_bytes);
DCHECK(decoded); DCHECK(decoded);
} }
// Convert the color type to the requested one if necessary // Convert the color type to the requested one if necessary
if (target_info.colorType() != dst_info.colorType()) { if (decoded && target_info.colorType() != dst_info.colorType()) {
if (decoded) { decoded = SkPixmap{target_info, memory, adjusted_row_bytes}.readPixels(
decoded = decoded && SkPixmap{dst_info, pixels, row_bytes});
SkPixmap{target_info, memory, adjusted_row_bytes}.readPixels( DCHECK(decoded);
SkPixmap{dst_info, pixels, row_bytes});
DCHECK(decoded);
}
} }
return decoded; return decoded;
} }
......
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