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

Unified Diff: include/core/SkImageInfo.h

Issue 2000713003: Add SkColorSpace to SkImageInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@public
Patch Set: Check for 2.2 or linear gamma Created 4 years, 7 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 | « include/codec/SkEncodedInfo.h ('k') | src/codec/SkCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImageInfo.h
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index 4b308c05d88ca736d69451f3b970c1bd71b30b12..ced23964e01849cf23495957cbce8b952d613fba 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -8,6 +8,7 @@
#ifndef SkImageInfo_DEFINED
#define SkImageInfo_DEFINED
+#include "SkColorSpace.h"
#include "SkMath.h"
#include "SkRect.h"
#include "SkSize.h"
@@ -194,6 +195,11 @@ public:
return SkImageInfo(width, height, ct, at, pt);
}
+ static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at,
+ sk_sp<SkColorSpace> cs) {
+ return SkImageInfo(width, height, ct, at, kLinear_SkColorProfileType, cs);
+ }
+
/**
* Sets colortype to the native ARGB32 type.
*/
@@ -247,6 +253,14 @@ public:
bool isLinear() const { return kLinear_SkColorProfileType == fProfileType; }
bool isSRGB() const { return kSRGB_SkColorProfileType == fProfileType; }
+ bool isLinearGamma() const {
+ return SkColorSpace::kLinear_GammaNamed == fColorSpace->gammaNamed();
+ }
+
+ bool is2Dot2Gamma() const {
+ return SkColorSpace::k2Dot2Curve_GammaNamed == fColorSpace->gammaNamed();
reed1 2016/05/24 16:06:33 Must there be a colorspace object, or could it be
msarett 2016/05/24 19:01:47 Ahhh yes this is a bug. It could definitely be nu
+ }
+
SkISize dimensions() const { return SkISize::Make(fWidth, fHeight); }
SkIRect bounds() const { return SkIRect::MakeWH(fWidth, fHeight); }
@@ -322,13 +336,16 @@ private:
SkColorType fColorType;
SkAlphaType fAlphaType;
SkColorProfileType fProfileType;
+ sk_sp<SkColorSpace> fColorSpace;
- SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at, SkColorProfileType pt)
+ SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at, SkColorProfileType pt,
+ sk_sp<SkColorSpace> cs = nullptr)
: fWidth(width)
, fHeight(height)
, fColorType(ct)
, fAlphaType(at)
, fProfileType(pt)
+ , fColorSpace(cs)
{}
};
« no previous file with comments | « include/codec/SkEncodedInfo.h ('k') | src/codec/SkCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698