void GrGLPathRendering::onDrawPath(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline, const GrPipeline::FixedDynamicState& fixedDynamicState, const GrStencilSettings& stencilPassSettings, const GrPath* path) { if (!this->gpu()->flushGLState(primProc, pipeline, &fixedDynamicState, nullptr, 1, false)) { return; } const GrGLPath* glPath = static_cast<const GrGLPath*>(path); this->flushPathStencilSettings(stencilPassSettings); SkASSERT(!fHWPathStencilSettings.isTwoSided()); GrGLenum fillMode = gr_stencil_op_to_gl_path_rendering_fill_mode(fHWPathStencilSettings.front().fPassOp); GrGLint writeMask = fHWPathStencilSettings.front().fWriteMask; if (glPath->shouldStroke()) { if (glPath->shouldFill()) { GL_CALL(StencilFillPath(glPath->pathID(), fillMode, writeMask)); } GL_CALL(StencilThenCoverStrokePath(glPath->pathID(), 0xffff, writeMask, GR_GL_BOUNDING_BOX)); } else { GL_CALL(StencilThenCoverFillPath(glPath->pathID(), fillMode, writeMask, GR_GL_BOUNDING_BOX)); } }
inline void GrGLPathRendering::stencilThenCoverFillPath(GrGLuint path, GrGLenum fillMode, GrGLuint mask, GrGLenum coverMode) { if (caps().stencilThenCoverSupport) { GL_CALL(StencilThenCoverFillPath(path, fillMode, mask, coverMode)); return; } GL_CALL(StencilFillPath(path, fillMode, mask)); GL_CALL(CoverFillPath(path, coverMode)); }
void GrGLPathRendering::onDrawPath(const DrawPathArgs& args, const GrPath* path) { if (!this->gpu()->flushGLState(args)) { return; } const GrGLPath* glPath = static_cast<const GrGLPath*>(path); this->flushPathStencilSettings(*args.fStencil); 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); if (glPath->shouldStroke()) { if (glPath->shouldFill()) { GL_CALL(StencilFillPath(glPath->pathID(), fillMode, writeMask)); } GL_CALL(StencilThenCoverStrokePath(glPath->pathID(), 0xffff, writeMask, GR_GL_BOUNDING_BOX)); } else { GL_CALL(StencilThenCoverFillPath(glPath->pathID(), fillMode, writeMask, GR_GL_BOUNDING_BOX)); } }