aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGr.cpp
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-03-17 13:01:26 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-17 13:01:26 -0700
commitc571c001cee4e0dfacd7bd17d5cd0a2900a853a9 (patch)
treeb677d3cb745b52dd7f74507de78709c8437b3ecd /src/gpu/SkGr.cpp
parentb893a4c569d0719a395abffb266d1d61af847e2f (diff)
Revert of sRGB support in Ganesh. Several pieces: (patchset #12 id:220001 of https://codereview.chromium.org/1789663002/ )
Reason for revert: We're getting sRGB non-8888 configs? Original issue's description: > sRGB support in Ganesh. Several pieces: > > sRGB support now also requires GL_EXT_texture_sRGB_decode, which allows > us to disable sRGB -> Linear conversion when reading textures. This gives > us an easy way to support "legacy" L32 mode. We disable decoding based on > the pixel config of the render target. Textures can override that behavior > (specifically for format-conversion draws where we want that behavior). > > Added sBGRA pixel config, which is not-really-a-format. It's just sRGBA > internally, and the external format is BGR order, so TexImage calls will > swizzle correctly. This lets us interact with sRGB raster surfaces on BGR > platforms. > > Devices without sRGB support behave like they always have: conversion from > color type and profile type ignores sRGB and always returns linear pixel > configs. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1789663002 > > Committed: https://skia.googlesource.com/skia/+/9e3f1bf4e5cd8fc59554f986f36d6b034e99f9eb TBR=reed@google.com,bsalomon@google.com,robertphillips@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1814533003
Diffstat (limited to 'src/gpu/SkGr.cpp')
-rw-r--r--src/gpu/SkGr.cpp71
1 files changed, 29 insertions, 42 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 866f34d06c..1463336c49 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -43,12 +43,12 @@
# include "etc1.h"
#endif
-GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo& info, const GrCaps& caps) {
+GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo& info) {
GrSurfaceDesc desc;
desc.fFlags = kNone_GrSurfaceFlags;
desc.fWidth = info.width();
desc.fHeight = info.height();
- desc.fConfig = SkImageInfo2GrPixelConfig(info, caps);
+ desc.fConfig = SkImageInfo2GrPixelConfig(info);
desc.fSampleCnt = 0;
return desc;
}
@@ -213,7 +213,7 @@ static GrTexture* load_etc1_texture(GrContext* ctx, const SkBitmap &bm, GrSurfac
}
GrTexture* GrUploadBitmapToTexture(GrContext* ctx, const SkBitmap& bitmap) {
- GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info(), *ctx->caps());
+ GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info());
if (GrTexture *texture = load_etc1_texture(ctx, bitmap, desc)) {
return texture;
}
@@ -238,8 +238,8 @@ GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap) {
SkPixmap tmpPixmap;
SkBitmap tmpBitmap;
+ GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info());
const GrCaps* caps = ctx->caps();
- GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *caps);
if (kIndex_8_SkColorType == pixmap.colorType()) {
if (caps->isConfigTexturable(kIndex_8_GrPixelConfig)) {
@@ -263,7 +263,7 @@ GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap) {
}
pmap = &tmpPixmap;
// must rebuild desc, since we've forced the info to be N32
- desc = GrImageInfoToSurfaceDesc(pmap->info(), *caps);
+ desc = GrImageInfoToSurfaceDesc(pmap->info());
}
}
@@ -289,7 +289,7 @@ void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, SkPixelRef* pix
GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& bitmap)
{
- GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info(), *ctx->caps());
+ GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info());
if (kIndex_8_SkColorType != bitmap.colorType() && !bitmap.readyToDraw()) {
GrTexture* texture = load_etc1_texture(ctx, bitmap, desc);
if (texture) {
@@ -358,38 +358,29 @@ GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap,
// alphatype is ignore for now, but if GrPixelConfig is expanded to encompass
// alpha info, that will be considered.
-GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, SkColorProfileType pt,
- const GrCaps& caps) {
- if (kSRGB_SkColorProfileType == pt && caps.srgbSupport()) {
- switch (ct) {
- case kRGBA_8888_SkColorType:
- return kSRGBA_8888_GrPixelConfig;
- case kBGRA_8888_SkColorType:
- return kSBGRA_8888_GrPixelConfig;
- default:
- break;
- }
- } else {
- switch (ct) {
- case kUnknown_SkColorType:
- return kUnknown_GrPixelConfig;
- case kAlpha_8_SkColorType:
- return kAlpha_8_GrPixelConfig;
- case kRGB_565_SkColorType:
- return kRGB_565_GrPixelConfig;
- case kARGB_4444_SkColorType:
- return kRGBA_4444_GrPixelConfig;
- case kRGBA_8888_SkColorType:
- return kRGBA_8888_GrPixelConfig;
- case kBGRA_8888_SkColorType:
- return kBGRA_8888_GrPixelConfig;
- case kIndex_8_SkColorType:
- return kIndex_8_GrPixelConfig;
- case kGray_8_SkColorType:
- return kAlpha_8_GrPixelConfig; // TODO: gray8 support on gpu
- case kRGBA_F16_SkColorType:
- return kRGBA_half_GrPixelConfig;
- }
+GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, SkColorProfileType pt) {
+ switch (ct) {
+ case kUnknown_SkColorType:
+ return kUnknown_GrPixelConfig;
+ case kAlpha_8_SkColorType:
+ return kAlpha_8_GrPixelConfig;
+ case kRGB_565_SkColorType:
+ return kRGB_565_GrPixelConfig;
+ 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;
+ case kIndex_8_SkColorType:
+ return kIndex_8_GrPixelConfig;
+ case kGray_8_SkColorType:
+ return kAlpha_8_GrPixelConfig; // TODO: gray8 support on gpu
+ case kRGBA_F16_SkColorType:
+ return kRGBA_half_GrPixelConfig;
}
SkASSERT(0); // shouldn't get here
return kUnknown_GrPixelConfig;
@@ -422,10 +413,6 @@ bool GrPixelConfig2ColorAndProfileType(GrPixelConfig config, SkColorType* ctOut,
ct = kRGBA_8888_SkColorType;
pt = kSRGB_SkColorProfileType;
break;
- case kSBGRA_8888_GrPixelConfig:
- ct = kBGRA_8888_SkColorType;
- pt = kSRGB_SkColorProfileType;
- break;
default:
return false;
}