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

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

Issue 23440049: Implement stroking a path with nv_path_rendering (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 2 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
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | src/gpu/gl/GrGpuGL_program.cpp » ('j') | 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 113866759e3a79055e3bea236c6efbe98f2af07b..d313167a82757b7802d70389d2976f83e842ccf9 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -12,6 +12,7 @@
#include "GrGLShaderBuilder.h"
#include "GrTemplates.h"
#include "GrTypes.h"
+#include "SkStrokeRec.h"
#include "SkTemplates.h"
static const GrGLuint GR_MAX_GLUINT = ~0U;
@@ -1276,9 +1277,9 @@ GrIndexBuffer* GrGpuGL::onCreateIndexBuffer(uint32_t size, bool dynamic) {
}
}
-GrPath* GrGpuGL::onCreatePath(const SkPath& inPath) {
+GrPath* GrGpuGL::onCreatePath(const SkPath& inPath, const SkStrokeRec& stroke) {
SkASSERT(this->caps()->pathRenderingSupport());
- return SkNEW_ARGS(GrGLPath, (this, inPath));
+ return SkNEW_ARGS(GrGLPath, (this, inPath, stroke));
}
void GrGpuGL::flushScissor() {
@@ -1700,7 +1701,7 @@ void GrGpuGL::onGpuStencilPath(const GrPath* path, SkPath::FillType fill) {
GL_CALL(StencilFillPath(id, fillMode, writeMask));
}
-void GrGpuGL::onGpuFillPath(const GrPath* path, SkPath::FillType fill) {
+void GrGpuGL::onGpuDrawPath(const GrPath* path, SkPath::FillType fill) {
SkASSERT(this->caps()->pathRenderingSupport());
GrGLuint id = static_cast<const GrGLPath*>(path)->pathID();
@@ -1709,16 +1710,27 @@ void GrGpuGL::onGpuFillPath(const GrPath* path, SkPath::FillType fill) {
SkASSERT(!fCurrentProgram->hasVertexShader());
flushPathStencilSettings(fill);
+ const SkStrokeRec& stroke = path->getStroke();
SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(fill);
SkASSERT(!fHWPathStencilSettings.isTwoSided());
GrGLenum fillMode =
gr_stencil_op_to_gl_path_rendering_fill_mode(fHWPathStencilSettings.passOp(GrStencilSettings::kFront_Face));
GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFront_Face);
- GL_CALL(StencilFillPath(id, fillMode, writeMask));
+
+ if (stroke.isFillStyle() || SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
+ GL_CALL(StencilFillPath(id, fillMode, writeMask));
+ }
+ if (stroke.needToApply()) {
+ GL_CALL(StencilStrokePath(id, 0xffff, writeMask));
+ }
if (nonInvertedFill == fill) {
- GL_CALL(CoverFillPath(id, GR_GL_BOUNDING_BOX));
+ if (stroke.needToApply()) {
+ GL_CALL(CoverStrokePath(id, GR_GL_BOUNDING_BOX));
+ } else {
+ GL_CALL(CoverFillPath(id, GR_GL_BOUNDING_BOX));
+ }
} else {
GrDrawState* drawState = this->drawState();
GrDrawState::AutoViewMatrixRestore avmr;
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | src/gpu/gl/GrGpuGL_program.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698