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

Unified Diff: include/codec/SkEncodedInfo.h

Issue 1911613002: Use SkEncodedInfo in place of SkSwizzler::SrcConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bmp bug Created 4 years, 8 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
« no previous file with comments | « no previous file | src/codec/SkBmpStandardCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | src/codec/SkBmpStandardCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698