aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-06-17 13:43:27 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-17 13:43:27 -0700
commit944876f2745a62a839e49275daf93a0329372e67 (patch)
treeefcb2109562bcefb36a65099a63f329091d6b9d4 /src
parente75cdcb85b73c4484a992bf5531394632e757870 (diff)
More removal of SkColorProfileType...
Scrub GMs. Remove the gDefaultProfile thing (it's unused now), along with the command line flag that was setting it in DM and nanobench. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2071393002 Review-Url: https://codereview.chromium.org/2071393002
Diffstat (limited to 'src')
-rw-r--r--src/core/SkCanvas.cpp3
-rw-r--r--src/core/SkImageInfo.cpp9
-rw-r--r--src/gpu/GrContext.cpp4
-rw-r--r--src/gpu/GrSurface.cpp7
-rw-r--r--src/gpu/SkGr.cpp18
-rw-r--r--src/gpu/SkGrPriv.h2
6 files changed, 17 insertions, 26 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 4150a9a55b..1a5c4c4d11 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1177,6 +1177,7 @@ static SkImageInfo make_layer_info(const SkImageInfo& prev, int w, int h, bool i
const SkPaint* paint) {
// need to force L32 for now if we have an image filter. Once filters support other colortypes
// e.g. sRGB or F16, we can remove this check
+ // SRGBTODO: Can we remove this check now?
const bool hasImageFilter = paint && paint->getImageFilter();
SkAlphaType alphaType = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
@@ -1185,7 +1186,7 @@ static SkImageInfo make_layer_info(const SkImageInfo& prev, int w, int h, bool i
return SkImageInfo::MakeN32(w, h, alphaType);
} else {
// keep the same characteristics as the prev
- return SkImageInfo::Make(w, h, prev.colorType(), alphaType, prev.profileType());
+ return SkImageInfo::Make(w, h, prev.colorType(), alphaType, sk_ref_sp(prev.colorSpace()));
}
}
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index 9485754823..ee169239ef 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -6,7 +6,6 @@
*/
#include "SkImageInfo.h"
-#include "SkImageInfoPriv.h"
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
@@ -61,14 +60,6 @@ SkColorProfileType SkImageInfo::profileType() const {
}
#endif
-// Indicate how images and gradients should interpret colors by default.
-bool gDefaultProfileIsSRGB;
-
-SkColorProfileType SkDefaultColorProfile() {
- return gDefaultProfileIsSRGB ? kSRGB_SkColorProfileType
- : kLinear_SkColorProfileType;
-}
-
static bool alpha_type_is_valid(SkAlphaType alphaType) {
return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType);
}
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index a9c6089728..970f75c7b8 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -244,7 +244,7 @@ void GrContext::flush(int flagsBitfield) {
bool sw_convert_to_premul(GrPixelConfig srcConfig, int width, int height, size_t inRowBytes,
const void* inPixels, size_t outRowBytes, void* outPixels) {
SkSrcPixelInfo srcPI;
- if (!GrPixelConfig2ColorAndProfileType(srcConfig, &srcPI.fColorType, nullptr)) {
+ if (!GrPixelConfigToColorAndColorSpace(srcConfig, &srcPI.fColorType, nullptr)) {
return false;
}
srcPI.fAlphaType = kUnpremul_SkAlphaType;
@@ -511,7 +511,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
// Perform umpremul conversion if we weren't able to perform it as a draw.
if (unpremul) {
SkDstPixelInfo dstPI;
- if (!GrPixelConfig2ColorAndProfileType(dstConfig, &dstPI.fColorType, nullptr)) {
+ if (!GrPixelConfigToColorAndColorSpace(dstConfig, &dstPI.fColorType, nullptr)) {
return false;
}
dstPI.fAlphaType = kUnpremul_SkAlphaType;
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 886945c710..47fa394788 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -118,12 +118,11 @@ bool GrSurface::readPixels(int left, int top, int width, int height,
SkImageInfo GrSurface::info(SkAlphaType alphaType) const {
SkColorType colorType;
- SkColorProfileType profileType;
- if (!GrPixelConfig2ColorAndProfileType(this->config(), &colorType, &profileType)) {
+ sk_sp<SkColorSpace> colorSpace;
+ if (!GrPixelConfigToColorAndColorSpace(this->config(), &colorType, &colorSpace)) {
sk_throw();
}
- return SkImageInfo::Make(this->width(), this->height(), colorType, alphaType,
- profileType);
+ return SkImageInfo::Make(this->width(), this->height(), colorType, alphaType, colorSpace);
}
// TODO: This should probably be a non-member helper function. It might only be needed in
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 60fcdd5139..f937b16d55 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -453,10 +453,10 @@ GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, const SkCol
return kUnknown_GrPixelConfig;
}
-bool GrPixelConfig2ColorAndProfileType(GrPixelConfig config, SkColorType* ctOut,
- SkColorProfileType* ptOut) {
+bool GrPixelConfigToColorAndColorSpace(GrPixelConfig config, SkColorType* ctOut,
+ sk_sp<SkColorSpace>* csOut) {
SkColorType ct;
- SkColorProfileType pt = kLinear_SkColorProfileType;
+ sk_sp<SkColorSpace> cs = nullptr;
switch (config) {
case kAlpha_8_GrPixelConfig:
ct = kAlpha_8_SkColorType;
@@ -478,11 +478,11 @@ bool GrPixelConfig2ColorAndProfileType(GrPixelConfig config, SkColorType* ctOut,
break;
case kSRGBA_8888_GrPixelConfig:
ct = kRGBA_8888_SkColorType;
- pt = kSRGB_SkColorProfileType;
+ cs = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
break;
case kSBGRA_8888_GrPixelConfig:
ct = kBGRA_8888_SkColorType;
- pt = kSRGB_SkColorProfileType;
+ cs = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
break;
case kRGBA_half_GrPixelConfig:
ct = kRGBA_F16_SkColorType;
@@ -493,8 +493,8 @@ bool GrPixelConfig2ColorAndProfileType(GrPixelConfig config, SkColorType* ctOut,
if (ctOut) {
*ctOut = ct;
}
- if (ptOut) {
- *ptOut = pt;
+ if (csOut) {
+ *csOut = cs;
}
return true;
}
@@ -724,9 +724,9 @@ SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) {
SkASSERT(h <= desc.fHeight);
#endif
const GrPixelConfig config = tex->config();
- SkColorType ct;
+ SkColorType ct = kUnknown_SkColorType;
SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
- if (!GrPixelConfig2ColorAndProfileType(config, &ct, nullptr)) {
+ if (!GrPixelConfigToColorAndColorSpace(config, &ct, nullptr)) {
ct = kUnknown_SkColorType;
}
return SkImageInfo::Make(w, h, ct, at);
diff --git a/src/gpu/SkGrPriv.h b/src/gpu/SkGrPriv.h
index 266cfff61c..ab77dc1e79 100644
--- a/src/gpu/SkGrPriv.h
+++ b/src/gpu/SkGrPriv.h
@@ -102,7 +102,7 @@ bool SkPaintToGrPaintWithTexture(GrContext* context,
GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&, const GrCaps&);
-bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfileType*);
+bool GrPixelConfigToColorAndColorSpace(GrPixelConfig, SkColorType*, sk_sp<SkColorSpace>*);
/**
* If the compressed data in the SkData is supported (as a texture format, this returns