m.setTranslateY(-localMatrix.getTranslateY() + SK_Scalar1);
if (fType == kImprovedNoise_Type) {
- GrTextureParams textureParams(SkShader::TileMode::kRepeat_TileMode,
- GrTextureParams::FilterMode::kNone_FilterMode);
+ GrSamplerParams textureParams(SkShader::TileMode::kRepeat_TileMode,
+ GrSamplerParams::FilterMode::kNone_FilterMode);
sk_sp<GrTexture> permutationsTexture(
GrRefCachedBitmapTexture(args.fContext, paintingData->getImprovedPermutationsBitmap(),
textureParams, args.fColorMode));
sk_sp<GrTexture> permutationsTexture(
GrRefCachedBitmapTexture(args.fContext, paintingData->getPermutationsBitmap(),
- GrTextureParams::ClampNoFilter(), args.fColorMode));
+ GrSamplerParams::ClampNoFilter(), args.fColorMode));
sk_sp<GrTexture> noiseTexture(
GrRefCachedBitmapTexture(args.fContext, paintingData->getNoiseBitmap(),
- GrTextureParams::ClampNoFilter(), args.fColorMode));
+ GrSamplerParams::ClampNoFilter(), args.fColorMode));
if ((permutationsTexture) && (noiseTexture)) {
sk_sp<GrFragmentProcessor> inner(
static void draw_as_tex(SkCanvas* canvas, SkImageCacherator* cache, SkScalar x, SkScalar y) {
#if SK_SUPPORT_GPU
sk_sp<GrTexture> texture(
- cache->lockAsTexture(canvas->getGrContext(), GrTextureParams::ClampBilerp(),
+ cache->lockAsTexture(canvas->getGrContext(), GrSamplerParams::ClampBilerp(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware, nullptr));
if (!texture) {
// show placeholder if we have no texture
}
sk_sp<GrTexture> texture(
- GrRefCachedBitmapTexture(context, fBmp, GrTextureParams::ClampNoFilter(),
+ GrRefCachedBitmapTexture(context, fBmp, GrSamplerParams::ClampNoFilter(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
if (!texture) {
return;
GrTextureDomainEffect::Make(texture.get(), nullptr, textureMatrices[tm],
GrTextureDomain::MakeTexelDomain(texture.get(),
texelDomains[d]),
- mode, GrTextureParams::kNone_FilterMode));
+ mode, GrSamplerParams::kNone_FilterMode));
if (!fp) {
continue;
sk_sp<GrTexture> texture[3];
texture[0].reset(
- GrRefCachedBitmapTexture(context, fBmp[0], GrTextureParams::ClampBilerp(),
+ GrRefCachedBitmapTexture(context, fBmp[0], GrSamplerParams::ClampBilerp(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
texture[1].reset(
- GrRefCachedBitmapTexture(context, fBmp[1], GrTextureParams::ClampBilerp(),
+ GrRefCachedBitmapTexture(context, fBmp[1], GrSamplerParams::ClampBilerp(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
texture[2].reset(
- GrRefCachedBitmapTexture(context, fBmp[2], GrTextureParams::ClampBilerp(),
+ GrRefCachedBitmapTexture(context, fBmp[2], GrSamplerParams::ClampBilerp(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
if (!texture[0] || !texture[1] || !texture[2]) {
sk_sp<GrTexture> texture[3];
texture[0].reset(
- GrRefCachedBitmapTexture(context, fBmp[0], GrTextureParams::ClampBilerp(),
+ GrRefCachedBitmapTexture(context, fBmp[0], GrSamplerParams::ClampBilerp(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
texture[1].reset(
- GrRefCachedBitmapTexture(context, fBmp[1], GrTextureParams::ClampBilerp(),
+ GrRefCachedBitmapTexture(context, fBmp[1], GrSamplerParams::ClampBilerp(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
texture[2].reset(
- GrRefCachedBitmapTexture(context, fBmp[1], GrTextureParams::ClampBilerp(),
+ GrRefCachedBitmapTexture(context, fBmp[1], GrSamplerParams::ClampBilerp(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
if (!texture[0] || !texture[1] || !texture[2]) {
"$_include/gpu/GrShaderVar.h",
"$_include/gpu/GrSurface.h",
"$_include/gpu/GrTexture.h",
- "$_include/gpu/GrTextureParams.h",
+ "$_include/gpu/GrSamplerParams.h",
"$_include/gpu/GrTextureProvider.h",
"$_include/gpu/GrTestUtils.h",
"$_include/gpu/GrTypes.h",
class GrContext;
class GrContextThreadSafeProxy;
class GrTexture;
-class GrTextureParams;
+class GrSamplerParams;
class SkBitmap;
class SkData;
class SkImage;
* - it has no intrinsic context, and will use the caller's
* - its internal context is the same
* - it can somehow convert its texture into one that is valid for the provided context.
- *
- * Regarding the GrTextureParams parameter:
- *
- * If the context (the provided one or the generator's intrinsic one) determines that to
- * support the specified usage, it must return a different sized texture it may,
- * so the caller must inspect the texture's width/height and compare them to the generator's
- * getInfo() width/height. For readback usage use GrTextureParams::ClampNoFilter()
*/
GrTexture* generateTexture(GrContext*, const SkIRect* subset = nullptr);
class GrTestTarget;
class GrTextBlobCache;
class GrTextContext;
-class GrTextureParams;
+class GrSamplerParams;
class GrVertexBuffer;
class GrSwizzle;
class SkTraceMemoryDump;
* from the texture size and filter. The texture origin also implies whether a y-reversal should
* be performed.
*/
- GrCoordTransform(const GrTexture* texture, GrTextureParams::FilterMode filter) {
+ GrCoordTransform(const GrTexture* texture, GrSamplerParams::FilterMode filter) {
SkASSERT(texture);
SkDEBUGCODE(fInProcessor = false);
this->reset(texture, filter);
* filter. The texture origin also implies whether a y-reversal should be performed.
*/
GrCoordTransform(const SkMatrix& m, const GrTexture* texture,
- GrTextureParams::FilterMode filter) {
+ GrSamplerParams::FilterMode filter) {
SkDEBUGCODE(fInProcessor = false);
SkASSERT(texture);
this->reset(m, texture, filter);
this->reset(m, precision);
}
- void reset(const GrTexture* texture, GrTextureParams::FilterMode filter) {
+ void reset(const GrTexture* texture, GrSamplerParams::FilterMode filter) {
SkASSERT(!fInProcessor);
SkASSERT(texture);
this->reset(MakeDivByTextureWHMatrix(texture), texture, filter);
}
- void reset(const SkMatrix&, const GrTexture*, GrTextureParams::FilterMode filter);
+ void reset(const SkMatrix&, const GrTexture*, GrSamplerParams::FilterMode filter);
void reset(const SkMatrix& m, GrSLPrecision precision = kDefault_GrSLPrecision);
GrCoordTransform& operator= (const GrCoordTransform& that) {
void addColorTextureProcessor(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix&);
void addCoverageTextureProcessor(GrTexture*, const SkMatrix&);
void addColorTextureProcessor(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix&,
- const GrTextureParams&);
- void addCoverageTextureProcessor(GrTexture*, const SkMatrix&, const GrTextureParams&);
+ const GrSamplerParams&);
+ void addCoverageTextureProcessor(GrTexture*, const SkMatrix&, const GrSamplerParams&);
int numColorFragmentProcessors() const { return fColorFragmentProcessors.count(); }
int numCoverageFragmentProcessors() const { return fCoverageFragmentProcessors.count(); }
/**
* Used to represent a texture that is required by a GrProcessor. It holds a GrTexture along with
- * an associated GrTextureParams
+ * an associated GrSamplerParams
*/
class GrProcessor::TextureSampler : public SkNoncopyable {
public:
*/
TextureSampler();
- TextureSampler(GrTexture*, const GrTextureParams&);
+ TextureSampler(GrTexture*, const GrSamplerParams&);
explicit TextureSampler(GrTexture*,
- GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
+ GrSamplerParams::FilterMode = GrSamplerParams::kNone_FilterMode,
SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode,
GrShaderFlags visibility = kFragment_GrShaderFlag);
- void reset(GrTexture*, const GrTextureParams&,
+ void reset(GrTexture*, const GrSamplerParams&,
GrShaderFlags visibility = kFragment_GrShaderFlag);
void reset(GrTexture*,
- GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
+ GrSamplerParams::FilterMode = GrSamplerParams::kNone_FilterMode,
SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode,
GrShaderFlags visibility = kFragment_GrShaderFlag);
GrTexture* texture() const { return fTexture.get(); }
GrShaderFlags visibility() const { return fVisibility; }
- const GrTextureParams& params() const { return fParams; }
+ const GrSamplerParams& params() const { return fParams; }
/**
* For internal use by GrProcessor.
typedef GrTGpuResourceRef<GrTexture> ProgramTexture;
ProgramTexture fTexture;
- GrTextureParams fParams;
+ GrSamplerParams fParams;
GrShaderFlags fVisibility;
typedef SkNoncopyable INHERITED;
* found in the LICENSE file.
*/
-#ifndef GrTextureParams_DEFINED
-#define GrTextureParams_DEFINED
+#ifndef GrSamplerParams_DEFINED
+#define GrSamplerParams_DEFINED
#include "GrTypes.h"
#include "SkShader.h"
/**
* Represents the filtering and tile modes used to access a texture.
*/
-class GrTextureParams {
+class GrSamplerParams {
public:
- static const GrTextureParams& ClampNoFilter() {
- static const GrTextureParams gParams;
+ static const GrSamplerParams& ClampNoFilter() {
+ static const GrSamplerParams gParams;
return gParams;
}
- static const GrTextureParams& ClampBilerp() {
- static const GrTextureParams gParams(SkShader::kClamp_TileMode, kBilerp_FilterMode);
+ static const GrSamplerParams& ClampBilerp() {
+ static const GrSamplerParams gParams(SkShader::kClamp_TileMode, kBilerp_FilterMode);
return gParams;
}
- GrTextureParams() {
+ GrSamplerParams() {
this->reset();
}
kMipMap_FilterMode
};
- GrTextureParams(SkShader::TileMode tileXAndY, FilterMode filterMode) {
+ GrSamplerParams(SkShader::TileMode tileXAndY, FilterMode filterMode) {
this->reset(tileXAndY, filterMode);
}
- GrTextureParams(const SkShader::TileMode tileModes[2], FilterMode filterMode) {
+ GrSamplerParams(const SkShader::TileMode tileModes[2], FilterMode filterMode) {
this->reset(tileModes, filterMode);
}
- GrTextureParams(const GrTextureParams& params) {
+ GrSamplerParams(const GrSamplerParams& params) {
*this = params;
}
- GrTextureParams& operator= (const GrTextureParams& params) {
+ GrSamplerParams& operator= (const GrSamplerParams& params) {
fTileModes[0] = params.fTileModes[0];
fTileModes[1] = params.fTileModes[1];
fFilterMode = params.fFilterMode;
FilterMode filterMode() const { return fFilterMode; }
- bool operator== (const GrTextureParams& other) const {
+ bool operator== (const GrSamplerParams& other) const {
return fTileModes[0] == other.fTileModes[0] &&
fTileModes[1] == other.fTileModes[1] &&
fFilterMode == other.fFilterMode;
}
- bool operator!= (const GrTextureParams& other) const { return !(*this == other); }
+ bool operator!= (const GrSamplerParams& other) const { return !(*this == other); }
private:
SkShader::TileMode fTileModes[2];
#define GrTexture_DEFINED
#include "GrSurface.h"
-#include "GrTextureParams.h"
+#include "GrSamplerParams.h"
#include "SkPoint.h"
#include "SkRefCnt.h"
protected:
GrTexture(GrGpu*, const GrSurfaceDesc&, GrSLType samplerType,
- GrTextureParams::FilterMode highestFilterMode, bool wasMipMapDataProvided);
+ GrSamplerParams::FilterMode highestFilterMode, bool wasMipMapDataProvided);
void validateDesc() const;
};
GrSLType fSamplerType;
- GrTextureParams::FilterMode fHighestFilterMode;
+ GrSamplerParams::FilterMode fHighestFilterMode;
MipMapsStatus fMipMapsStatus;
int fMaxMipMapLevel;
SkDestinationSurfaceColorMode fMipColorMode;
#define SkGr_DEFINED
#include "GrColor.h"
-#include "GrTextureParams.h"
+#include "GrSamplerParams.h"
#include "SkColor.h"
#include "SkColorPriv.h"
#include "SkFilterQuality.h"
}
////////////////////////////////////////////////////////////////////////////////
-/** Returns a texture representing the bitmap that is compatible with the GrTextureParams. The
+/** Returns a texture representing the bitmap that is compatible with the GrSamplerParams. 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 GrSamplerParams&,
SkDestinationSurfaceColorMode);
-sk_sp<GrTexture> GrMakeCachedBitmapTexture(GrContext*, const SkBitmap&, const GrTextureParams&,
+sk_sp<GrTexture> GrMakeCachedBitmapTexture(GrContext*, const SkBitmap&, const GrSamplerParams&,
SkDestinationSurfaceColorMode);
// TODO: Move SkImageInfo2GrPixelConfig to SkGrPriv.h (requires cleanup to SkWindow its subclasses).
return SkImageInfo2GrPixelConfig(info.colorType(), info.alphaType(), info.colorSpace(), caps);
}
-GrTextureParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality paintFilterQuality,
+GrSamplerParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality paintFilterQuality,
const SkMatrix& viewM,
const SkMatrix& localM,
bool* doBicubic);
matrix,
domain,
GrTextureDomain::kDecal_Mode,
- GrTextureParams::kBilerp_FilterMode));
+ GrSamplerParams::kBilerp_FilterMode));
paint.addColorFragmentProcessor(std::move(fp));
srcRect.offset(-srcOffset);
srcOffset.set(0, 0);
} else {
- GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
+ GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kBilerp_FilterMode);
paint.addColorTextureProcessor(srcTexture.get(), nullptr, matrix, params);
}
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
GrPaint paint;
paint.setGammaCorrect(dstRenderTargetContext->isGammaCorrect());
// FIXME: this should be mitchell, not bilinear.
- GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
+ GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kBilerp_FilterMode);
sk_sp<GrTexture> tex(srcRenderTargetContext->asTexture());
paint.addColorTextureProcessor(tex.get(), nullptr, matrix, params);
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
#include "GrGpuResourcePriv.h"
#include "GrImageIDTextureAdjuster.h"
#include "GrResourceKey.h"
-#include "GrTextureParams.h"
+#include "GrSamplerParams.h"
#include "GrYUVProvider.h"
#include "SkGr.h"
#include "SkGrPriv.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
-GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParams& params,
+GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrSamplerParams& params,
SkDestinationSurfaceColorMode colorMode,
const SkImage* client, SkImage::CachingHint chint) {
if (!ctx) {
#else
-GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParams&,
+GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrSamplerParams&,
SkDestinationSurfaceColorMode colorMode,
const SkImage* client, SkImage::CachingHint) {
return nullptr;
#include "SkTemplates.h"
class GrContext;
-class GrTextureParams;
+class GrSamplerParams;
class GrUniqueKey;
class SkBitmap;
class SkImage;
*
* The caller is responsible for calling texture->unref() when they are done.
*/
- GrTexture* lockAsTexture(GrContext*, const GrTextureParams&,
+ GrTexture* lockAsTexture(GrContext*, const GrSamplerParams&,
SkDestinationSurfaceColorMode colorMode, const SkImage* client,
SkImage::CachingHint = SkImage::kAllow_CachingHint);
#if SK_SUPPORT_GPU
#include "GrCoordTransform.h"
#include "GrInvariantOutput.h"
-#include "GrTextureParams.h"
+#include "GrSamplerParams.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "SkGr.h"
// gets deleted when the ShadowFP is destroyed, and frees the GrTexture*
fTexture[fNumNonAmbLights] = sk_sp<GrTexture>(shadowMap->asTextureRef(context,
- GrTextureParams::ClampNoFilter(),
+ GrSamplerParams::ClampNoFilter(),
SkDestinationSurfaceColorMode::kLegacy));
fDepthMapSampler[fNumNonAmbLights].reset(fTexture[fNumNonAmbLights].get());
this->addTextureSampler(&fDepthMapSampler[fNumNonAmbLights]);
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrTexture.h"
-#include "GrTextureParams.h"
+#include "GrSamplerParams.h"
#include "GrTextureProxy.h"
#include "SkGr.h"
#include "SkGrPriv.h"
}
sk_sp<GrTexture> resultTex(
- GrRefCachedBitmapTexture(context, bmp, GrTextureParams::ClampNoFilter(),
+ GrRefCachedBitmapTexture(context, bmp, GrSamplerParams::ClampNoFilter(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
if (!resultTex) {
return nullptr;
sk_sp<GrTexture> onAsTextureRef(GrContext* context) const override {
if (context) {
return sk_ref_sp(
- GrRefCachedBitmapTexture(context, fBitmap, GrTextureParams::ClampNoFilter(),
+ GrRefCachedBitmapTexture(context, fBitmap, GrSamplerParams::ClampNoFilter(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
}
sk_sp<GrTexture> tex(sk_ref_sp(GrRefCachedBitmapTexture(
context,
fBitmap,
- GrTextureParams::ClampNoFilter(),
+ GrSamplerParams::ClampNoFilter(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware)));
sk_sp<GrSurfaceProxy> sProxy = GrSurfaceProxy::MakeWrapped(std::move(tex));
return sk_ref_sp(sProxy->asTextureProxy());
: fInnerThreshold(innerThreshold)
, fOuterThreshold(outerThreshold)
, fImageCoordTransform(GrCoordTransform::MakeDivByTextureWHMatrix(texture), texture,
- GrTextureParams::kNone_FilterMode)
+ GrSamplerParams::kNone_FilterMode)
, fImageTextureSampler(texture)
, fColorSpaceXform(std::move(colorSpaceXform))
, fMaskCoordTransform(make_div_and_translate_matrix(maskTexture, -bounds.x(), -bounds.y()),
maskTexture,
- GrTextureParams::kNone_FilterMode)
+ GrSamplerParams::kNone_FilterMode)
, fMaskTextureSampler(maskTexture) {
this->initClassID<GrAlphaThresholdFragmentProcessor>();
this->addCoordTransform(&fImageCoordTransform);
: fCircle(circle)
, fSolidRadius(solidRadius)
, fTextureRadius(textureRadius)
- , fBlurProfileSampler(blurProfile, GrTextureParams::kBilerp_FilterMode) {
+ , fBlurProfileSampler(blurProfile, GrSamplerParams::kBilerp_FilterMode) {
this->initClassID<GrCircleBlurFragmentProcessor>();
this->addTextureSampler(&fBlurProfileSampler);
this->setWillReadFragmentPosition();
///////////////////////////////////////////////////////////////////////////////
GrColorCubeEffect::GrColorCubeEffect(GrTexture* colorCube)
- : fColorCubeSampler(colorCube, GrTextureParams::kBilerp_FilterMode) {
+ : fColorCubeSampler(colorCube, GrSamplerParams::kBilerp_FilterMode) {
this->initClassID<GrColorCubeEffect>();
this->addTextureSampler(&fColorCubeSampler);
}
const SkMatrix& offsetMatrix,
GrTexture* color,
const SkISize& colorDimensions)
- : fDisplacementTransform(offsetMatrix, displacement, GrTextureParams::kNone_FilterMode)
+ : fDisplacementTransform(offsetMatrix, displacement, GrSamplerParams::kNone_FilterMode)
, fDisplacementSampler(displacement)
- , fColorTransform(color, GrTextureParams::kNone_FilterMode)
+ , fColorTransform(color, GrSamplerParams::kNone_FilterMode)
, fDomain(GrTextureDomain::MakeTexelDomain(color, SkIRect::MakeSize(colorDimensions)),
GrTextureDomain::kDecal_Mode)
, fColorSampler(color)
new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix);
sk_sp<GrTexture> permutationsTexture(
GrRefCachedBitmapTexture(args.fContext, paintingData->getPermutationsBitmap(),
- GrTextureParams::ClampNoFilter(), args.fColorMode));
+ GrSamplerParams::ClampNoFilter(), args.fColorMode));
sk_sp<GrTexture> noiseTexture(
GrRefCachedBitmapTexture(args.fContext, paintingData->getNoiseBitmap(),
- GrTextureParams::ClampNoFilter(), args.fColorMode));
+ GrSamplerParams::ClampNoFilter(), args.fColorMode));
SkMatrix m = *args.fViewMatrix;
m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1);
if (-1 == row) {
atlas = nullptr;
texture.reset(
- GrRefCachedBitmapTexture(context, bitmap, GrTextureParams::ClampNoFilter(),
+ GrRefCachedBitmapTexture(context, bitmap, GrSamplerParams::ClampNoFilter(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
} else {
texture.reset(SkRef(atlas->getTexture()));
GrTextureDomain::MakeTexelDomain(backgroundTex.get(),
background->subset()),
GrTextureDomain::kDecal_Mode,
- GrTextureParams::kNone_FilterMode);
+ GrSamplerParams::kNone_FilterMode);
} else {
bgFP = GrConstColorProcessor::Make(GrColor4f::TransparentBlack(),
GrConstColorProcessor::kIgnore_InputMode);
GrTextureDomain::MakeTexelDomain(foregroundTex.get(),
foreground->subset()),
GrTextureDomain::kDecal_Mode,
- GrTextureParams::kNone_FilterMode);
+ GrSamplerParams::kNone_FilterMode);
paint.addColorFragmentProcessor(std::move(foregroundFP));
// We always filter the gradient table. Each table is one row of a texture, always
// y-clamp.
- GrTextureParams params;
- params.setFilterMode(GrTextureParams::kBilerp_FilterMode);
+ GrSamplerParams params;
+ params.setFilterMode(GrSamplerParams::kBilerp_FilterMode);
params.setTileModeX(args.fTileMode);
fRow = fAtlas->lockRow(bitmap);
#include "GrGpu.h"
void GrCoordTransform::reset(const SkMatrix& m, const GrTexture* texture,
- GrTextureParams::FilterMode filter) {
+ GrSamplerParams::FilterMode filter) {
SkASSERT(texture);
SkASSERT(!fInProcessor);
// coords between 0 to 1 when bi- or tri-lerping and 1 value when nearest filtering. Note that
// this still might not be enough when drawing with repeat or mirror-repeat modes but that case
// can be arbitrarily bad.
- int subPixelThresh = filter > GrTextureParams::kNone_FilterMode ? 4 : 1;
+ int subPixelThresh = filter > GrSamplerParams::kNone_FilterMode ? 4 : 1;
fPrecision = kDefault_GrSLPrecision;
if (texture->getContext()) {
const GrShaderCaps* caps = texture->getContext()->caps()->shaderCaps();
////////////////////////////////////////////////////////////////////////////////
-bool GrGpu::makeCopyForTextureParams(int width, int height, const GrTextureParams& textureParams,
+bool GrGpu::makeCopyForTextureParams(int width, int height, const GrSamplerParams& textureParams,
GrTextureProducer::CopyParams* copyParams) const {
const GrCaps& caps = *this->caps();
if (textureParams.isTiled() && !caps.npotTextureTileSupport() &&
copyParams->fWidth = GrNextPow2(width);
copyParams->fHeight = GrNextPow2(height);
switch (textureParams.filterMode()) {
- case GrTextureParams::kNone_FilterMode:
- copyParams->fFilter = GrTextureParams::kNone_FilterMode;
+ case GrSamplerParams::kNone_FilterMode:
+ copyParams->fFilter = GrSamplerParams::kNone_FilterMode;
break;
- case GrTextureParams::kBilerp_FilterMode:
- case GrTextureParams::kMipMap_FilterMode:
+ case GrSamplerParams::kBilerp_FilterMode:
+ case GrSamplerParams::kMipMap_FilterMode:
// We are only ever scaling up so no reason to ever indicate kMipMap.
- copyParams->fFilter = GrTextureParams::kBilerp_FilterMode;
+ copyParams->fFilter = GrSamplerParams::kBilerp_FilterMode;
break;
}
return true;
virtual void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) = 0;
// Determines whether a texture will need to be rescaled in order to be used with the
- // GrTextureParams. This variation is called when the caller will create a new texture using the
+ // GrSamplerParams. This variation is called when the caller will create a new texture using the
// texture provider from a non-texture src (cpu-backed image, ...).
- bool makeCopyForTextureParams(int width, int height, const GrTextureParams&,
+ bool makeCopyForTextureParams(int width, int height, const GrSamplerParams&,
GrTextureProducer::CopyParams*) const;
// Like the above but this variation should be called when the caller is not creating the
// original texture but rather was handed the original texture. It adds additional checks
// relevant to original textures that were created external to Skia via
// GrTextureProvider::wrap methods.
- bool makeCopyForTextureParams(GrTexture* texture, const GrTextureParams& params,
+ bool makeCopyForTextureParams(GrTexture* texture, const GrSamplerParams& params,
GrTextureProducer::CopyParams* copyParams) const {
if (this->makeCopyForTextureParams(texture->width(), texture->height(), params,
copyParams)) {
virtual gr_instanced::InstancedRendering* onCreateInstancedRendering() = 0;
- virtual bool onMakeCopyForTextureParams(GrTexture* texture, const GrTextureParams&,
+ virtual bool onMakeCopyForTextureParams(GrTexture* texture, const GrSamplerParams&,
GrTextureProducer::CopyParams*) const { return false; }
virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight,
void GrPaint::addColorTextureProcessor(GrTexture* texture,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& matrix,
- const GrTextureParams& params) {
+ const GrSamplerParams& params) {
this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(texture,
std::move(colorSpaceXform),
matrix, params));
void GrPaint::addCoverageTextureProcessor(GrTexture* texture,
const SkMatrix& matrix,
- const GrTextureParams& params) {
+ const GrSamplerParams& params) {
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(texture, nullptr, matrix,
params));
}
void addColorTextureProcessor(GrTexture* texture,
const SkMatrix& matrix,
- const GrTextureParams& params) {
+ const GrSamplerParams& params) {
this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(texture, nullptr, matrix,
params));
}
void addCoverageTextureProcessor(GrTexture* texture,
const SkMatrix& matrix,
- const GrTextureParams& params) {
+ const GrSamplerParams& params) {
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(texture, nullptr, matrix,
params));
}
#include "GrGeometryProcessor.h"
#include "GrInvariantOutput.h"
#include "GrMemoryPool.h"
-#include "GrTextureParams.h"
+#include "GrSamplerParams.h"
#include "GrTexturePriv.h"
#include "GrXferProcessor.h"
#include "SkSpinlock.h"
GrProcessor::TextureSampler::TextureSampler() {}
-GrProcessor::TextureSampler::TextureSampler(GrTexture* texture, const GrTextureParams& params) {
+GrProcessor::TextureSampler::TextureSampler(GrTexture* texture, const GrSamplerParams& params) {
this->reset(texture, params);
}
GrProcessor::TextureSampler::TextureSampler(GrTexture* texture,
- GrTextureParams::FilterMode filterMode,
+ GrSamplerParams::FilterMode filterMode,
SkShader::TileMode tileXAndY,
GrShaderFlags visibility) {
this->reset(texture, filterMode, tileXAndY, visibility);
}
void GrProcessor::TextureSampler::reset(GrTexture* texture,
- const GrTextureParams& params,
+ const GrSamplerParams& params,
GrShaderFlags visibility) {
SkASSERT(texture);
fTexture.set(SkRef(texture), kRead_GrIOType);
}
void GrProcessor::TextureSampler::reset(GrTexture* texture,
- GrTextureParams::FilterMode filterMode,
+ GrSamplerParams::FilterMode filterMode,
SkShader::TileMode tileXAndY,
GrShaderFlags visibility) {
SkASSERT(texture);
GrSimpleTextureEffect::Make(texture,
nullptr,
maskMatrix,
- GrTextureParams::kNone_FilterMode));
+ GrSamplerParams::kNone_FilterMode));
sk_sp<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(),
SkMatrix::I(),
//////////////////////////////////////////////////////////////////////////////
GrTexture::GrTexture(GrGpu* gpu, const GrSurfaceDesc& desc, GrSLType samplerType,
- GrTextureParams::FilterMode highestFilterMode, bool wasMipMapDataProvided)
+ GrSamplerParams::FilterMode highestFilterMode, bool wasMipMapDataProvided)
: INHERITED(gpu, desc)
, fSamplerType(samplerType)
, fHighestFilterMode(highestFilterMode)
#include "GrGpuResourcePriv.h"
#include "GrResourceKey.h"
#include "GrTexture.h"
-#include "GrTextureParams.h"
+#include "GrSamplerParams.h"
#include "GrTextureProvider.h"
#include "SkCanvas.h"
#include "SkGr.h"
sy = 1.f / inputTexture->height();
}
- if (copyParams.fFilter != GrTextureParams::kNone_FilterMode && subset &&
+ if (copyParams.fFilter != GrSamplerParams::kNone_FilterMode && subset &&
(subset->width() != copyParams.fWidth || subset->height() != copyParams.fHeight)) {
SkRect domain;
domain.fLeft = (subset->fLeft + 0.5f) * sx;
domain.fBottom = (subset->fBottom - 0.5f) * sy;
// This would cause us to read values from outside the subset. Surely, the caller knows
// better!
- SkASSERT(copyParams.fFilter != GrTextureParams::kMipMap_FilterMode);
+ SkASSERT(copyParams.fFilter != GrSamplerParams::kMipMap_FilterMode);
paint.addColorFragmentProcessor(
GrTextureDomainEffect::Make(inputTexture, nullptr, SkMatrix::I(), domain,
GrTextureDomain::kClamp_Mode,
copyParams.fFilter));
} else {
- GrTextureParams params(SkShader::kClamp_TileMode, copyParams.fFilter);
+ GrSamplerParams params(SkShader::kClamp_TileMode, copyParams.fFilter);
paint.addColorTextureProcessor(inputTexture, nullptr, SkMatrix::I(), params);
}
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
return copy;
}
-GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrTextureParams& params,
+GrTexture* GrTextureAdjuster::refTextureSafeForParams(const GrSamplerParams& params,
SkDestinationSurfaceColorMode colorMode,
SkIPoint* outOffset) {
GrTexture* texture = this->originalTexture();
return nullptr;
}
- if (contentArea && GrTextureParams::kMipMap_FilterMode == params.filterMode()) {
+ if (contentArea && GrSamplerParams::kMipMap_FilterMode == params.filterMode()) {
// If we generate a MIP chain for texture it will read pixel values from outside the content
// area.
copyParams.fWidth = contentArea->width();
copyParams.fHeight = contentArea->height();
- copyParams.fFilter = GrTextureParams::kBilerp_FilterMode;
+ copyParams.fFilter = GrSamplerParams::kBilerp_FilterMode;
} else if (!context->getGpu()->makeCopyForTextureParams(texture, params, ©Params)) {
if (outOffset) {
if (contentArea) {
bool coordsLimitedToConstraintRect,
int texW, int texH,
const SkIRect* textureContentArea,
- const GrTextureParams::FilterMode* filterModeOrNullForBicubic,
+ const GrSamplerParams::FilterMode* filterModeOrNullForBicubic,
SkRect* domainRect) {
SkASSERT(SkRect::MakeIWH(texW, texH).contains(constraintRect));
SkScalar filterHalfWidth = 0.f;
if (filterModeOrNullForBicubic) {
switch (*filterModeOrNullForBicubic) {
- case GrTextureParams::kNone_FilterMode:
+ case GrSamplerParams::kNone_FilterMode:
if (coordsLimitedToConstraintRect) {
return kNoDomain_DomainMode;
} else {
filterHalfWidth = 0.f;
}
break;
- case GrTextureParams::kBilerp_FilterMode:
+ case GrSamplerParams::kBilerp_FilterMode:
filterHalfWidth = .5f;
break;
- case GrTextureParams::kMipMap_FilterMode:
+ case GrSamplerParams::kMipMap_FilterMode:
if (restrictFilterToRect || textureContentArea) {
// No domain can save us here.
return kTightCopy_DomainMode;
const SkMatrix& textureMatrix,
DomainMode domainMode,
const SkRect& domain,
- const GrTextureParams::FilterMode* filterOrNullForBicubic) {
+ const GrSamplerParams::FilterMode* filterOrNullForBicubic) {
SkASSERT(kTightCopy_DomainMode != domainMode);
if (filterOrNullForBicubic) {
if (kDomain_DomainMode == domainMode) {
domain, GrTextureDomain::kClamp_Mode,
*filterOrNullForBicubic);
} else {
- GrTextureParams params(SkShader::kClamp_TileMode, *filterOrNullForBicubic);
+ GrSamplerParams params(SkShader::kClamp_TileMode, *filterOrNullForBicubic);
return GrSimpleTextureEffect::Make(texture, std::move(colorSpaceXform), textureMatrix,
params);
}
const SkRect& origConstraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrTextureParams::FilterMode* filterOrNullForBicubic,
+ const GrSamplerParams::FilterMode* filterOrNullForBicubic,
SkColorSpace* dstColorSpace,
SkDestinationSurfaceColorMode colorMode) {
}
SkRect domain;
- GrTextureParams params;
+ GrSamplerParams params;
if (filterOrNullForBicubic) {
params.setFilterMode(*filterOrNullForBicubic);
}
// We only expect MIP maps to require a tight copy.
SkASSERT(filterOrNullForBicubic &&
- GrTextureParams::kMipMap_FilterMode == *filterOrNullForBicubic);
- static const GrTextureParams::FilterMode kBilerp = GrTextureParams::kBilerp_FilterMode;
+ GrSamplerParams::kMipMap_FilterMode == *filterOrNullForBicubic);
+ static const GrSamplerParams::FilterMode kBilerp = GrSamplerParams::kBilerp_FilterMode;
domainMode =
determine_domain_mode(*constraintRect, filterConstraint, coordsLimitedToConstraintRect,
texture->width(), texture->height(),
//////////////////////////////////////////////////////////////////////////////
-GrTexture* GrTextureMaker::refTextureForParams(const GrTextureParams& params,
+GrTexture* GrTextureMaker::refTextureForParams(const GrSamplerParams& params,
SkDestinationSurfaceColorMode colorMode) {
CopyParams copyParams;
- bool willBeMipped = params.filterMode() == GrTextureParams::kMipMap_FilterMode;
+ bool willBeMipped = params.filterMode() == GrSamplerParams::kMipMap_FilterMode;
if (!fContext->caps()->mipMapSupport()) {
willBeMipped = false;
const SkRect& constraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrTextureParams::FilterMode* filterOrNullForBicubic,
+ const GrSamplerParams::FilterMode* filterOrNullForBicubic,
SkColorSpace* dstColorSpace,
SkDestinationSurfaceColorMode colorMode) {
- const GrTextureParams::FilterMode* fmForDetermineDomain = filterOrNullForBicubic;
- if (filterOrNullForBicubic && GrTextureParams::kMipMap_FilterMode == *filterOrNullForBicubic &&
+ const GrSamplerParams::FilterMode* fmForDetermineDomain = filterOrNullForBicubic;
+ if (filterOrNullForBicubic && GrSamplerParams::kMipMap_FilterMode == *filterOrNullForBicubic &&
kYes_FilterConstraint == filterConstraint) {
// TODo: Here we should force a copy restricted to the constraintRect since MIP maps will
// read outside the constraint rect. However, as in the adjuster case, we aren't currently
// doing that.
// We instead we compute the domain as though were bilerping which is only correct if we
// only sample level 0.
- static const GrTextureParams::FilterMode kBilerp = GrTextureParams::kBilerp_FilterMode;
+ static const GrSamplerParams::FilterMode kBilerp = GrSamplerParams::kBilerp_FilterMode;
fmForDetermineDomain = &kBilerp;
}
- GrTextureParams params;
+ GrSamplerParams params;
if (filterOrNullForBicubic) {
params.reset(SkShader::kClamp_TileMode, *filterOrNullForBicubic);
} else {
// Bicubic doesn't use filtering for it's texture accesses.
- params.reset(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode);
+ params.reset(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode);
}
sk_sp<GrTexture> texture(this->refTextureForParams(params, colorMode));
if (!texture) {
#ifndef GrTextureMaker_DEFINED
#define GrTextureMaker_DEFINED
-#include "GrTextureParams.h"
+#include "GrSamplerParams.h"
#include "GrResourceKey.h"
#include "GrTexture.h"
#include "SkTLazy.h"
class GrContext;
-class GrTextureParams;
+class GrSamplerParams;
class GrUniqueKey;
class SkBitmap;
/**
* Different GPUs and API extensions have different requirements with respect to what texture
* sampling parameters may be used with textures of various types. This class facilitates making
- * texture compatible with a given GrTextureParams. There are two immediate subclasses defined
+ * texture compatible with a given GrSamplerParams. There are two immediate subclasses defined
* below. One is a base class for sources that are inherently texture-backed (e.g. a texture-backed
* SkImage). It supports subsetting the original texture. The other is for use cases where the
* source can generate a texture that represents some content (e.g. cpu pixels, SkPicture, ...).
class GrTextureProducer : public SkNoncopyable {
public:
struct CopyParams {
- GrTextureParams::FilterMode fFilter;
+ GrSamplerParams::FilterMode fFilter;
int fWidth;
int fHeight;
};
const SkRect& constraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrTextureParams::FilterMode* filterOrNullForBicubic,
+ const GrSamplerParams::FilterMode* filterOrNullForBicubic,
SkColorSpace* dstColorSpace,
SkDestinationSurfaceColorMode) = 0;
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&, SkDestinationSurfaceColorMode,
+ GrTexture* refTextureSafeForParams(const GrSamplerParams&, SkDestinationSurfaceColorMode,
SkIPoint* outOffset);
sk_sp<GrFragmentProcessor> createFragmentProcessor(
const SkRect& constraintRect,
FilterConstraint,
bool coordsLimitedToConstraintRect,
- const GrTextureParams::FilterMode* filterOrNullForBicubic,
+ const GrSamplerParams::FilterMode* filterOrNullForBicubic,
SkColorSpace* dstColorSpace,
SkDestinationSurfaceColorMode) override;
/** 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&, SkDestinationSurfaceColorMode);
+ GrTexture* refTextureForParams(const GrSamplerParams&, SkDestinationSurfaceColorMode);
sk_sp<GrFragmentProcessor> createFragmentProcessor(
const SkMatrix& textureMatrix,
const SkRect& constraintRect,
FilterConstraint filterConstraint,
bool coordsLimitedToConstraintRect,
- const GrTextureParams::FilterMode* filterOrNullForBicubic,
+ const GrSamplerParams::FilterMode* filterOrNullForBicubic,
SkColorSpace* dstColorSpace,
SkDestinationSurfaceColorMode) override;
GrSLType samplerType() const { return fTexture->fSamplerType; }
/** The filter used is clamped to this value in GrProcessor::TextureSampler. */
- GrTextureParams::FilterMode highestFilterMode() const { return fTexture->fHighestFilterMode; }
+ GrSamplerParams::FilterMode highestFilterMode() const { return fTexture->fHighestFilterMode; }
void setMipColorMode(SkDestinationSurfaceColorMode colorMode) const {
fTexture->fMipColorMode = colorMode;
SkScalar xScale = SkIntToScalar(src->width()) / dstW / src->width();
SkScalar yScale = SkIntToScalar(src->height()) / dstH / src->height();
- GrTextureParams::FilterMode filter;
+ GrSamplerParams::FilterMode filter;
if (dstW == src->width() && dstW == src->height()) {
- filter = GrTextureParams::kNone_FilterMode;
+ filter = GrSamplerParams::kNone_FilterMode;
} else {
- filter = GrTextureParams::kBilerp_FilterMode;
+ filter = GrSamplerParams::kBilerp_FilterMode;
}
sk_sp<GrFragmentProcessor> fp(
bool SkGpuDevice::shouldTileImageID(uint32_t imageID, const SkIRect& imageRect,
const SkMatrix& viewMatrix,
const SkMatrix& srcToDstRect,
- const GrTextureParams& params,
+ const GrSamplerParams& params,
const SkRect* srcRectPtr,
int maxTileSize,
int* tileSize,
return false;
}
- GrTextureParams params;
+ GrSamplerParams params;
bool doBicubic;
- GrTextureParams::FilterMode textureFilterMode =
+ GrSamplerParams::FilterMode textureFilterMode =
GrSkFilterQualityToGrFilterMode(quality, viewMatrix, srcToDstRect, &doBicubic);
int tileFilterPad;
if (doBicubic) {
tileFilterPad = GrBicubicEffect::kFilterTexelPad;
- } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) {
+ } else if (GrSamplerParams::kNone_FilterMode == textureFilterMode) {
tileFilterPad = 0;
} else {
tileFilterPad = 1;
int tileSize;
SkIRect clippedSrcRect;
- GrTextureParams params;
+ GrSamplerParams params;
bool doBicubic;
- GrTextureParams::FilterMode textureFilterMode =
+ GrSamplerParams::FilterMode textureFilterMode =
GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), viewMatrix, SkMatrix::I(),
&doBicubic);
if (doBicubic) {
tileFilterPad = GrBicubicEffect::kFilterTexelPad;
- } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) {
+ } else if (GrSamplerParams::kNone_FilterMode == textureFilterMode) {
tileFilterPad = 0;
} else {
tileFilterPad = 1;
const SkMatrix& dstMatrix,
const SkRect& srcRect,
const SkIRect& clippedSrcIRect,
- const GrTextureParams& params,
+ const GrSamplerParams& params,
const SkPaint& origPaint,
SkCanvas::SrcRectConstraint constraint,
int tileSize,
SkRect rectToDraw = SkRect::MakeXYWH(offset.fX, offset.fY,
tileR.width(), tileR.height());
dstMatrix.mapRect(&rectToDraw);
- if (GrTextureParams::kNone_FilterMode != params.filterMode() || bicubic) {
+ if (GrSamplerParams::kNone_FilterMode != params.filterMode() || bicubic) {
SkIRect iClampRect;
if (SkCanvas::kFast_SrcRectConstraint == constraint) {
if (bitmap.extractSubset(&tmpB, iTileR)) {
// now offset it to make it "local" to our tmp bitmap
tileR.offset(-offset.fX, -offset.fY);
- GrTextureParams paramsTemp = params;
+ GrSamplerParams paramsTemp = params;
// de-optimized this determination
bool needsTextureDomain = true;
this->drawBitmapTile(tmpB,
const SkMatrix& viewMatrix,
const SkRect& dstRect,
const SkRect& srcRect,
- const GrTextureParams& params,
+ const GrSamplerParams& params,
const SkPaint& paint,
SkCanvas::SrcRectConstraint constraint,
bool bicubic,
params.filterMode());
}
} else if (bicubic) {
- SkASSERT(GrTextureParams::kNone_FilterMode == params.filterMode());
+ SkASSERT(GrSamplerParams::kNone_FilterMode == params.filterMode());
SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTileModeY() };
fp = GrBicubicEffect::Make(texture.get(), std::move(colorSpaceXform), texMatrix, tileModes);
} else {
// draw sprite neither filters nor tiles.
texture.reset(
- GrRefCachedBitmapTexture(fContext.get(), bitmap, GrTextureParams::ClampNoFilter(),
+ GrRefCachedBitmapTexture(fContext.get(), bitmap, GrSamplerParams::ClampNoFilter(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
if (!texture) {
return;
int tileSize;
SkIRect clippedSrcRect;
- GrTextureParams params;
+ GrSamplerParams params;
bool doBicubic;
- GrTextureParams::FilterMode textureFilterMode =
+ GrSamplerParams::FilterMode textureFilterMode =
GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), *draw.fMatrix, srcToDstMatrix,
&doBicubic);
if (doBicubic) {
tileFilterPad = GrBicubicEffect::kFilterTexelPad;
- } else if (GrTextureParams::kNone_FilterMode == textureFilterMode) {
+ } else if (GrSamplerParams::kNone_FilterMode == textureFilterMode) {
tileFilterPad = 0;
} else {
tileFilterPad = 1;
}
sk_sp<GrTexture> texture =
- GrMakeCachedBitmapTexture(fContext.get(), bitmap, GrTextureParams::ClampNoFilter(),
+ GrMakeCachedBitmapTexture(fContext.get(), bitmap, GrSamplerParams::ClampNoFilter(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware);
if (!texture) {
return nullptr;
bool useFallback = paint.getMaskFilter() || paint.isAntiAlias() ||
fRenderTargetContext->isUnifiedMultisampled();
bool doBicubic;
- GrTextureParams::FilterMode textureFilterMode =
+ GrSamplerParams::FilterMode textureFilterMode =
GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), *draw.fMatrix, SkMatrix::I(),
&doBicubic);
- if (useFallback || doBicubic || GrTextureParams::kNone_FilterMode != textureFilterMode) {
+ if (useFallback || doBicubic || GrSamplerParams::kNone_FilterMode != textureFilterMode) {
SkLatticeIter iter(producer->width(), producer->height(), center, dst);
SkRect srcR, dstR;
return;
}
- static const GrTextureParams::FilterMode kMode = GrTextureParams::kNone_FilterMode;
+ static const GrSamplerParams::FilterMode kMode = GrSamplerParams::kNone_FilterMode;
sk_sp<GrFragmentProcessor> fp(
producer->createFragmentProcessor(SkMatrix::I(),
SkRect::MakeIWH(producer->width(), producer->height()),
CHECK_SHOULD_DRAW(draw);
- static const GrTextureParams::FilterMode kMode = GrTextureParams::kNone_FilterMode;
+ static const GrSamplerParams::FilterMode kMode = GrSamplerParams::kNone_FilterMode;
sk_sp<GrFragmentProcessor> fp(
producer->createFragmentProcessor(SkMatrix::I(),
SkRect::MakeIWH(producer->width(), producer->height()),
bool shouldTileImageID(uint32_t imageID, const SkIRect& imageRect,
const SkMatrix& viewMatrix,
const SkMatrix& srcToDstRectMatrix,
- const GrTextureParams& params,
+ const GrSamplerParams& params,
const SkRect* srcRectPtr,
int maxTileSize,
int* tileSize,
const SkMatrix& srcToDstMatrix,
const SkRect& srcRect,
const SkIRect& clippedSrcRect,
- const GrTextureParams& params,
+ const GrSamplerParams& params,
const SkPaint& paint,
SkCanvas::SrcRectConstraint,
int tileSize,
const SkMatrix& viewMatrix,
const SkRect& dstRect,
const SkRect& srcRect,
- const GrTextureParams& params,
+ const GrSamplerParams& params,
const SkPaint& paint,
SkCanvas::SrcRectConstraint,
bool bicubic,
bool canUseTextureCoordsAsLocalCoords = !use_shader(producer->isAlphaOnly(), paint) && !mf;
bool doBicubic;
- GrTextureParams::FilterMode fm =
+ GrSamplerParams::FilterMode fm =
GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), viewMatrix, srcToDstMatrix,
&doBicubic);
- const GrTextureParams::FilterMode* filterMode = doBicubic ? nullptr : &fm;
+ const GrSamplerParams::FilterMode* filterMode = doBicubic ? nullptr : &fm;
GrTextureAdjuster::FilterConstraint constraintMode;
if (SkCanvas::kFast_SrcRectConstraint == constraint) {
bool coordsAllInsideSrcRect = !paint.isAntiAlias() && !mf;
// Check for optimization to drop the src rect constraint when on bilerp.
- if (filterMode && GrTextureParams::kBilerp_FilterMode == *filterMode &&
+ if (filterMode && GrSamplerParams::kBilerp_FilterMode == *filterMode &&
GrTextureAdjuster::kYes_FilterConstraint == constraintMode && coordsAllInsideSrcRect) {
SkMatrix combinedMatrix;
combinedMatrix.setConcat(viewMatrix, srcToDstMatrix);
}
GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap,
- const GrTextureParams& params,
+ const GrSamplerParams& params,
SkDestinationSurfaceColorMode colorMode) {
return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params, colorMode);
}
sk_sp<GrTexture> GrMakeCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap,
- const GrTextureParams& params,
+ const GrSamplerParams& params,
SkDestinationSurfaceColorMode colorMode) {
GrTexture* tex = GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params, colorMode);
return sk_sp<GrTexture>(tex);
////////////////////////////////////////////////////////////////////////////////////////////////
-GrTextureParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality paintFilterQuality,
+GrSamplerParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality paintFilterQuality,
const SkMatrix& viewM,
const SkMatrix& localM,
bool* doBicubic) {
*doBicubic = false;
- GrTextureParams::FilterMode textureFilterMode;
+ GrSamplerParams::FilterMode textureFilterMode;
switch (paintFilterQuality) {
case kNone_SkFilterQuality:
- textureFilterMode = GrTextureParams::kNone_FilterMode;
+ textureFilterMode = GrSamplerParams::kNone_FilterMode;
break;
case kLow_SkFilterQuality:
- textureFilterMode = GrTextureParams::kBilerp_FilterMode;
+ textureFilterMode = GrSamplerParams::kBilerp_FilterMode;
break;
case kMedium_SkFilterQuality: {
SkMatrix matrix;
matrix.setConcat(viewM, localM);
if (matrix.getMinScale() < SK_Scalar1) {
- textureFilterMode = GrTextureParams::kMipMap_FilterMode;
+ textureFilterMode = GrSamplerParams::kMipMap_FilterMode;
} else {
// Don't trigger MIP level generation unnecessarily.
- textureFilterMode = GrTextureParams::kBilerp_FilterMode;
+ textureFilterMode = GrSamplerParams::kBilerp_FilterMode;
}
break;
}
}
default:
// Should be unreachable. If not, fall back to mipmaps.
- textureFilterMode = GrTextureParams::kMipMap_FilterMode;
+ textureFilterMode = GrSamplerParams::kMipMap_FilterMode;
break;
}
class GrFragmentProcessor;
class GrPaint;
class GrTexture;
-class GrTextureParams;
class GrUniqueKey;
class SkData;
class SkPaint;
flags |= ctm.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0;
flags |= fGammaCorrect ? kGammaCorrect_DistanceFieldEffectFlag : 0;
- GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBilerp_FilterMode);
+ GrSamplerParams params(SkShader::kRepeat_TileMode, GrSamplerParams::kBilerp_FilterMode);
FlushInfo flushInfo;
flushInfo.fGeometryProcessor =
this->setupDfProcessor(this->viewMatrix(), fFilteredColor, this->color(), texture);
} else {
- GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode);
+ GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode);
flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make(this->color(),
texture,
params,
SkColor filteredColor,
GrColor color,
GrTexture* texture) const {
- GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
+ GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kBilerp_FilterMode);
bool isLCD = this->isLCD();
// set up any flags
uint32_t flags = viewMatrix.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0;
const SkMatrix &matrix,
const SkShader::TileMode tileModes[2])
: INHERITED(texture, nullptr, matrix,
- GrTextureParams(tileModes, GrTextureParams::kNone_FilterMode))
+ GrSamplerParams(tileModes, GrSamplerParams::kNone_FilterMode))
, fDomain(GrTextureDomain::IgnoredDomain())
, fColorSpaceXform(std::move(colorSpaceXform)) {
this->initClassID<GrBicubicEffect>();
const SkMatrix &matrix,
const SkRect& domain)
: INHERITED(texture, nullptr, matrix,
- GrTextureParams(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode))
+ GrSamplerParams(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode))
, fDomain(domain, GrTextureDomain::kClamp_Mode)
, fColorSpaceXform(std::move(colorSpaceXform)) {
this->initClassID<GrBicubicEffect>();
//////////////////////////////////////////////////////////////////////////////
bool GrBicubicEffect::ShouldUseBicubic(const SkMatrix& matrix,
- GrTextureParams::FilterMode* filterMode) {
+ GrSamplerParams::FilterMode* filterMode) {
if (matrix.isIdentity()) {
- *filterMode = GrTextureParams::kNone_FilterMode;
+ *filterMode = GrSamplerParams::kNone_FilterMode;
return false;
}
if (!matrix.getMinMaxScales(scales) || scales[0] < SK_Scalar1) {
// Bicubic doesn't handle arbitrary minimization well, as src texels can be skipped
// entirely,
- *filterMode = GrTextureParams::kMipMap_FilterMode;
+ *filterMode = GrSamplerParams::kMipMap_FilterMode;
return false;
}
// At this point if scales[1] == SK_Scalar1 then the matrix doesn't do any scaling.
if (scales[1] == SK_Scalar1) {
if (matrix.rectStaysRect() && SkScalarIsInt(matrix.getTranslateX()) &&
SkScalarIsInt(matrix.getTranslateY())) {
- *filterMode = GrTextureParams::kNone_FilterMode;
+ *filterMode = GrSamplerParams::kNone_FilterMode;
} else {
// Use bilerp to handle rotation or fractional translation.
- *filterMode = GrTextureParams::kBilerp_FilterMode;
+ *filterMode = GrSamplerParams::kBilerp_FilterMode;
}
return false;
}
// When we use the bicubic filtering effect each sample is read from the texture using
// nearest neighbor sampling.
- *filterMode = GrTextureParams::kNone_FilterMode;
+ *filterMode = GrSamplerParams::kNone_FilterMode;
return true;
}
* kNearest).
*/
static bool ShouldUseBicubic(const SkMatrix& localCoordsToDevice,
- GrTextureParams::FilterMode* filterMode);
+ GrSamplerParams::FilterMode* filterMode);
private:
GrBicubicEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkScalar coefficients[16],
///////////////////////////////////////////////////////////////////////////////
GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture,
- const GrTextureParams& params, GrMaskFormat format,
+ const GrSamplerParams& params, GrMaskFormat format,
const SkMatrix& localMatrix, bool usesLocalCoords)
: fColor(color)
, fLocalMatrix(localMatrix)
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrBitmapTextGeoProc);
sk_sp<GrGeometryProcessor> GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* d) {
- int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
- GrProcessorUnitTest::kAlphaTextureIdx;
+ int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
+ : GrProcessorUnitTest::kAlphaTextureIdx;
static const SkShader::TileMode kTileModes[] = {
SkShader::kClamp_TileMode,
SkShader::kRepeat_TileMode,
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
};
- GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode :
- GrTextureParams::kNone_FilterMode);
+ GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode
+ : GrSamplerParams::kNone_FilterMode);
GrMaskFormat format = kARGB_GrMaskFormat; // init to avoid warning
switch (d->fRandom->nextULessThan(3)) {
/**
* The output color of this effect is a modulation of the input color and a sample from a texture.
- * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input
+ * It allows explicit specification of the filtering and wrap modes (GrSamplerParams). The input
* coords are a custom attribute.
*/
class GrBitmapTextGeoProc : public GrGeometryProcessor {
public:
- static sk_sp<GrGeometryProcessor> Make(GrColor color, GrTexture* tex, const GrTextureParams& p,
+ static sk_sp<GrGeometryProcessor> Make(GrColor color, GrTexture* tex, const GrSamplerParams& p,
GrMaskFormat format, const SkMatrix& localMatrix,
bool usesLocalCoords) {
return sk_sp<GrGeometryProcessor>(
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps) const override;
private:
- GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrTextureParams& params,
+ GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrSamplerParams& params,
GrMaskFormat format, const SkMatrix& localMatrix, bool usesLocalCoords);
GrColor fColor;
GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color,
const SkMatrix& viewMatrix,
GrTexture* texture,
- const GrTextureParams& params,
+ const GrSamplerParams& params,
#ifdef SK_GAMMA_APPLY_TO_A8
float distanceAdjust,
#endif
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
};
- GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode :
- GrTextureParams::kNone_FilterMode);
+ GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode
+ : GrSamplerParams::kNone_FilterMode);
uint32_t flags = 0;
flags |= d->fRandom->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0;
GrColor color,
const SkMatrix& viewMatrix,
GrTexture* texture,
- const GrTextureParams& params,
+ const GrSamplerParams& params,
uint32_t flags,
bool usesLocalCoords)
: fColor(color)
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
};
- GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode
- : GrTextureParams::kNone_FilterMode);
+ GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode
+ : GrSamplerParams::kNone_FilterMode);
uint32_t flags = 0;
flags |= d->fRandom->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0;
GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
GrColor color, const SkMatrix& viewMatrix,
- GrTexture* texture, const GrTextureParams& params,
+ GrTexture* texture, const GrSamplerParams& params,
DistanceAdjust distanceAdjust,
uint32_t flags, bool usesLocalCoords)
: fColor(color)
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
};
- GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode :
- GrTextureParams::kNone_FilterMode);
+ GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode
+ : GrSamplerParams::kNone_FilterMode);
DistanceAdjust wa = { 0.0f, 0.1f, -0.1f };
uint32_t flags = kUseLCD_DistanceFieldEffectFlag;
flags |= d->fRandom->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0;
/**
* The output color of this effect is a modulation of the input color and a sample from a
* distance field texture (using a smoothed step function near 0.5).
- * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input
+ * It allows explicit specification of the filtering and wrap modes (GrSamplerParams). The input
* coords are a custom attribute. Gamma correction is handled via a texture LUT.
*/
class GrDistanceFieldA8TextGeoProc : public GrGeometryProcessor {
public:
#ifdef SK_GAMMA_APPLY_TO_A8
static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix,
- GrTexture* tex, const GrTextureParams& params,
+ GrTexture* tex, const GrSamplerParams& params,
float lum, uint32_t flags, bool usesLocalCoords) {
return sk_sp<GrGeometryProcessor>(
new GrDistanceFieldA8TextGeoProc(color, viewMatrix, tex, params, lum, flags,
}
#else
static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix,
- GrTexture* tex, const GrTextureParams& params,
+ GrTexture* tex, const GrSamplerParams& params,
uint32_t flags, bool usesLocalCoords) {
return sk_sp<GrGeometryProcessor>(
new GrDistanceFieldA8TextGeoProc(color, viewMatrix, tex, params, flags,
private:
GrDistanceFieldA8TextGeoProc(GrColor, const SkMatrix& viewMatrix,
- GrTexture* texture, const GrTextureParams& params,
+ GrTexture* texture, const GrSamplerParams& params,
#ifdef SK_GAMMA_APPLY_TO_A8
float distanceAdjust,
#endif
/**
* The output color of this effect is a modulation of the input color and a sample from a
* distance field texture (using a smoothed step function near 0.5).
-* It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input
+* It allows explicit specification of the filtering and wrap modes (GrSamplerParams). The input
* coords are a custom attribute. No gamma correct blending is applied. Used for paths only.
*/
class GrDistanceFieldPathGeoProc : public GrGeometryProcessor {
public:
static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix,
- GrTexture* tex, const GrTextureParams& params,
+ GrTexture* tex, const GrSamplerParams& params,
uint32_t flags, bool usesLocalCoords) {
return sk_sp<GrGeometryProcessor>(
new GrDistanceFieldPathGeoProc(color, viewMatrix, tex, params, flags, usesLocalCoords));
private:
GrDistanceFieldPathGeoProc(GrColor, const SkMatrix& viewMatrix, GrTexture* texture,
- const GrTextureParams& params, uint32_t flags,
+ const GrSamplerParams& params, uint32_t flags,
bool usesLocalCoords);
GrColor fColor;
/**
* The output color of this effect is a modulation of the input color and samples from a
* distance field texture (using a smoothed step function near 0.5), adjusted for LCD displays.
- * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input
+ * It allows explicit specification of the filtering and wrap modes (GrSamplerParams). The input
* coords are a custom attribute. Gamma correction is handled via a texture LUT.
*/
class GrDistanceFieldLCDTextGeoProc : public GrGeometryProcessor {
};
static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix,
- GrTexture* tex, const GrTextureParams& params,
+ GrTexture* tex, const GrSamplerParams& params,
DistanceAdjust distanceAdjust, uint32_t flags,
bool usesLocalCoords) {
return sk_sp<GrGeometryProcessor>(
private:
GrDistanceFieldLCDTextGeoProc(GrColor, const SkMatrix& viewMatrix,
- GrTexture* texture, const GrTextureParams& params,
+ GrTexture* texture, const GrSamplerParams& params,
DistanceAdjust wa, uint32_t flags,
bool usesLocalCoords);
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
};
- GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode :
- GrTextureParams::kNone_FilterMode);
+ GrSamplerParams params(tileModes, d->fRandom->nextBool() ? GrSamplerParams::kBilerp_FilterMode :
+ GrSamplerParams::kNone_FilterMode);
const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
auto colorSpaceXform = GrTest::TestColorXform(d->fRandom);
/**
* The output color of this effect is a modulation of the input color and a sample from a texture.
- * It allows explicit specification of the filtering and wrap modes (GrTextureParams) and accepts
+ * It allows explicit specification of the filtering and wrap modes (GrSamplerParams) and accepts
* a matrix that is used to compute texture coordinates from local coordinates.
*/
class GrSimpleTextureEffect : public GrSingleTextureEffect {
const SkMatrix& matrix) {
return sk_sp<GrFragmentProcessor>(
new GrSimpleTextureEffect(tex, std::move(colorSpaceXform), matrix,
- GrTextureParams::kNone_FilterMode));
+ GrSamplerParams::kNone_FilterMode));
}
/* clamp mode */
static sk_sp<GrFragmentProcessor> Make(GrTexture* tex,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& matrix,
- GrTextureParams::FilterMode filterMode) {
+ GrSamplerParams::FilterMode filterMode) {
return sk_sp<GrFragmentProcessor>(
new GrSimpleTextureEffect(tex, std::move(colorSpaceXform), matrix, filterMode));
}
static sk_sp<GrFragmentProcessor> Make(GrTexture* tex,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& matrix,
- const GrTextureParams& p) {
+ const GrSamplerParams& p) {
return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(tex, std::move(colorSpaceXform),
matrix, p));
}
GrSimpleTextureEffect(GrTexture* texture,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& matrix,
- GrTextureParams::FilterMode filterMode)
+ GrSamplerParams::FilterMode filterMode)
: GrSingleTextureEffect(texture, std::move(colorSpaceXform), matrix, filterMode) {
this->initClassID<GrSimpleTextureEffect>();
}
GrSimpleTextureEffect(GrTexture* texture,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& matrix,
- const GrTextureParams& params)
+ const GrSamplerParams& params)
: GrSingleTextureEffect(texture, std::move(colorSpaceXform), matrix, params) {
this->initClassID<GrSimpleTextureEffect>();
}
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& m)
- : fCoordTransform(m, texture, GrTextureParams::kNone_FilterMode)
+ : fCoordTransform(m, texture, GrSamplerParams::kNone_FilterMode)
, fTextureSampler(texture)
, fColorSpaceXform(std::move(colorSpaceXform)) {
this->addCoordTransform(&fCoordTransform);
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& m,
- GrTextureParams::FilterMode filterMode)
+ GrSamplerParams::FilterMode filterMode)
: fCoordTransform(m, texture, filterMode)
, fTextureSampler(texture, filterMode)
, fColorSpaceXform(std::move(colorSpaceXform)) {
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& m,
- const GrTextureParams& params)
+ const GrSamplerParams& params)
: fCoordTransform(m, texture, params.filterMode())
, fTextureSampler(texture, params)
, fColorSpaceXform(std::move(colorSpaceXform)) {
GrSingleTextureEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix&);
/** clamp mode */
GrSingleTextureEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix&,
- GrTextureParams::FilterMode filterMode);
+ GrSamplerParams::FilterMode filterMode);
GrSingleTextureEffect(GrTexture*,
sk_sp<GrColorSpaceXform>,
const SkMatrix&,
- const GrTextureParams&);
+ const GrSamplerParams&);
/**
* Can be used as a helper to implement subclass onComputeInvariantOutput(). It assumes that
const SkMatrix& matrix,
const SkRect& domain,
GrTextureDomain::Mode mode,
- GrTextureParams::FilterMode filterMode) {
+ GrSamplerParams::FilterMode filterMode) {
static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1};
if (GrTextureDomain::kIgnore_Mode == mode ||
(GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) {
const SkMatrix& matrix,
const SkRect& domain,
GrTextureDomain::Mode mode,
- GrTextureParams::FilterMode filterMode)
+ GrSamplerParams::FilterMode filterMode)
: GrSingleTextureEffect(texture, std::move(colorSpaceXform), matrix, filterMode)
, fTextureDomain(domain, mode) {
SkASSERT(mode != GrTextureDomain::kRepeat_Mode ||
- filterMode == GrTextureParams::kNone_FilterMode);
+ filterMode == GrSamplerParams::kNone_FilterMode);
this->initClassID<GrTextureDomainEffect>();
}
matrix,
domain,
mode,
- bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_FilterMode);
+ bilerp ? GrSamplerParams::kBilerp_FilterMode : GrSamplerParams::kNone_FilterMode);
}
///////////////////////////////////////////////////////////////////////////////
GrDeviceSpaceTextureDecalFragmentProcessor::GrDeviceSpaceTextureDecalFragmentProcessor(
GrTexture* texture, const SkIRect& subset, const SkIPoint& deviceSpaceOffset)
- : fTextureSampler(texture, GrTextureParams::ClampNoFilter())
+ : fTextureSampler(texture, GrSamplerParams::ClampNoFilter())
, fTextureDomain(GrTextureDomain::MakeTexelDomain(texture, subset),
GrTextureDomain::kDecal_Mode) {
this->addTextureSampler(&fTextureSampler);
const SkMatrix&,
const SkRect& domain,
GrTextureDomain::Mode,
- GrTextureParams::FilterMode filterMode);
+ GrSamplerParams::FilterMode filterMode);
const char* name() const override { return "TextureDomain"; }
const SkMatrix&,
const SkRect& domain,
GrTextureDomain::Mode,
- GrTextureParams::FilterMode);
+ GrSamplerParams::FilterMode);
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
yuvMatrix[1].preScale(w[1] / w[0], h[1] / h[0]);
yuvMatrix[2] = yuvMatrix[0];
yuvMatrix[2].preScale(w[2] / w[0], h[2] / h[0]);
- GrTextureParams::FilterMode uvFilterMode =
+ GrSamplerParams::FilterMode uvFilterMode =
((sizes[1].fWidth != sizes[0].fWidth) ||
(sizes[1].fHeight != sizes[0].fHeight) ||
(sizes[2].fWidth != sizes[0].fWidth) ||
(sizes[2].fHeight != sizes[0].fHeight)) ?
- GrTextureParams::kBilerp_FilterMode :
- GrTextureParams::kNone_FilterMode;
+ GrSamplerParams::kBilerp_FilterMode :
+ GrSamplerParams::kNone_FilterMode;
return sk_sp<GrFragmentProcessor>(new YUVtoRGBEffect(
yTexture, uTexture, vTexture, yuvMatrix, uvFilterMode, colorSpace, nv12));
}
private:
YUVtoRGBEffect(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture,
- const SkMatrix yuvMatrix[3], GrTextureParams::FilterMode uvFilterMode,
+ const SkMatrix yuvMatrix[3], GrSamplerParams::FilterMode uvFilterMode,
SkYUVColorSpace colorSpace, bool nv12)
- : fYTransform(yuvMatrix[0], yTexture, GrTextureParams::kNone_FilterMode)
+ : fYTransform(yuvMatrix[0], yTexture, GrSamplerParams::kNone_FilterMode)
, fYSampler(yTexture)
, fUTransform(yuvMatrix[1], uTexture, uvFilterMode)
, fUSampler(uTexture, uvFilterMode)
}
}
-void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, bool allowSRGBInputs,
+void GrGLGpu::bindTexture(int unitIdx, const GrSamplerParams& params, bool allowSRGBInputs,
GrGLTexture* texture) {
SkASSERT(texture);
GR_GL_LINEAR,
GR_GL_LINEAR
};
- GrTextureParams::FilterMode filterMode = params.filterMode();
+ GrSamplerParams::FilterMode filterMode = params.filterMode();
- if (GrTextureParams::kMipMap_FilterMode == filterMode) {
+ if (GrSamplerParams::kMipMap_FilterMode == filterMode) {
if (!this->caps()->mipMapSupport() || GrPixelConfigIsCompressed(texture->config())) {
- filterMode = GrTextureParams::kBilerp_FilterMode;
+ filterMode = GrSamplerParams::kBilerp_FilterMode;
}
}
#ifdef SK_DEBUG
// We were supposed to ensure MipMaps were up-to-date and built correctly before getting here.
- if (GrTextureParams::kMipMap_FilterMode == filterMode) {
+ if (GrSamplerParams::kMipMap_FilterMode == filterMode) {
SkASSERT(!texture->texturePriv().mipMapsAreDirty());
if (GrPixelConfigIsSRGB(texture->config())) {
SkDestinationSurfaceColorMode colorMode = allowSRGBInputs
}
}
-void GrGLGpu::generateMipmaps(const GrTextureParams& params, bool allowSRGBInputs,
+void GrGLGpu::generateMipmaps(const GrSamplerParams& params, bool allowSRGBInputs,
GrGLTexture* texture) {
SkASSERT(texture);
// First, figure out if we need mips for this texture at all:
- GrTextureParams::FilterMode filterMode = params.filterMode();
+ GrSamplerParams::FilterMode filterMode = params.filterMode();
- if (GrTextureParams::kMipMap_FilterMode == filterMode) {
+ if (GrSamplerParams::kMipMap_FilterMode == filterMode) {
if (!this->caps()->mipMapSupport() || GrPixelConfigIsCompressed(texture->config())) {
- filterMode = GrTextureParams::kBilerp_FilterMode;
+ filterMode = GrSamplerParams::kBilerp_FilterMode;
}
}
- if (GrTextureParams::kMipMap_FilterMode != filterMode) {
+ if (GrSamplerParams::kMipMap_FilterMode != filterMode) {
return;
}
int w = srcRect.width();
int h = srcRect.height();
- GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode);
+ GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode);
this->bindTexture(0, params, true, srcTex);
GrGLIRect dstVP;
// Bind the texture, to get things configured for filtering.
// We'll be changing our base level further below:
this->setTextureUnit(0);
- GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
+ GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kBilerp_FilterMode);
this->bindTexture(0, params, gammaCorrect, texture);
// Vertex data:
return attribState;
}
-bool GrGLGpu::onMakeCopyForTextureParams(GrTexture* texture, const GrTextureParams& textureParams,
+bool GrGLGpu::onMakeCopyForTextureParams(GrTexture* texture, const GrSamplerParams& textureParams,
GrTextureProducer::CopyParams* copyParams) const {
if (textureParams.isTiled() ||
- GrTextureParams::kMipMap_FilterMode == textureParams.filterMode()) {
+ GrSamplerParams::kMipMap_FilterMode == textureParams.filterMode()) {
GrGLTexture* glTexture = static_cast<GrGLTexture*>(texture);
if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
- copyParams->fFilter = GrTextureParams::kNone_FilterMode;
+ copyParams->fFilter = GrSamplerParams::kNone_FilterMode;
copyParams->fWidth = texture->width();
copyParams->fHeight = texture->height();
return true;
}
// Used by GrGLProgram to configure OpenGL state.
- void bindTexture(int unitIdx, const GrTextureParams& params, bool allowSRGBInputs,
+ void bindTexture(int unitIdx, const GrSamplerParams& params, bool allowSRGBInputs,
GrGLTexture* texture);
void bindTexelBuffer(int unitIdx, GrPixelConfig, GrGLBuffer*);
- void generateMipmaps(const GrTextureParams& params, bool allowSRGBInputs, GrGLTexture* texture);
+ void generateMipmaps(const GrSamplerParams& params, bool allowSRGBInputs, GrGLTexture* texture);
bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes,
GrPixelConfig readConfig, DrawPreference*,
bool renderTarget, GrGLTexture::TexParams* initialTexParams,
const SkTArray<GrMipLevel>& texels);
- bool onMakeCopyForTextureParams(GrTexture*, const GrTextureParams&,
+ bool onMakeCopyForTextureParams(GrTexture*, const GrSamplerParams&,
GrTextureProducer::CopyParams*) const override;
// Checks whether glReadPixels can be called to get pixel values in readConfig from the
}
}
-static inline GrTextureParams::FilterMode highest_filter_mode(const GrGLTexture::IDDesc& idDesc,
+static inline GrSamplerParams::FilterMode highest_filter_mode(const GrGLTexture::IDDesc& idDesc,
GrPixelConfig config) {
if (GrPixelConfigIsSint(config)) {
// Integer textures in GL can use GL_NEAREST_MIPMAP_NEAREST. This is a mode we don't support
// and don't currently have a use for.
- return GrTextureParams::kNone_FilterMode;
+ return GrSamplerParams::kNone_FilterMode;
}
if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_RECTANGLE ||
idDesc.fInfo.fTarget == GR_GL_TEXTURE_EXTERNAL) {
- return GrTextureParams::kBilerp_FilterMode;
+ return GrSamplerParams::kBilerp_FilterMode;
}
- return GrTextureParams::kMipMap_FilterMode;
+ return GrSamplerParams::kMipMap_FilterMode;
}
// Because this class is virtually derived from GrSurface we must explicitly call its constructor.
#include "GrVkCopyManager.h"
#include "GrSurface.h"
-#include "GrTextureParams.h"
+#include "GrSamplerParams.h"
#include "GrTexturePriv.h"
#include "GrVkCommandBuffer.h"
#include "GrVkCopyPipeline.h"
const GrVkDescriptorSet* samplerDS =
gpu->resourceProvider().getSamplerDescriptorSet(fSamplerDSHandle);
- GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode);
+ GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode);
GrVkSampler* sampler =
resourceProv.findOrCreateCompatibleSampler(params, srcTex->texturePriv().maxMipMapLevel());
gpu->onResolveRenderTarget(texRT);
}
- const GrTextureParams& params = sampler.params();
+ const GrSamplerParams& params = sampler.params();
// Check if we need to regenerate any mip maps
- if (GrTextureParams::kMipMap_FilterMode == params.filterMode()) {
+ if (GrSamplerParams::kMipMap_FilterMode == params.filterMode()) {
if (vkTexture->texturePriv().mipMapsAreDirty()) {
gpu->generateMipmap(vkTexture);
vkTexture->texturePriv().dirtyMipMaps(false);
SkASSERT(fNumSamplers == textureBindings.count());
for (int i = 0; i < textureBindings.count(); ++i) {
- const GrTextureParams& params = textureBindings[i]->params();
+ const GrSamplerParams& params = textureBindings[i]->params();
GrVkTexture* texture = static_cast<GrVkTexture*>(textureBindings[i]->texture());
#include "GrVkResourceProvider.h"
-#include "GrTextureParams.h"
+#include "GrSamplerParams.h"
#include "GrVkCommandBuffer.h"
#include "GrVkCopyPipeline.h"
#include "GrVkGLSLSampler.h"
return new GrVkDescriptorPool(fGpu, type, count);
}
-GrVkSampler* GrVkResourceProvider::findOrCreateCompatibleSampler(const GrTextureParams& params,
+GrVkSampler* GrVkResourceProvider::findOrCreateCompatibleSampler(const GrSamplerParams& params,
uint32_t mipLevels) {
GrVkSampler* sampler = fSamplers.find(GrVkSampler::GenerateKey(params, mipLevels));
if (!sampler) {
class GrPipeline;
class GrPrimitiveProcessor;
-class GrTextureParams;
+class GrSamplerParams;
class GrVkCopyPipeline;
class GrVkGpu;
class GrVkPipeline;
// of our cache of GrVkDescriptorPools.
GrVkDescriptorPool* findOrCreateCompatibleDescriptorPool(VkDescriptorType type, uint32_t count);
- // Finds or creates a compatible GrVkSampler based on the GrTextureParams.
+ // Finds or creates a compatible GrVkSampler based on the GrSamplerParams.
// The refcount is incremented and a pointer returned.
- GrVkSampler* findOrCreateCompatibleSampler(const GrTextureParams&, uint32_t mipLevels);
+ GrVkSampler* findOrCreateCompatibleSampler(const GrSamplerParams&, uint32_t mipLevels);
sk_sp<GrVkPipelineState> findOrCreateCompatiblePipelineState(const GrPipeline&,
const GrPrimitiveProcessor&,
return gWrapModes[tm];
}
-GrVkSampler* GrVkSampler::Create(const GrVkGpu* gpu, const GrTextureParams& params,
+GrVkSampler* GrVkSampler::Create(const GrVkGpu* gpu, const GrSamplerParams& params,
uint32_t mipLevels) {
static VkFilter vkMinFilterModes[] = {
VK_FILTER_NEAREST,
// level mip). If the filters weren't the same we could set min = 0 and max = 0.25 to force
// the minFilter on mip level 0.
createInfo.minLod = 0.0f;
- bool useMipMaps = GrTextureParams::kMipMap_FilterMode == params.filterMode() && mipLevels > 1;
+ bool useMipMaps = GrSamplerParams::kMipMap_FilterMode == params.filterMode() && mipLevels > 1;
createInfo.maxLod = !useMipMaps ? 0.0f : (float)(mipLevels);
createInfo.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
createInfo.unnormalizedCoordinates = VK_FALSE;
GR_VK_CALL(gpu->vkInterface(), DestroySampler(gpu->device(), fSampler, nullptr));
}
-uint16_t GrVkSampler::GenerateKey(const GrTextureParams& params, uint32_t mipLevels) {
+uint16_t GrVkSampler::GenerateKey(const GrSamplerParams& params, uint32_t mipLevels) {
const int kTileModeXShift = 2;
const int kTileModeYShift = 4;
const int kMipLevelShift = 6;
#include "vk/GrVkDefines.h"
-class GrTextureParams;
+class GrSamplerParams;
class GrVkGpu;
class GrVkSampler : public GrVkResource {
public:
- static GrVkSampler* Create(const GrVkGpu* gpu, const GrTextureParams&, uint32_t mipLevels);
+ static GrVkSampler* Create(const GrVkGpu* gpu, const GrSamplerParams&, uint32_t mipLevels);
VkSampler sampler() const { return fSampler; }
// Helpers for hashing GrVkSampler
- static uint16_t GenerateKey(const GrTextureParams&, uint32_t mipLevels);
+ static uint16_t GenerateKey(const GrSamplerParams&, uint32_t mipLevels);
static const uint16_t& GetKey(const GrVkSampler& sampler) { return sampler.fKey; }
static uint32_t Hash(const uint16_t& key) { return key; }
const GrVkImageView* view)
: GrSurface(gpu, desc)
, GrVkImage(info, GrVkImage::kNot_Wrapped)
- , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrTextureParams::kMipMap_FilterMode,
+ , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrSamplerParams::kMipMap_FilterMode,
desc.fIsMipMapped)
, fTextureView(view)
, fLinearTextureView(nullptr) {
GrVkImage::Wrapped wrapped)
: GrSurface(gpu, desc)
, GrVkImage(info, wrapped)
- , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrTextureParams::kMipMap_FilterMode,
+ , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrSamplerParams::kMipMap_FilterMode,
desc.fIsMipMapped)
, fTextureView(view)
, fLinearTextureView(nullptr) {
GrVkImage::Wrapped wrapped)
: GrSurface(gpu, desc)
, GrVkImage(info, wrapped)
- , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrTextureParams::kMipMap_FilterMode,
+ , INHERITED(gpu, desc, kTexture2DSampler_GrSLType, GrSamplerParams::kMipMap_FilterMode,
desc.fIsMipMapped)
, fTextureView(view)
, fLinearTextureView(nullptr) {
// This completely ignores the complexity of the drawVertices case where explicit local coords
// are provided by the caller.
bool doBicubic;
- GrTextureParams::FilterMode textureFilterMode =
+ GrSamplerParams::FilterMode textureFilterMode =
GrSkFilterQualityToGrFilterMode(args.fFilterQuality, *args.fViewMatrix, this->getLocalMatrix(),
&doBicubic);
- GrTextureParams params(tm, textureFilterMode);
+ GrSamplerParams params(tm, textureFilterMode);
sk_sp<GrTexture> texture(as_IB(fImage)->asTextureRef(args.fContext, params, args.fColorMode));
if (!texture) {
return nullptr;
#include <new>
-class GrTextureParams;
+class GrSamplerParams;
class SkImageCacherator;
enum {
virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const = 0;
// Caller must call unref when they are done.
- virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&,
+ virtual GrTexture* asTextureRef(GrContext*, const GrSamplerParams&,
SkDestinationSurfaceColorMode) const = 0;
virtual sk_sp<SkImage> onMakeSubset(const SkIRect&) const = 0;
SkData* onRefEncoded(GrContext*) const override;
sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
bool getROPixels(SkBitmap*, CachingHint) const override;
- GrTexture* asTextureRef(GrContext*, const GrTextureParams&,
+ GrTexture* asTextureRef(GrContext*, const GrSamplerParams&,
SkDestinationSurfaceColorMode) const override;
bool onIsLazyGenerated() const override { return true; }
return fCache.lockAsBitmap(bitmap, this, chint);
}
-GrTexture* SkImage_Generator::asTextureRef(GrContext* ctx, const GrTextureParams& params,
+GrTexture* SkImage_Generator::asTextureRef(GrContext* ctx, const GrSamplerParams& params,
SkDestinationSurfaceColorMode colorMode) const {
return fCache.lockAsTexture(ctx, params, colorMode, this);
}
return true;
}
-GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& params,
+GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrSamplerParams& params,
SkDestinationSurfaceColorMode colorMode) const {
GrTextureAdjuster adjuster(this->peekTexture(), this->alphaType(), this->bounds(), this->uniqueID(),
this->onImageInfo().colorSpace());
static sk_sp<SkImage> create_image_from_maker(GrTextureMaker* maker, SkAlphaType at, uint32_t id) {
sk_sp<GrTexture> texture(
- maker->refTextureForParams(GrTextureParams::ClampNoFilter(),
+ maker->refTextureForParams(GrSamplerParams::ClampNoFilter(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
if (!texture) {
return nullptr;
}
bool getROPixels(SkBitmap*, CachingHint) const override;
- GrTexture* asTextureRef(GrContext* ctx, const GrTextureParams& params,
+ GrTexture* asTextureRef(GrContext* ctx, const GrSamplerParams& params,
SkDestinationSurfaceColorMode) const override;
sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
SkData* onRefEncoded(GrContext*) const override;
bool getROPixels(SkBitmap*, CachingHint) const override;
- GrTexture* asTextureRef(GrContext*, const GrTextureParams&,
+ GrTexture* asTextureRef(GrContext*, const GrSamplerParams&,
SkDestinationSurfaceColorMode) const override;
sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
return true;
}
-GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrTextureParams& params,
+GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrSamplerParams& params,
SkDestinationSurfaceColorMode colorMode) const {
#if SK_SUPPORT_GPU
if (!ctx) {
SkASSERT(fPinnedCount == 0);
SkASSERT(fPinnedUniqueID == 0);
fPinnedTexture.reset(
- GrRefCachedBitmapTexture(ctx, fBitmap, GrTextureParams::ClampNoFilter(),
+ GrRefCachedBitmapTexture(ctx, fBitmap, GrSamplerParams::ClampNoFilter(),
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
if (!fPinnedTexture) {
return false;
sk_sp<GrRenderTargetContext> rtContext = context->makeRenderTargetContext(
SkBackingFit::kExact, kS, kS, kRGBA_8888_GrPixelConfig, nullptr);
- for (auto filter : {GrTextureParams::kNone_FilterMode,
- GrTextureParams::kBilerp_FilterMode,
- GrTextureParams::kMipMap_FilterMode}) {
+ for (auto filter : {GrSamplerParams::kNone_FilterMode,
+ GrSamplerParams::kBilerp_FilterMode,
+ GrSamplerParams::kMipMap_FilterMode}) {
SkMatrix m;
m.setIDiv(kS, kS);
sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(texture.get(), nullptr, m,
nullptr));
SkMatrix m;
m.setIDiv(rectangleTexture->width(), rectangleTexture->height());
- for (auto filter : {GrTextureParams::kNone_FilterMode,
- GrTextureParams::kBilerp_FilterMode,
- GrTextureParams::kMipMap_FilterMode}) {
+ for (auto filter : {GrSamplerParams::kNone_FilterMode,
+ GrSamplerParams::kBilerp_FilterMode,
+ GrSamplerParams::kMipMap_FilterMode}) {
rtContext->clear(nullptr, 0xDDCCBBAA, true);
sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(rectangleTexture,
nullptr, m, filter));
GrNoClip noClip;
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- GrTextureParams mipMapParams(SkShader::kRepeat_TileMode, GrTextureParams::kMipMap_FilterMode);
+ GrSamplerParams mipMapParams(SkShader::kRepeat_TileMode, GrSamplerParams::kMipMap_FilterMode);
paint.addColorTextureProcessor(texture.get(), nullptr, SkMatrix::MakeScale(0.5f), mipMapParams);
// 1) Draw texture to S32 surface (should generate/use sRGB mips)