aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2014-11-25 11:00:56 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-25 11:00:56 -0800
commit55b24afc178e641e17a5664beba7ab2b4982c91a (patch)
treebfffa193f40098e0416ca05a629bd1afc2aee304 /src/gpu/gl
parentb116619028ea826b322919d176d9c87f9569d8e7 (diff)
Add IndexType parameter to GrDrawTarget::drawPaths
Allows the caller to decide whether they sent 8, 16, or 32 bit path indices. BUG=skia: Review URL: https://codereview.chromium.org/746253003
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLPathRendering.cpp35
-rw-r--r--src/gpu/gl/GrGLPathRendering.h4
2 files changed, 25 insertions, 14 deletions
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index 2a46078d03..c7aae42a3c 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -21,6 +21,17 @@
#define GL_CALL_RET(RET, X) GR_GL_CALL_RET(fGpu->glInterface(), RET, X)
+static const GrGLenum gIndexType2GLType[] = {
+ GR_GL_UNSIGNED_BYTE,
+ GR_GL_UNSIGNED_SHORT,
+ GR_GL_UNSIGNED_INT
+};
+
+GR_STATIC_ASSERT(0 == GrPathRange::kU8_PathIndexType);
+GR_STATIC_ASSERT(1 == GrPathRange::kU16_PathIndexType);
+GR_STATIC_ASSERT(2 == GrPathRange::kU32_PathIndexType);
+GR_STATIC_ASSERT(GrPathRange::kU32_PathIndexType == GrPathRange::kLast_PathIndexType);
+
static const GrGLenum gXformType2GLType[] = {
GR_GL_NONE,
GR_GL_TRANSLATE_X,
@@ -194,9 +205,10 @@ void GrGLPathRendering::drawPath(const GrPath* path, const GrStencilSettings& st
}
}
-void GrGLPathRendering::drawPaths(const GrPathRange* pathRange, const uint32_t indices[], int count,
- const float transforms[], PathTransformType transformsType,
- const GrStencilSettings& stencilSettings) {
+void GrGLPathRendering::drawPaths(const GrPathRange* pathRange,
+ const void* indices, PathIndexType indexType,
+ const float transformValues[], PathTransformType transformType,
+ int count, const GrStencilSettings& stencilSettings) {
SkASSERT(fGpu->caps()->pathRenderingSupport());
GrGLuint baseID = static_cast<const GrGLPathRange*>(pathRange)->basePathID();
@@ -215,19 +227,18 @@ void GrGLPathRendering::drawPaths(const GrPathRange* pathRange, const uint32_t i
if (stroke.needToApply()) {
if (SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
GL_CALL(StencilFillPathInstanced(
- count, GR_GL_UNSIGNED_INT, indices, baseID, fillMode,
- writeMask, gXformType2GLType[transformsType],
- transforms));
+ count, gIndexType2GLType[indexType], indices, baseID, fillMode,
+ writeMask, gXformType2GLType[transformType], transformValues));
}
this->stencilThenCoverStrokePathInstanced(
- count, GR_GL_UNSIGNED_INT, indices, baseID, 0xffff, writeMask,
- GR_GL_BOUNDING_BOX_OF_BOUNDING_BOXES,
- gXformType2GLType[transformsType], transforms);
+ count, gIndexType2GLType[indexType], indices, baseID,
+ 0xffff, writeMask, GR_GL_BOUNDING_BOX_OF_BOUNDING_BOXES,
+ gXformType2GLType[transformType], transformValues);
} else {
this->stencilThenCoverFillPathInstanced(
- count, GR_GL_UNSIGNED_INT, indices, baseID, fillMode, writeMask,
- GR_GL_BOUNDING_BOX_OF_BOUNDING_BOXES,
- gXformType2GLType[transformsType], transforms);
+ count, gIndexType2GLType[indexType], indices, baseID,
+ fillMode, writeMask, GR_GL_BOUNDING_BOX_OF_BOUNDING_BOXES,
+ gXformType2GLType[transformType], transformValues);
}
}
diff --git a/src/gpu/gl/GrGLPathRendering.h b/src/gpu/gl/GrGLPathRendering.h
index f314563688..1f1a33cbbb 100644
--- a/src/gpu/gl/GrGLPathRendering.h
+++ b/src/gpu/gl/GrGLPathRendering.h
@@ -41,8 +41,8 @@ public:
const SkStrokeRec&) SK_OVERRIDE;
virtual void stencilPath(const GrPath*, const GrStencilSettings&) SK_OVERRIDE;
virtual void drawPath(const GrPath*, const GrStencilSettings&) SK_OVERRIDE;
- virtual void drawPaths(const GrPathRange*, const uint32_t indices[], int count,
- const float transforms[], PathTransformType,
+ virtual void drawPaths(const GrPathRange*, const void* indices, PathIndexType,
+ const float transformValues[], PathTransformType, int count,
const GrStencilSettings&) SK_OVERRIDE;
/* Called when the 3D context state is unknown. */