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

Unified Diff: src/core/SkImageInfo.cpp

Issue 676883003: flag imageinfo as srgb (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix copy/paste error in loop limits Created 6 years, 1 month 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/core/SkImageInfo.h ('k') | src/ports/SkImageDecoder_CG.cpp » ('j') | 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 e61cd7d45f398c115f36d4332744f65d95e2fdad..7931358d824a151ab770812d757919368589193b 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -9,6 +9,10 @@
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
+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);
}
@@ -22,10 +26,12 @@ void SkImageInfo::unflatten(SkReadBuffer& buffer) {
fHeight = buffer.read32();
uint32_t packed = buffer.read32();
- SkASSERT(0 == (packed >> 16));
+ SkASSERT(0 == (packed >> 24));
+ fProfileType = (SkColorProfileType)((packed >> 16) & 0xFF);
fAlphaType = (SkAlphaType)((packed >> 8) & 0xFF);
fColorType = (SkColorType)((packed >> 0) & 0xFF);
- buffer.validate(alpha_type_is_valid(fAlphaType) &&
+ buffer.validate(profile_type_is_valid(fProfileType) &&
+ alpha_type_is_valid(fAlphaType) &&
color_type_is_valid(fColorType));
}
@@ -33,9 +39,10 @@ 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 = (fAlphaType << 8) | fColorType;
+ uint32_t packed = (fProfileType << 16) | (fAlphaType << 8) | fColorType;
buffer.write32(packed);
}
« no previous file with comments | « include/core/SkImageInfo.h ('k') | src/ports/SkImageDecoder_CG.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698