/**
* Get a texture (from the texture cache) of the correct size & format.
*/
-GrTexture* GrSWMaskHelper::createTexture(TextureType textureType) {
+GrTexture* GrSWMaskHelper::createTexture(SkBackingFit fit) {
GrSurfaceDesc desc;
desc.fWidth = fPixels.width();
desc.fHeight = fPixels.height();
desc.fConfig = kAlpha_8_GrPixelConfig;
- if (TextureType::kApproximateFit == textureType) {
+ if (SkBackingFit::kApprox == fit) {
return fTexProvider->createApproxTexture(desc);
} else {
return fTexProvider->createTexture(desc, SkBudgeted::kYes);
const GrShape& shape,
const SkIRect& resultBounds,
GrAA aa,
- TextureType textureType,
+ SkBackingFit fit,
const SkMatrix* matrix) {
GrSWMaskHelper helper(texProvider);
helper.drawShape(shape, SkRegion::kReplace_Op, aa, 0xFF);
- GrTexture* texture(helper.createTexture(textureType));
+ GrTexture* texture(helper.createTexture(fit));
if (!texture) {
return nullptr;
}
fPixels.erase(SkColorSetARGB(alpha, 0xFF, 0xFF, 0xFF));
}
- enum class TextureType {
- kExactFit,
- kApproximateFit
- };
-
// Canonical usage utility that draws a single path and uploads it
// to the GPU. The result is returned.
static GrTexture* DrawShapeMaskToTexture(GrTextureProvider*,
const GrShape&,
const SkIRect& resultBounds,
GrAA,
- TextureType,
+ SkBackingFit,
const SkMatrix* matrix);
// This utility draws a path mask generated by DrawShapeMaskToTexture using a provided paint.
private:
// Helper function to get a scratch texture suitable for capturing the
// result (i.e., right size & format)
- GrTexture* createTexture(TextureType);
+ GrTexture* createTexture(SkBackingFit);
GrTextureProvider* fTexProvider;
SkMatrix fMatrix;
texture.reset(args.fResourceProvider->findAndRefTextureByUniqueKey(maskKey));
}
if (!texture) {
- GrSWMaskHelper::TextureType type = useCache ? GrSWMaskHelper::TextureType::kExactFit
- : GrSWMaskHelper::TextureType::kApproximateFit;
+ SkBackingFit fit = useCache ? SkBackingFit::kExact : SkBackingFit::kApprox;
GrAA aa = GrAAType::kCoverage == args.fAAType ? GrAA::kYes : GrAA::kNo;
texture.reset(GrSWMaskHelper::DrawShapeMaskToTexture(fTexProvider, *args.fShape,
*boundsForMask, aa,
- type, args.fViewMatrix));
+ fit, args.fViewMatrix));
if (!texture) {
return false;
}