aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrSWMaskHelper.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-09-21 11:16:05 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-21 11:16:05 -0700
commit39ef7fb885d7be648b9f0ecd027bc400d1213cec (patch)
treedadf2a165d64b90cce680395b1c013e19c01bee7 /src/gpu/GrSWMaskHelper.h
parent669983856d99b9312be3166b7dd1f8483a90c315 (diff)
Add optional sw generated path coverage mask caching
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2335343008 All the bots except the painfully slow windows compiler have finished so, NOTRY=true Review-Url: https://codereview.chromium.org/2335343008
Diffstat (limited to 'src/gpu/GrSWMaskHelper.h')
-rw-r--r--src/gpu/GrSWMaskHelper.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/gpu/GrSWMaskHelper.h b/src/gpu/GrSWMaskHelper.h
index f2bb34b30c..46520a91be 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;