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

Unified Diff: src/codec/SkSwizzler.cpp

Issue 1267543002: Make SkSwizzler::Fill() support 565 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Check if pixel memory is zero initialized Created 5 years, 5 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
« src/codec/SkJpegCodec.cpp ('K') | « src/codec/SkJpegCodec.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkSwizzler.cpp
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp
index a91cf511ee99ce312fcafada4bd040f43d5e0394..998fbeb851f6bb99c36190419ad59730311da1a7 100644
--- a/src/codec/SkSwizzler.cpp
+++ b/src/codec/SkSwizzler.cpp
@@ -470,6 +470,15 @@ void SkSwizzler::Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstR
// for black.
memset(dstStartRow, (uint8_t) colorOrIndex, bytesToFill);
break;
+ case kRGB_565_SkColorType:
+ // If the destination is k565, the caller passes in a 16-bit color.
+ // We will not assert that the high bits of colorOrIndex must be zeroed.
+ // This allows us to take advantage of the fact that the low 16 bits of an
+ // SKPMColor may be a valid a 565 color. For example, the low 16
+ // bits of SK_ColorBLACK are identical to the 565 representation
+ // for black.
+ memset(dstStartRow, (uint16_t) colorOrIndex, bytesToFill);
+ break;
default:
SkCodecPrintf("Error: Unsupported dst color type for fill(). Doing nothing.\n");
SkASSERT(false);
« src/codec/SkJpegCodec.cpp ('K') | « src/codec/SkJpegCodec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698