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

Unified Diff: src/gpu/SkGr.cpp

Issue 791823003: Add sRGB texture support. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add in changes for copy_to_new_texture_pixelref Created 6 years 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
Index: src/gpu/SkGr.cpp
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index e311ae2ace4c76991c59a889d9a4ce661dd1ba42..ce073fd4a730f6564f2e856afcd4ca241554e2a3 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -403,7 +403,7 @@ GrTexture* GrRefCachedBitmapTexture(GrContext* ctx,
// alphatype is ignore for now, but if GrPixelConfig is expanded to encompass
// alpha info, that will be considered.
-GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType) {
+GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, SkColorProfileType pt) {
switch (ct) {
case kUnknown_SkColorType:
return kUnknown_GrPixelConfig;
@@ -414,6 +414,9 @@ GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType) {
case kARGB_4444_SkColorType:
return kRGBA_4444_GrPixelConfig;
case kRGBA_8888_SkColorType:
+ if (kSRGB_SkColorProfileType == pt) {
+ return kSRGBA_8888_GrPixelConfig;
+ }
return kRGBA_8888_GrPixelConfig;
case kBGRA_8888_SkColorType:
return kBGRA_8888_GrPixelConfig;
@@ -424,8 +427,10 @@ GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType) {
return kUnknown_GrPixelConfig;
}
-bool GrPixelConfig2ColorType(GrPixelConfig config, SkColorType* ctOut) {
+bool GrPixelConfig2ColorAndProfileType(GrPixelConfig config, SkColorType* ctOut,
+ SkColorProfileType* ptOut) {
SkColorType ct;
+ SkColorProfileType pt = kLinear_SkColorProfileType;
switch (config) {
case kAlpha_8_GrPixelConfig:
ct = kAlpha_8_SkColorType;
@@ -445,12 +450,19 @@ bool GrPixelConfig2ColorType(GrPixelConfig config, SkColorType* ctOut) {
case kBGRA_8888_GrPixelConfig:
ct = kBGRA_8888_SkColorType;
break;
+ case kSRGBA_8888_GrPixelConfig:
+ ct = kRGBA_8888_SkColorType;
+ pt = kSRGB_SkColorProfileType;
+ break;
default:
return false;
}
if (ctOut) {
*ctOut = ct;
}
+ if (ptOut) {
+ *ptOut = pt;
+ }
return true;
}
« include/core/SkPixelRef.h ('K') | « src/gpu/GrSurface.cpp ('k') | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698