Add new SkSourceGammaTreatment enum, used in situations like mipmap construction, where we need to know if we should respect (vs. ignore) the gamma encoding of sRGB tagged images. Plumb that extensively.
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2037413002 Review-Url: https://codereview.chromium.org/2037413002
This commit is contained in:
parent
dc27a648d2
commit
982eb7f377
@ -729,7 +729,7 @@ const GrFragmentProcessor* GrPerlinNoise2Effect::TestCreate(GrProcessorTestData*
|
||||
GrPaint grPaint;
|
||||
return shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), nullptr,
|
||||
kNone_SkFilterQuality);
|
||||
kNone_SkFilterQuality, SkSourceGammaTreatment::kRespect);
|
||||
}
|
||||
|
||||
void GrGLPerlinNoise2::emitCode(EmitArgs& args) {
|
||||
@ -1134,7 +1134,7 @@ const GrFragmentProcessor* GrImprovedPerlinNoiseEffect::TestCreate(GrProcessorTe
|
||||
GrPaint grPaint;
|
||||
return shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), nullptr,
|
||||
kNone_SkFilterQuality);
|
||||
kNone_SkFilterQuality, SkSourceGammaTreatment::kRespect);
|
||||
}
|
||||
|
||||
void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) {
|
||||
@ -1302,7 +1302,8 @@ const GrFragmentProcessor* SkPerlinNoiseShader2::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* externalLocalMatrix,
|
||||
SkFilterQuality) const {
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment gammaTreatment) const {
|
||||
SkASSERT(context);
|
||||
|
||||
SkMatrix localMatrix = this->getLocalMatrix();
|
||||
@ -1328,10 +1329,10 @@ const GrFragmentProcessor* SkPerlinNoiseShader2::asFragmentProcessor(
|
||||
GrTextureParams::FilterMode::kNone_FilterMode);
|
||||
SkAutoTUnref<GrTexture> permutationsTexture(
|
||||
GrRefCachedBitmapTexture(context, paintingData->getImprovedPermutationsBitmap(),
|
||||
textureParams));
|
||||
textureParams, gammaTreatment));
|
||||
SkAutoTUnref<GrTexture> gradientTexture(
|
||||
GrRefCachedBitmapTexture(context, paintingData->getGradientBitmap(),
|
||||
textureParams));
|
||||
textureParams, gammaTreatment));
|
||||
return GrImprovedPerlinNoiseEffect::Create(fNumOctaves, fSeed, paintingData,
|
||||
permutationsTexture, gradientTexture, m);
|
||||
}
|
||||
@ -1350,10 +1351,10 @@ const GrFragmentProcessor* SkPerlinNoiseShader2::asFragmentProcessor(
|
||||
|
||||
SkAutoTUnref<GrTexture> permutationsTexture(
|
||||
GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(),
|
||||
GrTextureParams::ClampNoFilter()));
|
||||
GrTextureParams::ClampNoFilter(), gammaTreatment));
|
||||
SkAutoTUnref<GrTexture> noiseTexture(
|
||||
GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(),
|
||||
GrTextureParams::ClampNoFilter()));
|
||||
GrTextureParams::ClampNoFilter(), gammaTreatment));
|
||||
|
||||
if ((permutationsTexture) && (noiseTexture)) {
|
||||
SkAutoTUnref<GrFragmentProcessor> inner(
|
||||
|
@ -107,7 +107,8 @@ public:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkMatrix& viewM,
|
||||
const SkMatrix*, SkFilterQuality) const override;
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -38,7 +38,8 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality) const override;
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
|
||||
#ifndef SK_IGNORE_TO_STRING
|
||||
void toString(SkString* str) const override {
|
||||
@ -101,7 +102,8 @@ private:
|
||||
const GrFragmentProcessor* DCShader::asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality) const {
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const {
|
||||
SkAutoTUnref<const GrFragmentProcessor> inner(new DCFP(fDeviceMatrix));
|
||||
return GrFragmentProcessor::MulOutputByInputAlpha(inner);
|
||||
}
|
||||
|
@ -316,6 +316,7 @@ protected:
|
||||
#if SK_SUPPORT_GPU
|
||||
SkAutoTUnref<GrTexture> texture(cache->lockAsTexture(canvas->getGrContext(),
|
||||
GrTextureParams::ClampBilerp(),
|
||||
SkSourceGammaTreatment::kRespect,
|
||||
nullptr));
|
||||
if (!texture) {
|
||||
// show placeholder if we have no texture
|
||||
|
@ -82,7 +82,8 @@ protected:
|
||||
}
|
||||
|
||||
SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fBmp,
|
||||
GrTextureParams::ClampNoFilter()));
|
||||
GrTextureParams::ClampNoFilter(),
|
||||
SkSourceGammaTreatment::kRespect));
|
||||
if (!texture) {
|
||||
return;
|
||||
}
|
||||
|
@ -82,11 +82,14 @@ protected:
|
||||
|
||||
SkAutoTUnref<GrTexture> texture[3];
|
||||
texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0],
|
||||
GrTextureParams::ClampBilerp()));
|
||||
GrTextureParams::ClampBilerp(),
|
||||
SkSourceGammaTreatment::kRespect));
|
||||
texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1],
|
||||
GrTextureParams::ClampBilerp()));
|
||||
GrTextureParams::ClampBilerp(),
|
||||
SkSourceGammaTreatment::kRespect));
|
||||
texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2],
|
||||
GrTextureParams::ClampBilerp()));
|
||||
GrTextureParams::ClampBilerp(),
|
||||
SkSourceGammaTreatment::kRespect));
|
||||
|
||||
if (!texture[0] || !texture[1] || !texture[2]) {
|
||||
return;
|
||||
|
@ -176,6 +176,11 @@ enum SkColorProfileType {
|
||||
kLastEnum_SkColorProfileType = kSRGB_SkColorProfileType
|
||||
};
|
||||
|
||||
enum class SkSourceGammaTreatment {
|
||||
kRespect,
|
||||
kIgnore,
|
||||
};
|
||||
|
||||
/**
|
||||
* Describe an image's dimensions and pixel type.
|
||||
* Used for both src images and render-targets (surfaces).
|
||||
|
@ -327,7 +327,8 @@ public:
|
||||
virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality) const;
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const;
|
||||
|
||||
/**
|
||||
* If the shader can represent its "average" luminance in a single color, return true and
|
||||
|
@ -103,7 +103,8 @@ public:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkMatrix& viewM,
|
||||
const SkMatrix*, SkFilterQuality) const override;
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -68,7 +68,8 @@ static inline GrColor SkPMColorToGrColor(SkPMColor c) {
|
||||
/** Returns a texture representing the bitmap that is compatible with the GrTextureParams. The
|
||||
texture is inserted into the cache (unless the bitmap is marked volatile) and can be
|
||||
retrieved again via this function. */
|
||||
GrTexture* GrRefCachedBitmapTexture(GrContext*, const SkBitmap&, const GrTextureParams&);
|
||||
GrTexture* GrRefCachedBitmapTexture(GrContext*, const SkBitmap&, const GrTextureParams&,
|
||||
SkSourceGammaTreatment);
|
||||
|
||||
// TODO: Move SkImageInfo2GrPixelConfig to SkGrPriv.h (requires cleanup to SkWindow its subclasses).
|
||||
GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType, SkAlphaType, SkColorProfileType, const GrCaps&);
|
||||
|
@ -412,7 +412,8 @@ void SkBitmapProcShader::toString(SkString* str) const {
|
||||
|
||||
const GrFragmentProcessor* SkBitmapProcShader::asFragmentProcessor(GrContext* context,
|
||||
const SkMatrix& viewM, const SkMatrix* localMatrix,
|
||||
SkFilterQuality filterQuality) const {
|
||||
SkFilterQuality filterQuality,
|
||||
SkSourceGammaTreatment gammaTreatment) const {
|
||||
SkMatrix matrix;
|
||||
matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height());
|
||||
|
||||
@ -443,7 +444,8 @@ const GrFragmentProcessor* SkBitmapProcShader::asFragmentProcessor(GrContext* co
|
||||
GrSkFilterQualityToGrFilterMode(filterQuality, viewM, this->getLocalMatrix(),
|
||||
&doBicubic);
|
||||
GrTextureParams params(tm, textureFilterMode);
|
||||
SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fRawBitmap, params));
|
||||
SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fRawBitmap, params,
|
||||
gammaTreatment));
|
||||
|
||||
if (!texture) {
|
||||
SkErrorInternals::SetError( kInternalError_SkError,
|
||||
|
@ -26,7 +26,8 @@ public:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& viewM,
|
||||
const SkMatrix*, SkFilterQuality) const override;
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@ -98,13 +98,15 @@ void SkColorFilterShader::FilterShaderContext::shadeSpan4f(int x, int y, SkPM4f
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
const GrFragmentProcessor* SkColorFilterShader::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality fq) const {
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality fq,
|
||||
SkSourceGammaTreatment gammaTreatment) const {
|
||||
|
||||
SkAutoTUnref<const GrFragmentProcessor> fp1(fShader->asFragmentProcessor(context, viewM,
|
||||
localMatrix, fq));
|
||||
localMatrix, fq,
|
||||
gammaTreatment));
|
||||
if (!fp1.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality) const override;
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
class FilterShaderContext : public SkShader::Context {
|
||||
|
@ -91,7 +91,8 @@ SkShader::GradientType SkColorShader::asAGradient(GradientInfo* info) const {
|
||||
#include "effects/GrConstColorProcessor.h"
|
||||
const GrFragmentProcessor* SkColorShader::asFragmentProcessor(GrContext*, const SkMatrix&,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality) const {
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const {
|
||||
GrColor color = SkColorToPremulGrColor(fColor);
|
||||
return GrConstColorProcessor::Create(color, GrConstColorProcessor::kModulateA_InputMode);
|
||||
}
|
||||
@ -218,7 +219,8 @@ SkShader::GradientType SkColor4Shader::asAGradient(GradientInfo* info) const {
|
||||
#include "effects/GrConstColorProcessor.h"
|
||||
const GrFragmentProcessor* SkColor4Shader::asFragmentProcessor(GrContext*, const SkMatrix&,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality) const {
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const {
|
||||
// TODO: how to communicate color4f to Gr
|
||||
GrColor color = SkColorToPremulGrColor(fCachedByteColor);
|
||||
return GrConstColorProcessor::Create(color, GrConstColorProcessor::kModulateA_InputMode);
|
||||
|
@ -50,7 +50,8 @@ public:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& viewM,
|
||||
const SkMatrix*, SkFilterQuality) const override;
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
@ -104,7 +105,8 @@ public:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& viewM,
|
||||
const SkMatrix*, SkFilterQuality) const override;
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -183,10 +183,12 @@ void SkComposeShader::ComposeShaderContext::shadeSpan(int x, int y, SkPMColor re
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
const GrFragmentProcessor* SkComposeShader::asFragmentProcessor(GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality fq) const {
|
||||
const GrFragmentProcessor* SkComposeShader::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality fq,
|
||||
SkSourceGammaTreatment gammaTreatment) const {
|
||||
// Fragment processor will only support SkXfermode::Mode modes currently.
|
||||
SkXfermode::Mode mode;
|
||||
if (!(SkXfermode::AsMode(fMode, &mode))) {
|
||||
@ -199,19 +201,19 @@ const GrFragmentProcessor* SkComposeShader::asFragmentProcessor(GrContext* conte
|
||||
GrConstColorProcessor::kIgnore_InputMode);
|
||||
break;
|
||||
case SkXfermode::kSrc_Mode:
|
||||
return fShaderB->asFragmentProcessor(context, viewM, localMatrix, fq);
|
||||
return fShaderB->asFragmentProcessor(context, viewM, localMatrix, fq, gammaTreatment);
|
||||
break;
|
||||
case SkXfermode::kDst_Mode:
|
||||
return fShaderA->asFragmentProcessor(context, viewM, localMatrix, fq);
|
||||
return fShaderA->asFragmentProcessor(context, viewM, localMatrix, fq, gammaTreatment);
|
||||
break;
|
||||
default:
|
||||
SkAutoTUnref<const GrFragmentProcessor> fpA(fShaderA->asFragmentProcessor(context,
|
||||
viewM, localMatrix, fq));
|
||||
viewM, localMatrix, fq, gammaTreatment));
|
||||
if (!fpA.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
SkAutoTUnref<const GrFragmentProcessor> fpB(fShaderB->asFragmentProcessor(context,
|
||||
viewM, localMatrix, fq));
|
||||
viewM, localMatrix, fq, gammaTreatment));
|
||||
if (!fpB.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality) const override;
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
class ComposeShaderContext : public SkShader::Context {
|
||||
|
@ -249,7 +249,8 @@ static GrTexture* set_key_and_return(GrTexture* tex, const GrUniqueKey& key) {
|
||||
*/
|
||||
GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key,
|
||||
const SkImage* client, SkImage::CachingHint chint,
|
||||
bool willBeMipped) {
|
||||
bool willBeMipped,
|
||||
SkSourceGammaTreatment gammaTreatment) {
|
||||
// Values representing the various texture lock paths we can take. Used for logging the path
|
||||
// taken to a histogram.
|
||||
enum LockTexturePath {
|
||||
@ -315,7 +316,7 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
|
||||
if (this->tryLockAsBitmap(&bitmap, client, chint)) {
|
||||
GrTexture* tex = nullptr;
|
||||
if (willBeMipped) {
|
||||
tex = GrGenerateMipMapsAndUploadToTexture(ctx, bitmap);
|
||||
tex = GrGenerateMipMapsAndUploadToTexture(ctx, bitmap, gammaTreatment);
|
||||
}
|
||||
if (!tex) {
|
||||
tex = GrUploadBitmapToTexture(ctx, bitmap);
|
||||
@ -334,17 +335,20 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParams& params,
|
||||
SkSourceGammaTreatment gammaTreatment,
|
||||
const SkImage* client, SkImage::CachingHint chint) {
|
||||
if (!ctx) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GrImageTextureMaker(ctx, this, client, chint).refTextureForParams(params);
|
||||
return GrImageTextureMaker(ctx, this, client, chint).refTextureForParams(params,
|
||||
gammaTreatment);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParams&,
|
||||
SkSourceGammaTreatment gammaTreatment,
|
||||
const SkImage* client, SkImage::CachingHint) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -48,7 +48,8 @@ public:
|
||||
*
|
||||
* The caller is responsible for calling texture->unref() when they are done.
|
||||
*/
|
||||
GrTexture* lockAsTexture(GrContext*, const GrTextureParams&, const SkImage* client,
|
||||
GrTexture* lockAsTexture(GrContext*, const GrTextureParams&,
|
||||
SkSourceGammaTreatment gammaTreatment, const SkImage* client,
|
||||
SkImage::CachingHint = SkImage::kAllow_CachingHint);
|
||||
|
||||
/**
|
||||
@ -75,7 +76,7 @@ private:
|
||||
// Returns the texture. If the cacherator is generating the texture and wants to cache it,
|
||||
// it should use the passed in key (if the key is valid).
|
||||
GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* client,
|
||||
SkImage::CachingHint, bool willBeMipped);
|
||||
SkImage::CachingHint, bool willBeMipped, SkSourceGammaTreatment);
|
||||
#endif
|
||||
|
||||
class ScopedGenerator {
|
||||
|
@ -75,7 +75,8 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality) const override;
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
class LightingShaderContext : public SkShader::Context {
|
||||
@ -350,10 +351,11 @@ static bool make_mat(const SkBitmap& bm,
|
||||
}
|
||||
|
||||
const GrFragmentProcessor* SkLightingShaderImpl::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality filterQuality) const {
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality filterQuality,
|
||||
SkSourceGammaTreatment gammaTreatment) const {
|
||||
// we assume diffuse and normal maps have same width and height
|
||||
// TODO: support different sizes
|
||||
SkASSERT(fDiffuseMap.width() == fNormalMap.width() &&
|
||||
@ -386,7 +388,8 @@ const GrFragmentProcessor* SkLightingShaderImpl::asFragmentProcessor(
|
||||
// TODO: support other tile modes
|
||||
GrTextureParams diffParams(kClamp_TileMode, diffFilterMode);
|
||||
SkAutoTUnref<GrTexture> diffuseTexture(GrRefCachedBitmapTexture(context,
|
||||
fDiffuseMap, diffParams));
|
||||
fDiffuseMap, diffParams,
|
||||
gammaTreatment));
|
||||
if (!diffuseTexture) {
|
||||
SkErrorInternals::SetError(kInternalError_SkError, "Couldn't convert bitmap to texture.");
|
||||
return nullptr;
|
||||
@ -394,7 +397,8 @@ const GrFragmentProcessor* SkLightingShaderImpl::asFragmentProcessor(
|
||||
|
||||
GrTextureParams normParams(kClamp_TileMode, normFilterMode);
|
||||
SkAutoTUnref<GrTexture> normalTexture(GrRefCachedBitmapTexture(context,
|
||||
fNormalMap, normParams));
|
||||
fNormalMap, normParams,
|
||||
gammaTreatment));
|
||||
if (!normalTexture) {
|
||||
SkErrorInternals::SetError(kInternalError_SkError, "Couldn't convert bitmap to texture.");
|
||||
return nullptr;
|
||||
|
@ -24,14 +24,15 @@ public:
|
||||
}
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality fq) const override {
|
||||
const GrFragmentProcessor* asFragmentProcessor(
|
||||
GrContext* context, const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix, SkFilterQuality fq,
|
||||
SkSourceGammaTreatment gammaTreatment) const override {
|
||||
SkMatrix tmp = this->getLocalMatrix();
|
||||
if (localMatrix) {
|
||||
tmp.preConcat(*localMatrix);
|
||||
}
|
||||
return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq);
|
||||
return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq, gammaTreatment);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -319,10 +319,10 @@ void SkPictureShader::toString(SkString* str) const {
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* SkPictureShader::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality fq) const {
|
||||
GrContext* context, const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality fq,
|
||||
SkSourceGammaTreatment gammaTreatment) const {
|
||||
int maxTextureSize = 0;
|
||||
if (context) {
|
||||
maxTextureSize = context->caps()->maxTextureSize();
|
||||
@ -331,6 +331,6 @@ const GrFragmentProcessor* SkPictureShader::asFragmentProcessor(
|
||||
if (!bitmapShader) {
|
||||
return nullptr;
|
||||
}
|
||||
return bitmapShader->asFragmentProcessor(context, viewM, nullptr, fq);
|
||||
return bitmapShader->asFragmentProcessor(context, viewM, nullptr, fq, gammaTreatment);
|
||||
}
|
||||
#endif
|
||||
|
@ -31,7 +31,8 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality) const override;
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@ -221,7 +221,8 @@ SkShader::GradientType SkShader::asAGradient(GradientInfo* info) const {
|
||||
}
|
||||
|
||||
const GrFragmentProcessor* SkShader::asFragmentProcessor(GrContext*, const SkMatrix&,
|
||||
const SkMatrix*, SkFilterQuality) const {
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
SkSourceGammaTreatment) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,8 @@ sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(GrContext* context) {
|
||||
|
||||
sk_sp<GrTexture> resultTex(GrRefCachedBitmapTexture(context,
|
||||
bmp,
|
||||
GrTextureParams::ClampNoFilter()));
|
||||
GrTextureParams::ClampNoFilter(),
|
||||
SkSourceGammaTreatment::kRespect));
|
||||
if (!resultTex) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -226,7 +227,8 @@ public:
|
||||
#if SK_SUPPORT_GPU
|
||||
sk_sp<GrTexture> onAsTextureRef(GrContext* context) const override {
|
||||
return sk_sp<GrTexture>(as_IB(fImage)->asTextureRef(context,
|
||||
GrTextureParams::ClampNoFilter()));
|
||||
GrTextureParams::ClampNoFilter(),
|
||||
SkSourceGammaTreatment::kRespect));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -368,7 +370,8 @@ public:
|
||||
if (context) {
|
||||
return sk_ref_sp(GrRefCachedBitmapTexture(context,
|
||||
fBitmap,
|
||||
GrTextureParams::ClampNoFilter()));
|
||||
GrTextureParams::ClampNoFilter(),
|
||||
SkSourceGammaTreatment::kRespect));
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -593,7 +593,7 @@ const GrFragmentProcessor* GrPerlinNoiseEffect::TestCreate(GrProcessorTestData*
|
||||
|
||||
return shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), nullptr,
|
||||
kNone_SkFilterQuality);
|
||||
kNone_SkFilterQuality, SkSourceGammaTreatment::kRespect);
|
||||
}
|
||||
|
||||
void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
@ -893,10 +893,11 @@ void GrGLPerlinNoise::onSetData(const GrGLSLProgramDataManager& pdman,
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
const GrFragmentProcessor* SkPerlinNoiseShader::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* externalLocalMatrix,
|
||||
SkFilterQuality) const {
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* externalLocalMatrix,
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment gammaTreatment) const {
|
||||
SkASSERT(context);
|
||||
|
||||
SkMatrix localMatrix = this->getLocalMatrix();
|
||||
@ -926,10 +927,10 @@ const GrFragmentProcessor* SkPerlinNoiseShader::asFragmentProcessor(
|
||||
new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix);
|
||||
SkAutoTUnref<GrTexture> permutationsTexture(
|
||||
GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(),
|
||||
GrTextureParams::ClampNoFilter()));
|
||||
GrTextureParams::ClampNoFilter(), gammaTreatment));
|
||||
SkAutoTUnref<GrTexture> noiseTexture(
|
||||
GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(),
|
||||
GrTextureParams::ClampNoFilter()));
|
||||
GrTextureParams::ClampNoFilter(), gammaTreatment));
|
||||
|
||||
SkMatrix m = viewM;
|
||||
m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1);
|
||||
|
@ -473,7 +473,8 @@ const GrFragmentProcessor* ColorTableEffect::Create(GrContext* context, SkBitmap
|
||||
SkAutoTUnref<GrTexture> texture;
|
||||
if (-1 == row) {
|
||||
atlas = nullptr;
|
||||
texture.reset(GrRefCachedBitmapTexture(context, bitmap, GrTextureParams::ClampNoFilter()));
|
||||
texture.reset(GrRefCachedBitmapTexture(context, bitmap, GrTextureParams::ClampNoFilter(),
|
||||
SkSourceGammaTreatment::kRespect));
|
||||
} else {
|
||||
texture.reset(SkRef(atlas->getTexture()));
|
||||
}
|
||||
|
@ -1131,7 +1131,8 @@ GrGradientEffect::GrGradientEffect(GrContext* ctx,
|
||||
fCoordTransform.reset(kCoordSet, matrix, fAtlas->getTexture(), params.filterMode());
|
||||
fTextureAccess.reset(fAtlas->getTexture(), params);
|
||||
} else {
|
||||
SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(ctx, bitmap, params));
|
||||
SkAutoTUnref<GrTexture> texture(
|
||||
GrRefCachedBitmapTexture(ctx, bitmap, params, SkSourceGammaTreatment::kRespect));
|
||||
if (!texture) {
|
||||
return;
|
||||
}
|
||||
|
@ -418,7 +418,8 @@ const GrFragmentProcessor* GrLinearGradient::TestCreate(GrProcessorTestData* d)
|
||||
int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm);
|
||||
auto shader = SkGradientShader::MakeLinear(points, colors, stops, colorCount, tm);
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality,
|
||||
SkSourceGammaTreatment::kRespect);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -445,7 +446,8 @@ const GrFragmentProcessor* SkLinearGradient::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewm,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality) const {
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const {
|
||||
SkASSERT(context);
|
||||
|
||||
SkMatrix matrix;
|
||||
|
@ -60,7 +60,8 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality) const override;
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -313,7 +313,8 @@ const GrFragmentProcessor* GrRadialGradient::TestCreate(GrProcessorTestData* d)
|
||||
int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm);
|
||||
auto shader = SkGradientShader::MakeRadial(center, radius, colors, stops, colorCount, tm);
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality,
|
||||
SkSourceGammaTreatment::kRespect);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -341,7 +342,8 @@ const GrFragmentProcessor* SkRadialGradient::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality) const {
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const {
|
||||
SkASSERT(context);
|
||||
|
||||
SkMatrix matrix;
|
||||
|
@ -29,7 +29,8 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality) const override;
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -193,7 +193,8 @@ const GrFragmentProcessor* GrSweepGradient::TestCreate(GrProcessorTestData* d) {
|
||||
colorCount));
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
NULL, kNone_SkFilterQuality);
|
||||
NULL, kNone_SkFilterQuality,
|
||||
SkSourceGammaTreatment::kRespect);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -230,7 +231,8 @@ const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality) const {
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const {
|
||||
|
||||
SkMatrix matrix;
|
||||
if (!this->getLocalMatrix().invert(&matrix)) {
|
||||
|
@ -30,7 +30,8 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality) const override;
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -360,7 +360,8 @@ const GrFragmentProcessor* SkTwoPointConicalGradient::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality) const {
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const {
|
||||
SkASSERT(context);
|
||||
SkASSERT(fPtsToUnit.isIdentity());
|
||||
SkAutoTUnref<const GrFragmentProcessor> inner(
|
||||
|
@ -60,7 +60,8 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix&,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality) const override;
|
||||
SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
bool isOpaque() const override;
|
||||
|
||||
|
@ -209,7 +209,8 @@ const GrFragmentProcessor* Edge2PtConicalEffect::TestCreate(GrProcessorTestData*
|
||||
auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2,
|
||||
colors, stops, colorCount, tm);
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality,
|
||||
SkSourceGammaTreatment::kRespect);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -484,7 +485,8 @@ const GrFragmentProcessor* FocalOutside2PtConicalEffect::TestCreate(GrProcessorT
|
||||
auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2,
|
||||
colors, stops, colorCount, tm);
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality,
|
||||
SkSourceGammaTreatment::kRespect);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -690,7 +692,8 @@ const GrFragmentProcessor* FocalInside2PtConicalEffect::TestCreate(GrProcessorTe
|
||||
auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2,
|
||||
colors, stops, colorCount, tm);
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality,
|
||||
SkSourceGammaTreatment::kRespect);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -936,7 +939,8 @@ const GrFragmentProcessor* CircleInside2PtConicalEffect::TestCreate(GrProcessorT
|
||||
auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2,
|
||||
colors, stops, colorCount, tm);
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality,
|
||||
SkSourceGammaTreatment::kRespect);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -1167,7 +1171,8 @@ const GrFragmentProcessor* CircleOutside2PtConicalEffect::TestCreate(GrProcessor
|
||||
auto shader = SkGradientShader::MakeTwoPointConical(center1, radius1, center2, radius2,
|
||||
colors, stops, colorCount, tm);
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(
|
||||
d->fContext,GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
d->fContext,GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality,
|
||||
SkSourceGammaTreatment::kRespect);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
|
@ -81,7 +81,8 @@ GrBitmapTextureMaker::GrBitmapTextureMaker(GrContext* context, const SkBitmap& b
|
||||
}
|
||||
}
|
||||
|
||||
GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped) {
|
||||
GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped,
|
||||
SkSourceGammaTreatment gammaTreatment) {
|
||||
GrTexture* tex = nullptr;
|
||||
|
||||
if (fOriginalKey.isValid()) {
|
||||
@ -91,7 +92,7 @@ GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped) {
|
||||
}
|
||||
}
|
||||
if (willBeMipped) {
|
||||
tex = GrGenerateMipMapsAndUploadToTexture(this->context(), fBitmap);
|
||||
tex = GrGenerateMipMapsAndUploadToTexture(this->context(), fBitmap, gammaTreatment);
|
||||
}
|
||||
if (!tex) {
|
||||
tex = GrUploadBitmapToTexture(this->context(), fBitmap);
|
||||
@ -130,8 +131,10 @@ GrImageTextureMaker::GrImageTextureMaker(GrContext* context, SkImageCacherator*
|
||||
}
|
||||
}
|
||||
|
||||
GrTexture* GrImageTextureMaker::refOriginalTexture(bool willBeMipped) {
|
||||
return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCachingHint, willBeMipped);
|
||||
GrTexture* GrImageTextureMaker::refOriginalTexture(bool willBeMipped,
|
||||
SkSourceGammaTreatment gammaTreatment) {
|
||||
return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCachingHint, willBeMipped,
|
||||
gammaTreatment);
|
||||
}
|
||||
|
||||
void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) {
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap);
|
||||
|
||||
protected:
|
||||
GrTexture* refOriginalTexture(bool willBeMipped) override;
|
||||
GrTexture* refOriginalTexture(bool willBeMipped, SkSourceGammaTreatment) override;
|
||||
|
||||
void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey) override;
|
||||
|
||||
@ -80,7 +80,7 @@ protected:
|
||||
// able to efficiently produce a "stretched" texture natively (e.g. picture-backed)
|
||||
// GrTexture* generateTextureForParams(const CopyParams&) override;
|
||||
|
||||
GrTexture* refOriginalTexture(bool willBeMipped) override;
|
||||
GrTexture* refOriginalTexture(bool willBeMipped, SkSourceGammaTreatment) override;
|
||||
void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) override;
|
||||
void didCacheCopy(const GrUniqueKey& copyKey) override;
|
||||
|
||||
|
@ -158,6 +158,7 @@ GrTexture* GrTextureAdjuster::refCopy(const CopyParams& copyParams) {
|
||||
}
|
||||
|
||||
GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrTextureParams& params,
|
||||
SkSourceGammaTreatment gammaTreatment,
|
||||
SkIPoint* outOffset) {
|
||||
GrTexture* texture = this->originalTexture();
|
||||
GrContext* context = texture->getContext();
|
||||
@ -373,7 +374,8 @@ const GrFragmentProcessor* GrTextureAdjuster::createFragmentProcessor(
|
||||
const SkRect& origConstraintRect,
|
||||
FilterConstraint filterConstraint,
|
||||
bool coordsLimitedToConstraintRect,
|
||||
const GrTextureParams::FilterMode* filterOrNullForBicubic) {
|
||||
const GrTextureParams::FilterMode* filterOrNullForBicubic,
|
||||
SkSourceGammaTreatment gammaTreatment) {
|
||||
|
||||
SkMatrix textureMatrix = origTextureMatrix;
|
||||
const SkIRect* contentArea = this->contentAreaOrNull();
|
||||
@ -392,7 +394,7 @@ const GrFragmentProcessor* GrTextureAdjuster::createFragmentProcessor(
|
||||
if (filterOrNullForBicubic) {
|
||||
params.setFilterMode(*filterOrNullForBicubic);
|
||||
}
|
||||
SkAutoTUnref<GrTexture> texture(this->refTextureSafeForParams(params, nullptr));
|
||||
SkAutoTUnref<GrTexture> texture(this->refTextureSafeForParams(params, gammaTreatment, nullptr));
|
||||
if (!texture) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -431,7 +433,8 @@ const GrFragmentProcessor* GrTextureAdjuster::createFragmentProcessor(
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params) {
|
||||
GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params,
|
||||
SkSourceGammaTreatment gammaTreatment) {
|
||||
CopyParams copyParams;
|
||||
bool willBeMipped = params.filterMode() == GrTextureParams::kMipMap_FilterMode;
|
||||
|
||||
@ -441,7 +444,7 @@ GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params) {
|
||||
|
||||
if (!fContext->getGpu()->makeCopyForTextureParams(this->width(), this->height(), params,
|
||||
©Params)) {
|
||||
return this->refOriginalTexture(willBeMipped);
|
||||
return this->refOriginalTexture(willBeMipped, gammaTreatment);
|
||||
}
|
||||
GrUniqueKey copyKey;
|
||||
this->makeCopyKey(copyParams, ©Key);
|
||||
@ -452,7 +455,7 @@ GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params) {
|
||||
}
|
||||
}
|
||||
|
||||
GrTexture* result = this->generateTextureForParams(copyParams, willBeMipped);
|
||||
GrTexture* result = this->generateTextureForParams(copyParams, willBeMipped, gammaTreatment);
|
||||
if (!result) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -469,7 +472,8 @@ const GrFragmentProcessor* GrTextureMaker::createFragmentProcessor(
|
||||
const SkRect& constraintRect,
|
||||
FilterConstraint filterConstraint,
|
||||
bool coordsLimitedToConstraintRect,
|
||||
const GrTextureParams::FilterMode* filterOrNullForBicubic) {
|
||||
const GrTextureParams::FilterMode* filterOrNullForBicubic,
|
||||
SkSourceGammaTreatment gammaTreatment) {
|
||||
|
||||
const GrTextureParams::FilterMode* fmForDetermineDomain = filterOrNullForBicubic;
|
||||
if (filterOrNullForBicubic && GrTextureParams::kMipMap_FilterMode == *filterOrNullForBicubic &&
|
||||
@ -490,7 +494,7 @@ const GrFragmentProcessor* GrTextureMaker::createFragmentProcessor(
|
||||
// Bicubic doesn't use filtering for it's texture accesses.
|
||||
params.reset(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode);
|
||||
}
|
||||
SkAutoTUnref<GrTexture> texture(this->refTextureForParams(params));
|
||||
SkAutoTUnref<GrTexture> texture(this->refTextureForParams(params, gammaTreatment));
|
||||
if (!texture) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -506,9 +510,9 @@ const GrFragmentProcessor* GrTextureMaker::createFragmentProcessor(
|
||||
filterOrNullForBicubic);
|
||||
}
|
||||
|
||||
GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams,
|
||||
bool willBeMipped) {
|
||||
SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped));
|
||||
GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams, bool willBeMipped,
|
||||
SkSourceGammaTreatment gammaTreatment) {
|
||||
SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gammaTreatment));
|
||||
if (!original) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -64,7 +64,8 @@ public:
|
||||
const SkRect& constraintRect,
|
||||
FilterConstraint filterConstraint,
|
||||
bool coordsLimitedToConstraintRect,
|
||||
const GrTextureParams::FilterMode* filterOrNullForBicubic) = 0;
|
||||
const GrTextureParams::FilterMode* filterOrNullForBicubic,
|
||||
SkSourceGammaTreatment) = 0;
|
||||
|
||||
virtual ~GrTextureProducer() {}
|
||||
|
||||
@ -127,14 +128,16 @@ public:
|
||||
outOffset will be the top-left corner of the subset if a copy is not made. Otherwise,
|
||||
the copy will be tight to the contents and outOffset will be (0, 0). If the copy's size
|
||||
does not match subset's dimensions then the contents are scaled to fit the copy.*/
|
||||
GrTexture* refTextureSafeForParams(const GrTextureParams&, SkIPoint* outOffset);
|
||||
GrTexture* refTextureSafeForParams(const GrTextureParams&, SkSourceGammaTreatment,
|
||||
SkIPoint* outOffset);
|
||||
|
||||
const GrFragmentProcessor* createFragmentProcessor(
|
||||
const SkMatrix& textureMatrix,
|
||||
const SkRect& constraintRect,
|
||||
FilterConstraint,
|
||||
bool coordsLimitedToConstraintRect,
|
||||
const GrTextureParams::FilterMode* filterOrNullForBicubic) override;
|
||||
const GrTextureParams::FilterMode* filterOrNullForBicubic,
|
||||
SkSourceGammaTreatment) override;
|
||||
|
||||
protected:
|
||||
/** The whole texture is content. */
|
||||
@ -167,14 +170,15 @@ public:
|
||||
/** Returns a texture that is safe for use with the params. If the size of the returned texture
|
||||
does not match width()/height() then the contents of the original must be scaled to fit
|
||||
the texture. */
|
||||
GrTexture* refTextureForParams(const GrTextureParams&);
|
||||
GrTexture* refTextureForParams(const GrTextureParams&, SkSourceGammaTreatment);
|
||||
|
||||
const GrFragmentProcessor* createFragmentProcessor(
|
||||
const SkMatrix& textureMatrix,
|
||||
const SkRect& constraintRect,
|
||||
FilterConstraint filterConstraint,
|
||||
bool coordsLimitedToConstraintRect,
|
||||
const GrTextureParams::FilterMode* filterOrNullForBicubic) override;
|
||||
const GrTextureParams::FilterMode* filterOrNullForBicubic,
|
||||
SkSourceGammaTreatment) override;
|
||||
|
||||
protected:
|
||||
GrTextureMaker(GrContext* context, int width, int height, bool isAlphaOnly)
|
||||
@ -185,7 +189,7 @@ protected:
|
||||
* Return the maker's "original" texture. It is the responsibility of the maker to handle any
|
||||
* caching of the original if desired.
|
||||
*/
|
||||
virtual GrTexture* refOriginalTexture(bool willBeMipped) = 0;
|
||||
virtual GrTexture* refOriginalTexture(bool willBeMipped, SkSourceGammaTreatment) = 0;
|
||||
|
||||
/**
|
||||
* Return a new (uncached) texture that is the stretch of the maker's original.
|
||||
@ -197,7 +201,8 @@ protected:
|
||||
* Subclass may override this if they can handle creating the texture more directly than
|
||||
* by copying.
|
||||
*/
|
||||
virtual GrTexture* generateTextureForParams(const CopyParams&, bool willBeMipped);
|
||||
virtual GrTexture* generateTextureForParams(const CopyParams&, bool willBeMipped,
|
||||
SkSourceGammaTreatment);
|
||||
|
||||
GrContext* context() const { return fContext; }
|
||||
|
||||
|
@ -80,21 +80,23 @@ public:
|
||||
AutoBitmapTexture(GrContext* context,
|
||||
const SkBitmap& bitmap,
|
||||
const GrTextureParams& params,
|
||||
SkSourceGammaTreatment gammaTreatment,
|
||||
GrTexture** texture) {
|
||||
SkASSERT(texture);
|
||||
*texture = this->set(context, bitmap, params);
|
||||
*texture = this->set(context, bitmap, params, gammaTreatment);
|
||||
}
|
||||
|
||||
GrTexture* set(GrContext* context,
|
||||
const SkBitmap& bitmap,
|
||||
const GrTextureParams& params) {
|
||||
const GrTextureParams& params,
|
||||
SkSourceGammaTreatment gammaTreatment) {
|
||||
// Either get the texture directly from the bitmap, or else use the cache and
|
||||
// remember to unref it.
|
||||
if (GrTexture* bmpTexture = bitmap.getTexture()) {
|
||||
fTexture.reset(nullptr);
|
||||
return bmpTexture;
|
||||
} else {
|
||||
fTexture.reset(GrRefCachedBitmapTexture(context, bitmap, params));
|
||||
fTexture.reset(GrRefCachedBitmapTexture(context, bitmap, params, gammaTreatment));
|
||||
return fTexture.get();
|
||||
}
|
||||
}
|
||||
@ -260,7 +262,8 @@ void SkGpuDevice::drawSpriteWithFilter(const SkDraw& draw, const SkBitmap& bitma
|
||||
|
||||
GrTexture* texture;
|
||||
// draw sprite neither filters nor tiles.
|
||||
AutoBitmapTexture abt(fContext, bitmap, GrTextureParams::ClampNoFilter(), &texture);
|
||||
AutoBitmapTexture abt(fContext, bitmap, GrTextureParams::ClampNoFilter(),
|
||||
SkSourceGammaTreatment::kRespect, &texture);
|
||||
if (!texture) {
|
||||
return;
|
||||
}
|
||||
@ -1165,7 +1168,9 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
|
||||
bitmap.height() <= fContext->caps()->maxTileSize()));
|
||||
|
||||
GrTexture* texture;
|
||||
AutoBitmapTexture abt(fContext, bitmap, params, &texture);
|
||||
SkSourceGammaTreatment gammaTreatment = this->surfaceProps().isGammaCorrect()
|
||||
? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore;
|
||||
AutoBitmapTexture abt(fContext, bitmap, params, gammaTreatment, &texture);
|
||||
if (nullptr == texture) {
|
||||
return;
|
||||
}
|
||||
@ -1264,7 +1269,8 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
|
||||
|
||||
GrTexture* texture;
|
||||
// draw sprite neither filters nor tiles.
|
||||
AutoBitmapTexture abt(fContext, bitmap, GrTextureParams::ClampNoFilter(), &texture);
|
||||
AutoBitmapTexture abt(fContext, bitmap, GrTextureParams::ClampNoFilter(),
|
||||
SkSourceGammaTreatment::kRespect, &texture);
|
||||
if (!texture) {
|
||||
return;
|
||||
}
|
||||
@ -1520,15 +1526,17 @@ void SkGpuDevice::drawProducerNine(const SkDraw& draw, GrTextureProducer* produc
|
||||
}
|
||||
|
||||
static const GrTextureParams::FilterMode kMode = GrTextureParams::kNone_FilterMode;
|
||||
bool gammaCorrect = this->surfaceProps().isGammaCorrect();
|
||||
SkSourceGammaTreatment gammaTreatment = gammaCorrect
|
||||
? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore;
|
||||
SkAutoTUnref<const GrFragmentProcessor> fp(
|
||||
producer->createFragmentProcessor(SkMatrix::I(),
|
||||
SkRect::MakeIWH(producer->width(), producer->height()),
|
||||
GrTextureProducer::kNo_FilterConstraint, true,
|
||||
&kMode));
|
||||
&kMode, gammaTreatment));
|
||||
GrPaint grPaint;
|
||||
if (!SkPaintToGrPaintWithTexture(this->context(), paint, *draw.fMatrix, fp,
|
||||
producer->isAlphaOnly(),
|
||||
this->surfaceProps().isGammaCorrect(), &grPaint)) {
|
||||
producer->isAlphaOnly(), gammaCorrect, &grPaint)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -201,15 +201,19 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
|
||||
}
|
||||
textureMatrix = &tempMatrix;
|
||||
}
|
||||
bool gammaCorrect = this->surfaceProps().isGammaCorrect();
|
||||
SkSourceGammaTreatment gammaTreatment = gammaCorrect
|
||||
? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore;
|
||||
SkAutoTUnref<const GrFragmentProcessor> fp(producer->createFragmentProcessor(
|
||||
*textureMatrix, clippedSrcRect, constraintMode, coordsAllInsideSrcRect, filterMode));
|
||||
*textureMatrix, clippedSrcRect, constraintMode, coordsAllInsideSrcRect, filterMode,
|
||||
gammaTreatment));
|
||||
if (!fp) {
|
||||
return;
|
||||
}
|
||||
|
||||
GrPaint grPaint;
|
||||
if (!SkPaintToGrPaintWithTexture(fContext, paint, viewMatrix, fp, producer->isAlphaOnly(),
|
||||
this->surfaceProps().isGammaCorrect(), &grPaint)) {
|
||||
gammaCorrect, &grPaint)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,8 @@ void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, SkPixelRef* pix
|
||||
pixelRef->addGenIDChangeListener(new Invalidator(key));
|
||||
}
|
||||
|
||||
GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& bitmap)
|
||||
GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& bitmap,
|
||||
SkSourceGammaTreatment gammaTreatment)
|
||||
{
|
||||
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info(), *ctx->caps());
|
||||
if (kIndex_8_SkColorType != bitmap.colorType() && !bitmap.readyToDraw()) {
|
||||
@ -403,11 +404,13 @@ GrTexture* GrUploadMipMapToTexture(GrContext* ctx, const SkImageInfo& info,
|
||||
}
|
||||
|
||||
GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap,
|
||||
const GrTextureParams& params) {
|
||||
const GrTextureParams& params,
|
||||
SkSourceGammaTreatment gammaTreatment) {
|
||||
if (bitmap.getTexture()) {
|
||||
return GrBitmapTextureAdjuster(&bitmap).refTextureSafeForParams(params, nullptr);
|
||||
return GrBitmapTextureAdjuster(&bitmap).refTextureSafeForParams(params, gammaTreatment,
|
||||
nullptr);
|
||||
}
|
||||
return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params);
|
||||
return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params, gammaTreatment);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -519,8 +522,10 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
|
||||
if (shaderProcessor) {
|
||||
shaderFP = *shaderProcessor;
|
||||
} else if (const SkShader* shader = skPaint.getShader()) {
|
||||
SkSourceGammaTreatment gammaTreatment = allowSRGBInputs
|
||||
? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore;
|
||||
aufp.reset(shader->asFragmentProcessor(context, viewM, nullptr,
|
||||
skPaint.getFilterQuality()));
|
||||
skPaint.getFilterQuality(), gammaTreatment));
|
||||
shaderFP = aufp;
|
||||
if (!shaderFP) {
|
||||
return false;
|
||||
@ -689,10 +694,13 @@ bool SkPaintToGrPaintWithTexture(GrContext* context,
|
||||
SkAutoTUnref<const GrFragmentProcessor> shaderFP;
|
||||
if (textureIsAlphaOnly) {
|
||||
if (const SkShader* shader = paint.getShader()) {
|
||||
SkSourceGammaTreatment gammaTreatment = allowSRGBInputs
|
||||
? SkSourceGammaTreatment::kRespect : SkSourceGammaTreatment::kIgnore;
|
||||
shaderFP.reset(shader->asFragmentProcessor(context,
|
||||
viewM,
|
||||
nullptr,
|
||||
paint.getFilterQuality()));
|
||||
paint.getFilterQuality(),
|
||||
gammaTreatment));
|
||||
if (!shaderFP) {
|
||||
return false;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data,
|
||||
*/
|
||||
GrTexture* GrUploadBitmapToTexture(GrContext*, const SkBitmap&);
|
||||
|
||||
GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext*, const SkBitmap&);
|
||||
GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext*, const SkBitmap&, SkSourceGammaTreatment);
|
||||
|
||||
/**
|
||||
* Creates a new texture for the pixmap.
|
||||
|
@ -83,10 +83,12 @@ void SkImageShader::toString(SkString* str) const {
|
||||
#include "effects/GrBicubicEffect.h"
|
||||
#include "effects/GrSimpleTextureEffect.h"
|
||||
|
||||
const GrFragmentProcessor* SkImageShader::asFragmentProcessor(GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality filterQuality) const {
|
||||
const GrFragmentProcessor* SkImageShader::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality filterQuality,
|
||||
SkSourceGammaTreatment gammaTreatment) const {
|
||||
SkMatrix matrix;
|
||||
matrix.setIDiv(fImage->width(), fImage->height());
|
||||
|
||||
@ -113,7 +115,7 @@ const GrFragmentProcessor* SkImageShader::asFragmentProcessor(GrContext* context
|
||||
GrTextureParams::FilterMode textureFilterMode =
|
||||
GrSkFilterQualityToGrFilterMode(filterQuality, viewM, this->getLocalMatrix(), &doBicubic);
|
||||
GrTextureParams params(tm, textureFilterMode);
|
||||
SkAutoTUnref<GrTexture> texture(as_IB(fImage)->asTextureRef(context, params));
|
||||
SkAutoTUnref<GrTexture> texture(as_IB(fImage)->asTextureRef(context, params, gammaTreatment));
|
||||
if (!texture) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ public:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& viewM,
|
||||
const SkMatrix*, SkFilterQuality) const override;
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
SkSourceGammaTreatment) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@ -49,7 +49,8 @@ public:
|
||||
}
|
||||
|
||||
// Caller must call unref when they are done.
|
||||
virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const = 0;
|
||||
virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&,
|
||||
SkSourceGammaTreatment) const = 0;
|
||||
|
||||
virtual sk_sp<SkImage> onMakeSubset(const SkIRect&) const = 0;
|
||||
|
||||
|
@ -31,7 +31,8 @@ public:
|
||||
bool isOpaque() const override { return fCache->info().isOpaque(); }
|
||||
sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
|
||||
bool getROPixels(SkBitmap*, CachingHint) const override;
|
||||
GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const override;
|
||||
GrTexture* asTextureRef(GrContext*, const GrTextureParams&,
|
||||
SkSourceGammaTreatment) const override;
|
||||
bool onIsLazyGenerated() const override { return true; }
|
||||
|
||||
private:
|
||||
@ -73,8 +74,9 @@ bool SkImage_Generator::getROPixels(SkBitmap* bitmap, CachingHint chint) const {
|
||||
return fCache->lockAsBitmap(bitmap, this, chint);
|
||||
}
|
||||
|
||||
GrTexture* SkImage_Generator::asTextureRef(GrContext* ctx, const GrTextureParams& params) const {
|
||||
return fCache->lockAsTexture(ctx, params, this);
|
||||
GrTexture* SkImage_Generator::asTextureRef(GrContext* ctx, const GrTextureParams& params,
|
||||
SkSourceGammaTreatment gammaTreatment) const {
|
||||
return fCache->lockAsTexture(ctx, params, gammaTreatment, this);
|
||||
}
|
||||
|
||||
sk_sp<SkImage> SkImage_Generator::onMakeSubset(const SkIRect& subset) const {
|
||||
|
@ -77,8 +77,10 @@ bool SkImage_Gpu::asBitmapForImageFilters(SkBitmap* bitmap) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& params) const {
|
||||
return GrImageTextureAdjuster(as_IB(this)).refTextureSafeForParams(params, nullptr);
|
||||
GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& params,
|
||||
SkSourceGammaTreatment gammaTreatment) const {
|
||||
return GrImageTextureAdjuster(as_IB(this)).refTextureSafeForParams(params, gammaTreatment,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
bool SkImage_Gpu::isOpaque() const {
|
||||
@ -277,7 +279,8 @@ sk_sp<SkImage> SkImage::MakeFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace
|
||||
}
|
||||
|
||||
static sk_sp<SkImage> create_image_from_maker(GrTextureMaker* maker, SkAlphaType at, uint32_t id) {
|
||||
SkAutoTUnref<GrTexture> texture(maker->refTextureForParams(GrTextureParams::ClampNoFilter()));
|
||||
SkAutoTUnref<GrTexture> texture(maker->refTextureForParams(GrTextureParams::ClampNoFilter(),
|
||||
SkSourceGammaTreatment::kRespect));
|
||||
if (!texture) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ public:
|
||||
}
|
||||
|
||||
bool getROPixels(SkBitmap*, CachingHint) const override;
|
||||
GrTexture* asTextureRef(GrContext* ctx, const GrTextureParams& params) const override;
|
||||
GrTexture* asTextureRef(GrContext* ctx, const GrTextureParams& params,
|
||||
SkSourceGammaTreatment) const override;
|
||||
sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
|
||||
|
||||
GrTexture* peekTexture() const override { return fTexture; }
|
||||
|
@ -82,7 +82,8 @@ public:
|
||||
bool onPeekPixels(SkPixmap*) const override;
|
||||
SkData* onRefEncoded(GrContext*) const override;
|
||||
bool getROPixels(SkBitmap*, CachingHint) const override;
|
||||
GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const override;
|
||||
GrTexture* asTextureRef(GrContext*, const GrTextureParams&,
|
||||
SkSourceGammaTreatment) const override;
|
||||
sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
|
||||
|
||||
// exposed for SkSurface_Raster via SkNewImageFromPixelRef
|
||||
@ -174,13 +175,14 @@ bool SkImage_Raster::getROPixels(SkBitmap* dst, CachingHint) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrTextureParams& params) const {
|
||||
GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrTextureParams& params,
|
||||
SkSourceGammaTreatment gammaTreatment) const {
|
||||
#if SK_SUPPORT_GPU
|
||||
if (!ctx) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GrRefCachedBitmapTexture(ctx, fBitmap, params);
|
||||
return GrRefCachedBitmapTexture(ctx, fBitmap, params, gammaTreatment);
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
|
@ -587,7 +587,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadPixels_Subset_Gpu, reporter, ctxInfo)
|
||||
|
||||
// ... one from a texture-subset
|
||||
SkAutoTUnref<GrTexture> fullTx(GrRefCachedBitmapTexture(ctxInfo.grContext(), bitmap,
|
||||
GrTextureParams::ClampNoFilter()));
|
||||
GrTextureParams::ClampNoFilter(),
|
||||
SkSourceGammaTreatment::kRespect));
|
||||
SkBitmap tx_full;
|
||||
GrWrapTextureInBitmap(fullTx, bitmap.width(), bitmap.height(), true, &tx_full);
|
||||
tx_full.extractSubset(&tx_subset, subset);
|
||||
@ -596,7 +597,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadPixels_Subset_Gpu, reporter, ctxInfo)
|
||||
SkBitmap tmp_subset;
|
||||
bitmap.extractSubset(&tmp_subset, subset);
|
||||
SkAutoTUnref<GrTexture> subsetTx(GrRefCachedBitmapTexture(ctxInfo.grContext(), tmp_subset,
|
||||
GrTextureParams::ClampNoFilter()));
|
||||
GrTextureParams::ClampNoFilter(),
|
||||
SkSourceGammaTreatment::kRespect));
|
||||
GrWrapTextureInBitmap(subsetTx, tmp_subset.width(), tmp_subset.height(), true, &bm_subset);
|
||||
|
||||
// did we get the same subset?
|
||||
|
Loading…
Reference in New Issue
Block a user