Chromium Code Reviews| Index: src/gpu/GrGpu.cpp |
| diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp |
| index 910c57146bd2200727cc1b8455a38bdfe71da366..abc07a56453bbbee644b0009fb30f3f709aa9f97 100644 |
| --- a/src/gpu/GrGpu.cpp |
| +++ b/src/gpu/GrGpu.cpp |
| @@ -198,7 +198,7 @@ GrIndexBuffer* GrGpu::createIndexBuffer(uint32_t size, bool dynamic) { |
| } |
| GrPath* GrGpu::createPath(const SkPath& path) { |
| - SkASSERT(this->caps()->pathStencilingSupport()); |
| + SkASSERT(this->caps()->pathRenderingSupport()); |
| this->handleDirtyContext(); |
| return this->onCreatePath(path); |
| } |
| @@ -247,6 +247,45 @@ void GrGpu::resolveRenderTarget(GrRenderTarget* target) { |
| this->onResolveRenderTarget(target); |
| } |
| +namespace { |
|
bsalomon
2013/10/08 14:05:08
We were using anonymous namespaces in Gr code, but
Kimmo Kinnunen
2013/10/09 07:07:01
Done.
|
| + |
| +const GrStencilSettings& winding_path_stencil_settings() { |
| + GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
| + kIncClamp_StencilOp, |
| + kIncClamp_StencilOp, |
| + kAlwaysIfInClip_StencilFunc, |
| + 0xFFFF, 0xFFFF, 0xFFFF); |
| + return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
| +} |
| +const GrStencilSettings& even_odd_path_stencil_settings() { |
| + GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
| + kInvert_StencilOp, |
| + kInvert_StencilOp, |
| + kAlwaysIfInClip_StencilFunc, |
| + 0xFFFF, 0xFFFF, 0xFFFF); |
| + return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
| +} |
| + |
| +} |
| + |
| +void GrGpu::getPathStencilSettingsForFillType(SkPath::FillType fill, GrStencilSettings* outStencilSettings) { |
| + |
| + switch (fill) { |
| + default: |
| + GrCrash("Unexpected path fill."); |
| + /* fallthrough */; |
| + case SkPath::kWinding_FillType: |
| + case SkPath::kInverseWinding_FillType: |
| + *outStencilSettings = winding_path_stencil_settings(); |
| + break; |
| + case SkPath::kEvenOdd_FillType: |
| + case SkPath::kInverseEvenOdd_FillType: |
| + *outStencilSettings = even_odd_path_stencil_settings(); |
| + break; |
| + } |
| + fClipMaskManager.adjustPathStencilParams(outStencilSettings); |
| +} |
| + |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -349,10 +388,6 @@ void GrGpu::onDraw(const DrawInfo& info) { |
| void GrGpu::onStencilPath(const GrPath* path, const SkStrokeRec&, SkPath::FillType fill) { |
| this->handleDirtyContext(); |
| - // TODO: make this more efficient (don't copy and copy back) |
| - GrAutoTRestore<GrStencilSettings> asr(this->drawState()->stencil()); |
| - |
| - this->setStencilPathSettings(*path, fill, this->drawState()->stencil()); |
| GrDrawState::AutoRestoreEffects are; |
| if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are)) { |
| return; |
| @@ -361,6 +396,20 @@ void GrGpu::onStencilPath(const GrPath* path, const SkStrokeRec&, SkPath::FillTy |
| this->onGpuStencilPath(path, fill); |
| } |
| +void GrGpu::onFillPath(const GrPath* path, const SkStrokeRec& stroke, SkPath::FillType fill, |
| + const GrDeviceCoordTexture* dstCopy) { |
| + this->handleDirtyContext(); |
| + |
| + drawState()->setDefaultVertexAttribs(); |
| + |
| + GrDrawState::AutoRestoreEffects are; |
| + if (!this->setupClipAndFlushState(kFillPath_DrawType, dstCopy, &are)) { |
| + return; |
| + } |
| + |
| + this->onGpuFillPath(path, fill); |
| +} |
| + |
| void GrGpu::finalizeReservedVertices() { |
| SkASSERT(NULL != fVertexPool); |
| fVertexPool->unlock(); |