aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawTarget.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-25 11:59:40 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-25 11:59:40 +0000
commit9b62aa156bcf1db6f11af9302bf8bb8ef2567142 (patch)
treedae7097b678bfcd382993b53ba9808ae9438aa57 /src/gpu/GrDrawTarget.h
parent5c260f41af0af0d6bbfa9268664ac361a5ddc1e0 (diff)
Make it possible to draw multiple paths at once to a draw target
Add interface to draw multiple paths in a single "command" to a draw target. Implement this interface in GrGpuGL with NVPR "instanced" calls. The instanced calls accept list of paths and list of transformations as their parameters. The transformations are at this moment expected to be 2d affine transformations, as the functions are called only for text rendering. This will be used when drawing fonts. Later it can be maybe be used in GrInOrderDrawBuffer to aggregate many draw calls into one instanced draw call, similar to drawing rects. R=jvanverth@google.com, bsalomon@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/209413006 git-svn-id: http://skia.googlecode.com/svn/trunk@13930 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrDrawTarget.h')
-rw-r--r--src/gpu/GrDrawTarget.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 19ce16f64a..03e603a5b5 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -15,6 +15,7 @@
#include "SkClipStack.h"
#include "SkMatrix.h"
#include "SkPath.h"
+#include "SkStrokeRec.h"
#include "SkTArray.h"
#include "SkTLazy.h"
#include "SkTypes.h"
@@ -24,7 +25,6 @@ class GrClipData;
class GrDrawTargetCaps;
class GrPath;
class GrVertexBuffer;
-class SkStrokeRec;
class GrDrawTarget : public SkRefCnt {
protected:
@@ -344,6 +344,19 @@ public:
void drawPath(const GrPath*, SkPath::FillType fill);
/**
+ * Draws many paths. It will respect the HW
+ * antialias flag on the draw state (if possible in the 3D API).
+ *
+ * @param transforms array of 2d affine transformations, one for each path.
+ * @param fill the fill type for drawing all the paths. Fill must not be a
+ * hairline.
+ * @param stroke the stroke for drawing all the paths.
+ */
+ void drawPaths(size_t pathCount, const GrPath** paths,
+ const SkMatrix* transforms, SkPath::FillType fill,
+ SkStrokeRec::Style stroke);
+
+ /**
* Helper function for drawing rects. It performs a geometry src push and pop
* and thus will finalize any reserved geometry.
*
@@ -487,6 +500,16 @@ public:
this->onDrawPath(path, fill, dstCopy);
}
+ /**
+ * For subclass internal use to invoke a call to onDrawPaths().
+ */
+ void executeDrawPaths(size_t pathCount, const GrPath** paths,
+ const SkMatrix* transforms, SkPath::FillType fill,
+ SkStrokeRec::Style stroke,
+ const GrDeviceCoordTexture* dstCopy) {
+ this->onDrawPaths(pathCount, paths, transforms, fill, stroke, dstCopy);
+ }
+
////////////////////////////////////////////////////////////////////////////
/**
@@ -867,6 +890,9 @@ private:
virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0;
virtual void onDrawPath(const GrPath*, SkPath::FillType,
const GrDeviceCoordTexture* dstCopy) = 0;
+ virtual void onDrawPaths(size_t, const GrPath**, const SkMatrix*,
+ SkPath::FillType, SkStrokeRec::Style,
+ const GrDeviceCoordTexture* dstCopy) = 0;
virtual void onInstantGpuTraceEvent(const char* marker) = 0;
virtual void onPushGpuTraceEvent(const char* marker) = 0;