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

Unified Diff: src/codec/SkCodecPriv.h

Issue 1287423002: Scanline decoding for bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments from previous patch sets Created 5 years, 4 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
Index: src/codec/SkCodecPriv.h
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h
index 450457f630137c98b854be9f2ad8ad963f8c71d0..2c64bddc735388f1617f232bef6260604e1124e5 100644
--- a/src/codec/SkCodecPriv.h
+++ b/src/codec/SkCodecPriv.h
@@ -132,6 +132,23 @@ static inline size_t compute_row_bytes(int width, uint32_t bitsPerPixel) {
}
/*
+ * On incomplete images, get the color to fill with
+ */
+static inline SkPMColor get_fill_color_or_index(SkAlphaType alphaType) {
+ // This condition works properly for all supported output color types.
+ // kIndex8: The low 8-bits of both possible return values is 0, which is
+ // our desired default index.
+ // kGray8: The low 8-bits of both possible return values is 0, which is
+ // black, our desired fill value.
+ // kRGB565: The low 16-bits of both possible return values is 0, which is
+ // black, our desired fill value.
+ // kN32: Return black for opaque images and transparent for non-opaque
+ // images.
+ return kOpaque_SkAlphaType == alphaType ?
+ SK_ColorBLACK : SK_ColorTRANSPARENT;
+}
+
+/*
* Get a byte from a buffer
* This method is unsafe, the caller is responsible for performing a check
*/

Powered by Google App Engine
This is Rietveld 408576698