aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-03-31 17:02:41 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-03 14:02:19 +0000
commit84c009f69216bc9f741294f24d60434383385f4c (patch)
tree6c4b76d48e4f91192ac36bd7bd2a5c79b481a159 /src
parentb7bf09ccac26aac57f0ea36ceb36ace848999d48 (diff)
Remove kAsIs_CachedFormat
This was confusing and unnecessary. Added an explicit sBGR format to handle one case. Now the CF always fully describes the color type and transfer function (or it's legacy). Bug: skia: Change-Id: I8f792e8aa18cd2391aa541a9368e345d92bba828 Reviewed-on: https://skia-review.googlesource.com/11013 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkImageCacherator.cpp24
-rw-r--r--src/core/SkImageCacherator.h2
2 files changed, 12 insertions, 14 deletions
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index 76da0e762e..4929c6b94c 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -359,7 +359,7 @@ SkImageCacherator::CachedFormat SkImageCacherator::chooseCacheFormat(SkColorSpac
case kRGBA_8888_SkColorType:
if (cs->gammaCloseToSRGB()) {
if (caps.supportsSRGB()) {
- return kAsIs_CachedFormat;
+ return kSRGB8888_CachedFormat;
} else if (caps.supportsHalfFloat()) {
return kLinearF16_CachedFormat;
} else {
@@ -379,7 +379,7 @@ SkImageCacherator::CachedFormat SkImageCacherator::chooseCacheFormat(SkColorSpac
// Odd case. sBGRA isn't a real thing, so we may not have this texturable.
if (caps.supportsSBGR()) {
if (cs->gammaCloseToSRGB()) {
- return kAsIs_CachedFormat;
+ return kSBGR8888_CachedFormat;
} else if (caps.supportsHalfFloat()) {
return kLinearF16_CachedFormat;
} else if (caps.supportsSRGB()) {
@@ -409,16 +409,12 @@ SkImageCacherator::CachedFormat SkImageCacherator::chooseCacheFormat(SkColorSpac
}
case kRGBA_F16_SkColorType:
- if (!caps.supportsHalfFloat()) {
- if (caps.supportsSRGB()) {
- return kSRGB8888_CachedFormat;
- } else {
- return kLegacy_CachedFormat;
- }
- } else if (cs->gammaIsLinear()) {
- return kAsIs_CachedFormat;
- } else {
+ if (caps.supportsHalfFloat()) {
return kLinearF16_CachedFormat;
+ } else if (caps.supportsSRGB()) {
+ return kSRGB8888_CachedFormat;
+ } else {
+ return kLegacy_CachedFormat;
}
}
SkDEBUGFAIL("Unreachable");
@@ -429,8 +425,6 @@ SkImageInfo SkImageCacherator::buildCacheInfo(CachedFormat format) {
switch (format) {
case kLegacy_CachedFormat:
return fInfo.makeColorSpace(nullptr);
- case kAsIs_CachedFormat:
- return fInfo;
case kLinearF16_CachedFormat:
return fInfo
.makeColorType(kRGBA_F16_SkColorType)
@@ -439,6 +433,10 @@ SkImageInfo SkImageCacherator::buildCacheInfo(CachedFormat format) {
return fInfo
.makeColorType(kRGBA_8888_SkColorType)
.makeColorSpace(as_CSB(fInfo.colorSpace())->makeSRGBGamma());
+ case kSBGR8888_CachedFormat:
+ return fInfo
+ .makeColorType(kBGRA_8888_SkColorType)
+ .makeColorSpace(as_CSB(fInfo.colorSpace())->makeSRGBGamma());;
default:
SkDEBUGFAIL("Invalid cached format");
return fInfo;
diff --git a/src/core/SkImageCacherator.h b/src/core/SkImageCacherator.h
index e179236748..e75aab7a93 100644
--- a/src/core/SkImageCacherator.h
+++ b/src/core/SkImageCacherator.h
@@ -35,9 +35,9 @@ public:
enum CachedFormat {
kLegacy_CachedFormat, // The format from the generator, with any color space stripped out
- kAsIs_CachedFormat, // The format from the generator, with no modification
kLinearF16_CachedFormat, // Half float RGBA with linear gamma
kSRGB8888_CachedFormat, // sRGB bytes
+ kSBGR8888_CachedFormat, // sRGB bytes, in BGR order
kNumCachedFormats,
};