Index: include/codec/SkEncodedInfo.h |
diff --git a/include/codec/SkEncodedInfo.h b/include/codec/SkEncodedInfo.h |
index f91660529e05a26194fdf8b5084f211133298ab5..17ce131be06e67e2ea664a2137b9ebe2590f9b1c 100644 |
--- a/include/codec/SkEncodedInfo.h |
+++ b/include/codec/SkEncodedInfo.h |
@@ -68,6 +68,10 @@ public: |
kInvertedCMYK_Color, |
kYCCK_Color, |
+ // Used internally to indicate that the decoding library has |
+ // pre-swizzled to the desired output format. |
+ kPreSwizzled_Color, |
+ |
// Allows us to have a default constructor. Should be treated as |
// invalid. |
kUnknown_Color, |
@@ -156,6 +160,35 @@ public: |
} |
} |
+ Color color() const { return fColor; } |
+ Alpha alpha() const { return fAlpha; } |
+ uint8_t bitsPerComponent() const { return fBitsPerComponent; } |
+ |
+ uint8_t bitsPerPixel() const { |
+ switch (fColor) { |
+ case kGray_Color: |
+ return fBitsPerComponent; |
+ case kGrayAlpha_Color: |
+ return 2 * fBitsPerComponent; |
+ case kPalette_Color: |
+ return fBitsPerComponent; |
+ case kRGB_Color: |
+ case kBGR_Color: |
+ case kYUV_Color: |
+ return 3 * fBitsPerComponent; |
+ case kRGBA_Color: |
+ case kBGRA_Color: |
+ case kBGRX_Color: |
+ case kYUVA_Color: |
+ case kInvertedCMYK_Color: |
+ case kYCCK_Color: |
+ return 4 * fBitsPerComponent; |
+ default: |
+ SkASSERT(false); |
+ return 0; |
+ } |
+ } |
+ |
SkEncodedInfo() |
: fColor(kUnknown_Color) |
, fAlpha(kUnknown_Alpha) |
@@ -170,9 +203,15 @@ private: |
, fBitsPerComponent(bitsPerComponent) |
{} |
+ void setColor(Color color) { |
+ fColor = color; |
+ } |
+ |
Color fColor; |
Alpha fAlpha; |
uint8_t fBitsPerComponent; |
+ |
+ friend class SkJpegCodec; |
}; |
#endif |