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

Unified Diff: src/gpu/gl/GrGpuGL.cpp

Issue 437473002: Wrap NV_path_rendering API with GrGLPathRendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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
« src/gpu/gl/GrGLInterface.cpp ('K') | « src/gpu/gl/GrGpuGL.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL.cpp
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 404e7abdbddf20caa5e9a2c5db507e2b24ad1794..d079c2e23a7af04a09083d50056c3ec326f8816c 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -1899,9 +1899,9 @@ void GrGpuGL::onGpuDrawPath(const GrPath* path, SkPath::FillType fill) {
if (SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
GL_CALL(StencilFillPath(id, fillMode, writeMask));
}
- GL_CALL(StencilThenCoverStrokePath(id, 0xffff, writeMask, GR_GL_BOUNDING_BOX));
+ this->stencilThenCoverStrokePath(id, 0xffff, writeMask, GR_GL_BOUNDING_BOX);
} else {
- GL_CALL(StencilThenCoverFillPath(id, fillMode, writeMask, GR_GL_BOUNDING_BOX));
+ this->stencilThenCoverFillPath(id, fillMode, writeMask, GR_GL_BOUNDING_BOX);
}
} else {
if (stroke.isFillStyle() || SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
@@ -1964,15 +1964,15 @@ void GrGpuGL::onGpuDrawPaths(const GrPathRange* pathRange,
writeMask, gXformType2GLType[transformsType],
transforms));
}
- GL_CALL(StencilThenCoverStrokePathInstanced(
+ this->stencilThenCoverStrokePathInstanced(
count, GR_GL_UNSIGNED_INT, indices, baseID, 0xffff, writeMask,
GR_GL_BOUNDING_BOX_OF_BOUNDING_BOXES,
- gXformType2GLType[transformsType], transforms));
+ gXformType2GLType[transformsType], transforms);
} else {
- GL_CALL(StencilThenCoverFillPathInstanced(
+ this->stencilThenCoverFillPathInstanced(
count, GR_GL_UNSIGNED_INT, indices, baseID, fillMode, writeMask,
GR_GL_BOUNDING_BOX_OF_BOUNDING_BOXES,
- gXformType2GLType[transformsType], transforms));
+ gXformType2GLType[transformsType], transforms);
}
} else {
if (stroke.isFillStyle() || SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
@@ -2681,6 +2681,62 @@ void GrGpuGL::setTextureUnit(int unit) {
}
}
+void GrGpuGL::stencilThenCoverFillPath(GrGLuint path, GrGLenum fillMode,
+ GrGLuint mask, GrGLenum coverMode) {
+ SkASSERT(this->caps()->pathRenderingSupport());
+ if (!this->caps()->pathRenderingV13Support()) {
+ GL_CALL(StencilFillPath(path, fillMode, mask));
+ GL_CALL(CoverFillPath(path, coverMode));
+ return;
+ }
+ GL_CALL(StencilThenCoverFillPath(path, fillMode, mask, coverMode));
+}
+
+void GrGpuGL::stencilThenCoverStrokePath(GrGLuint path, GrGLint reference,
+ GrGLuint mask, GrGLenum coverMode) {
+ SkASSERT(this->caps()->pathRenderingSupport());
+ if (!this->caps()->pathRenderingV13Support()) {
+ GL_CALL(StencilStrokePath(path, reference, mask));
+ GL_CALL(CoverStrokePath(path, coverMode));
+ return;
+ }
+ GL_CALL(StencilThenCoverStrokePath(path, reference, mask, coverMode));
+}
+
+void GrGpuGL::stencilThenCoverFillPathInstanced(GrGLsizei numPaths, GrGLenum pathNameType,
+ const GrGLvoid *paths, GrGLuint pathBase,
+ GrGLenum fillMode, GrGLuint mask,
+ GrGLenum coverMode, GrGLenum transformType,
+ const GrGLfloat *transformValues) {
+ SkASSERT(this->caps()->pathRenderingSupport());
+ if (!this->caps()->pathRenderingV13Support()) {
+ GL_CALL(StencilFillPathInstanced(numPaths, pathNameType, paths, pathBase,
+ fillMode, mask, transformType, transformValues));
+ GL_CALL(CoverFillPathInstanced(numPaths, pathNameType, paths, pathBase,
+ coverMode, transformType, transformValues));
+ return;
+ }
+ GL_CALL(StencilThenCoverFillPathInstanced(numPaths, pathNameType, paths, pathBase, fillMode,
+ mask, coverMode, transformType, transformValues));
+}
+
+void GrGpuGL::stencilThenCoverStrokePathInstanced(GrGLsizei numPaths, GrGLenum pathNameType,
+ const GrGLvoid *paths, GrGLuint pathBase,
+ GrGLint reference, GrGLuint mask,
+ GrGLenum coverMode, GrGLenum transformType,
+ const GrGLfloat *transformValues) {
+ SkASSERT(this->caps()->pathRenderingSupport());
+ if (!this->caps()->pathRenderingV13Support()) {
+ GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
+ reference, mask, transformType, transformValues));
+ GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
+ coverMode, transformType, transformValues));
+ return;
+ }
+ GL_CALL(StencilThenCoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, reference,
+ mask, coverMode, transformType, transformValues));
+}
+
void GrGpuGL::setScratchTextureUnit() {
// Bind the last texture unit since it is the least likely to be used by GrGLProgram.
int lastUnitIdx = fHWBoundTextureUniqueIDs.count() - 1;
« src/gpu/gl/GrGLInterface.cpp ('K') | « src/gpu/gl/GrGpuGL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698