Index: src/gpu/GrDrawTarget.cpp |
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp |
index 0d3a2390d511bad9e052bb577c7871c084f992ff..a87e712d3369c4d9e20111ebb2a40edbb5d5b8e0 100644 |
--- a/src/gpu/GrDrawTarget.cpp |
+++ b/src/gpu/GrDrawTarget.cpp |
@@ -93,7 +93,6 @@ GrDrawTarget::GrDrawTarget(GrContext* context) |
, fContext(context) |
, fGpuTraceMarkerCount(0) { |
SkASSERT(context); |
- |
fDrawState = &fDefaultDrawState; |
// We assume that fDrawState always owns a ref to the object it points at. |
fDefaultDrawState.ref(); |
@@ -725,6 +724,43 @@ void GrDrawTarget::onDrawRect(const SkRect& rect, |
void GrDrawTarget::clipWillBeSet(const GrClipData* clipData) { |
} |
+static 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); |
+} |
+ |
+static 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 GrDrawTarget::getPathStencilSettingsForFillType(SkPath::FillType fill, |
+ GrStencilSettings* outStencilSettings) { |
+ |
+ switch (fill) { |
+ default: |
+ SkFAIL("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; |
+ } |
+ this->getClipMaskManager()->adjustPathStencilParams(outStencilSettings); |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
GrDrawTarget::AutoStateRestore::AutoStateRestore() { |