Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: src/gpu/GrSWMaskHelper.h

Issue 2335343008: Add optional sw generated path coverage mask caching (Closed)
Patch Set: comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrSWMaskHelper.h
diff --git a/src/gpu/GrSWMaskHelper.h b/src/gpu/GrSWMaskHelper.h
index f2bb34b30c090df98c8c365ceae0e472b96a945b..4b562140d4f56d4a9d61485c5c2f6e7cc44bbbcc 100644
--- a/src/gpu/GrSWMaskHelper.h
+++ b/src/gpu/GrSWMaskHelper.h
@@ -8,6 +8,7 @@
#ifndef GrSWMaskHelper_DEFINED
#define GrSWMaskHelper_DEFINED
robertphillips 2016/09/21 15:42:39 Why <> style ?
bsalomon 2016/09/21 16:01:09 CLion auto inserter
+#include <GrTextureProvider.h>
#include "SkAutoPixmapStorage.h"
#include "GrColor.h"
#include "SkBitmap.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;

Powered by Google App Engine
This is Rietveld 408576698