Replace TextureType with SkBackingFit
authorRobert Phillips <robertphillips@google.com>
Wed, 14 Dec 2016 14:12:13 +0000 (09:12 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Wed, 14 Dec 2016 15:00:41 +0000 (15:00 +0000)
I believe TextureType is vestigial

Change-Id: I253f3a3200d6e05d5e0204662225f4a8e8ed5cb9
Reviewed-on: https://skia-review.googlesource.com/6029
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>

src/gpu/GrSWMaskHelper.cpp
src/gpu/GrSWMaskHelper.h
src/gpu/GrSoftwarePathRenderer.cpp

index 6bbb3bdd202b9ead12809bdf3c65d9c76f954717..f90678a3c266fcec7436151b61a238ea115efbb6 100644 (file)
@@ -97,13 +97,13 @@ bool GrSWMaskHelper::init(const SkIRect& resultBounds, const SkMatrix* matrix) {
 /**
  * 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);
@@ -140,7 +140,7 @@ GrTexture* GrSWMaskHelper::DrawShapeMaskToTexture(GrTextureProvider* texProvider
                                                   const GrShape& shape,
                                                   const SkIRect& resultBounds,
                                                   GrAA aa,
-                                                  TextureType textureType,
+                                                  SkBackingFit fit,
                                                   const SkMatrix* matrix) {
     GrSWMaskHelper helper(texProvider);
 
@@ -150,7 +150,7 @@ GrTexture* GrSWMaskHelper::DrawShapeMaskToTexture(GrTextureProvider* texProvider
 
     helper.drawShape(shape, SkRegion::kReplace_Op, aa, 0xFF);
 
-    GrTexture* texture(helper.createTexture(textureType));
+    GrTexture* texture(helper.createTexture(fit));
     if (!texture) {
         return nullptr;
     }
index 0669db9f1b318e086a487d35f5c4a69ef400bdb5..55ed3ff2e5dc047ed8c05c7e2f6195e16a7bac16 100644 (file)
@@ -68,18 +68,13 @@ public:
         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.
@@ -97,7 +92,7 @@ public:
 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;
index cb3f679730d87b8268420a0c3ea5e6525d61c10b..d6db0dfdd29287bf6185dbc03db6e0b0525ac401 100644 (file)
@@ -201,12 +201,11 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
         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;
         }