| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrDrawTarget.h" | 8 #include "GrDrawTarget.h" |
| 9 | 9 |
| 10 #include "GrAuditTrail.h" | 10 #include "GrAuditTrail.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 262 } |
| 263 | 263 |
| 264 #ifdef ENABLE_MDB | 264 #ifdef ENABLE_MDB |
| 265 SkASSERT(fRenderTarget); | 265 SkASSERT(fRenderTarget); |
| 266 batch->pipeline()->addDependenciesTo(fRenderTarget); | 266 batch->pipeline()->addDependenciesTo(fRenderTarget); |
| 267 #endif | 267 #endif |
| 268 | 268 |
| 269 this->recordBatch(batch); | 269 this->recordBatch(batch); |
| 270 } | 270 } |
| 271 | 271 |
| 272 static const GrStencilSettings& winding_path_stencil_settings() { | |
| 273 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, | |
| 274 kIncClamp_StencilOp, | |
| 275 kIncClamp_StencilOp, | |
| 276 kAlwaysIfInClip_StencilFunc, | |
| 277 0xFFFF, 0xFFFF, 0xFFFF); | |
| 278 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); | |
| 279 } | |
| 280 | |
| 281 static const GrStencilSettings& even_odd_path_stencil_settings() { | |
| 282 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, | |
| 283 kInvert_StencilOp, | |
| 284 kInvert_StencilOp, | |
| 285 kAlwaysIfInClip_StencilFunc, | |
| 286 0xFFFF, 0xFFFF, 0xFFFF); | |
| 287 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); | |
| 288 } | |
| 289 | |
| 290 void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType f
ill, | 272 void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType f
ill, |
| 291 const GrStencilAttachment*
sb, | 273 const GrStencilAttachment*
sb, |
| 292 GrStencilSettings* outStenc
ilSettings) { | 274 GrStencilSettings* outStenc
ilSettings) { |
| 275 static constexpr GrStencilSettings kWindingStencilSettings( |
| 276 kIncClamp_StencilOp, |
| 277 kIncClamp_StencilOp, |
| 278 kAlwaysIfInClip_StencilFunc, |
| 279 0xFFFF, 0xFFFF, 0xFFFF |
| 280 ); |
| 281 |
| 282 static constexpr GrStencilSettings kEvenODdStencilSettings( |
| 283 kInvert_StencilOp, |
| 284 kInvert_StencilOp, |
| 285 kAlwaysIfInClip_StencilFunc, |
| 286 0xFFFF, 0xFFFF, 0xFFFF |
| 287 ); |
| 293 | 288 |
| 294 switch (fill) { | 289 switch (fill) { |
| 295 default: | 290 default: |
| 296 SkFAIL("Unexpected path fill."); | 291 SkFAIL("Unexpected path fill."); |
| 297 case GrPathRendering::kWinding_FillType: | 292 case GrPathRendering::kWinding_FillType: |
| 298 *outStencilSettings = winding_path_stencil_settings(); | 293 *outStencilSettings = kWindingStencilSettings; |
| 299 break; | 294 break; |
| 300 case GrPathRendering::kEvenOdd_FillType: | 295 case GrPathRendering::kEvenOdd_FillType: |
| 301 *outStencilSettings = even_odd_path_stencil_settings(); | 296 *outStencilSettings = kEvenODdStencilSettings; |
| 302 break; | 297 break; |
| 303 } | 298 } |
| 304 fClipMaskManager->adjustPathStencilParams(sb, outStencilSettings); | 299 fClipMaskManager->adjustPathStencilParams(sb, outStencilSettings); |
| 305 } | 300 } |
| 306 | 301 |
| 307 void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder, | 302 void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder, |
| 308 const SkMatrix& viewMatrix, | 303 const SkMatrix& viewMatrix, |
| 309 const GrPath* path, | 304 const GrPath* path, |
| 310 GrPathRendering::FillType fill) { | 305 GrPathRendering::FillType fill) { |
| 311 // TODO: extract portions of checkDraw that are relevant to path stenciling. | 306 // TODO: extract portions of checkDraw that are relevant to path stenciling. |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 } | 593 } |
| 599 | 594 |
| 600 return true; | 595 return true; |
| 601 } | 596 } |
| 602 | 597 |
| 603 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 598 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
| 604 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 599 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
| 605 this->recordBatch(batch); | 600 this->recordBatch(batch); |
| 606 batch->unref(); | 601 batch->unref(); |
| 607 } | 602 } |
| OLD | NEW |