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

Unified Diff: src/core/SkImageInfo.cpp

Issue 2075853002: remove colorprofiletype from imageinfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove colorprofiletype from imageinfo Created 4 years, 6 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 | « src/core/SkBlitter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageInfo.cpp
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index 88f1ed65c6704f2347b0dc540e48804b64c5db1c..8b6454331de956665d2bcd778a4d1e6e1a214a93 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -10,6 +10,13 @@
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
+#ifdef SK_SUPPORT_LEGACY_COLORPROFILETYPE
+SkColorProfileType SkImageInfo::profileType() const {
+ return fColorSpace && fColorSpace->gammaCloseToSRGB()
+ ? kSRGB_SkColorProfileType : kLinear_SkColorProfileType;
+}
+#endif
+
// Indicate how images and gradients should interpret colors by default.
bool gDefaultProfileIsSRGB;
@@ -18,10 +25,6 @@ SkColorProfileType SkDefaultColorProfile() {
: kLinear_SkColorProfileType;
}
-static bool profile_type_is_valid(SkColorProfileType profileType) {
- return (profileType >= 0) && (profileType <= kLastEnum_SkColorProfileType);
-}
-
static bool alpha_type_is_valid(SkAlphaType alphaType) {
return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType);
}
@@ -30,19 +33,8 @@ static bool color_type_is_valid(SkColorType colorType) {
return (colorType >= 0) && (colorType <= kLastEnum_SkColorType);
}
-SkImageInfo SkImageInfo::Make(int width, int height, SkColorType ct, SkAlphaType at,
- sk_sp<SkColorSpace> cs) {
- SkColorProfileType pt = SkDefaultColorProfile();
- // try to keep the enum and the colorspace in sync.
- // TODO: eliminate the enum entirely, now that we have colorspace objects
- if (cs && (SkColorSpace::kLinear_GammaNamed != cs->gammaNamed())) {
- pt = kSRGB_SkColorProfileType;
- }
- return SkImageInfo(width, height, ct, at, pt, std::move(cs));
-}
-
SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) {
- return SkImageInfo(width, height, kN32_SkColorType, at, kSRGB_SkColorProfileType,
+ return SkImageInfo(width, height, kN32_SkColorType, at,
SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named));
}
@@ -52,22 +44,19 @@ void SkImageInfo::unflatten(SkReadBuffer& buffer) {
uint32_t packed = buffer.read32();
SkASSERT(0 == (packed >> 24));
- fProfileType = (SkColorProfileType)((packed >> 16) & 0xFF);
+// fProfileType = (SkColorProfileType)((packed >> 16) & 0xFF);
msarett 2016/06/17 12:44:19 I'll need to fix these to flatten/unflatten SkColo
reed1 2016/06/17 13:11:48 Ooo right. I need to ponder that.
fAlphaType = (SkAlphaType)((packed >> 8) & 0xFF);
fColorType = (SkColorType)((packed >> 0) & 0xFF);
- buffer.validate(profile_type_is_valid(fProfileType) &&
- alpha_type_is_valid(fAlphaType) &&
- color_type_is_valid(fColorType));
+ buffer.validate(alpha_type_is_valid(fAlphaType) && color_type_is_valid(fColorType));
}
void SkImageInfo::flatten(SkWriteBuffer& buffer) const {
buffer.write32(fWidth);
buffer.write32(fHeight);
- SkASSERT(0 == (fProfileType & ~0xFF));
SkASSERT(0 == (fAlphaType & ~0xFF));
SkASSERT(0 == (fColorType & ~0xFF));
- uint32_t packed = (fProfileType << 16) | (fAlphaType << 8) | fColorType;
+ uint32_t packed = /*(fProfileType << 16) |*/ (fAlphaType << 8) | fColorType;
buffer.write32(packed);
}
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698