Index: src/gpu/GrSWMaskHelper.h |
diff --git a/src/gpu/GrSWMaskHelper.h b/src/gpu/GrSWMaskHelper.h |
index f2bb34b30c090df98c8c365ceae0e472b96a945b..46520a91bea34bc9cd16e13759166fc1d5f408fc 100644 |
--- a/src/gpu/GrSWMaskHelper.h |
+++ b/src/gpu/GrSWMaskHelper.h |
@@ -8,8 +8,9 @@ |
#ifndef GrSWMaskHelper_DEFINED |
#define GrSWMaskHelper_DEFINED |
-#include "SkAutoPixmapStorage.h" |
#include "GrColor.h" |
+#include "GrTextureProvider.h" |
+#include "SkAutoPixmapStorage.h" |
#include "SkBitmap.h" |
#include "SkDraw.h" |
#include "SkMatrix.h" |
@@ -66,36 +67,37 @@ 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, |
bool antiAlias, |
+ TextureType, |
const SkMatrix* matrix); |
- // This utility routine is used to add a shape's mask to some other draw. |
- // The GrClipStackClip uses it to accumulate clip masks while the |
- // GrSoftwarePathRenderer uses it to fulfill a drawPath call. |
- // It draws with "texture" as a path mask into "target" using "rect" as |
- // geometry and the current drawState. The current drawState is altered to |
- // accommodate the mask. |
- // Note that this method assumes that the GrPaint::kTotalStages slot in |
- // the draw state can be used to hold the mask texture stage. |
- // This method is really only intended to be used with the |
- // output of DrawPathMaskToTexture. |
+ // This utility draws a path mask generated by DrawShapeMaskToTexture using a provided paint. |
+ // The rectangle is drawn in device space. The 'viewMatrix' will be used to ensure the correct |
+ // local coords are provided to any fragment processors in the paint. |
static void DrawToTargetWithShapeMask(GrTexture* texture, |
GrDrawContext*, |
const GrPaint& paint, |
const GrUserStencilSettings& userStencilSettings, |
const GrClip&, |
const SkMatrix& viewMatrix, |
- const SkIRect& rect); |
+ const SkIPoint& textureOriginInDeviceSpace, |
+ const SkIRect& deviceSpaceRectToDraw); |
private: |
// Helper function to get a scratch texture suitable for capturing the |
// result (i.e., right size & format) |
- GrTexture* createTexture(); |
+ GrTexture* createTexture(TextureType); |
GrTextureProvider* fTexProvider; |
SkMatrix fMatrix; |