| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrClipMaskManager.h" | 9 #include "GrClipMaskManager.h" |
| 10 #include "GrAAConvexPathRenderer.h" | 10 #include "GrAAConvexPathRenderer.h" |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 | 1005 |
| 1006 //////////////////////////////////////////////////////////////////////////////// | 1006 //////////////////////////////////////////////////////////////////////////////// |
| 1007 void GrClipMaskManager::releaseResources() { | 1007 void GrClipMaskManager::releaseResources() { |
| 1008 fAACache.releaseResources(); | 1008 fAACache.releaseResources(); |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 void GrClipMaskManager::setGpu(GrGpu* gpu) { | 1011 void GrClipMaskManager::setGpu(GrGpu* gpu) { |
| 1012 fGpu = gpu; | 1012 fGpu = gpu; |
| 1013 fAACache.setContext(gpu->getContext()); | 1013 fAACache.setContext(gpu->getContext()); |
| 1014 } | 1014 } |
| 1015 |
| 1016 void GrClipMaskManager::adjustPathStencilParams(GrStencilSettings* settings) { |
| 1017 const GrDrawState& drawState = fGpu->getDrawState(); |
| 1018 GrClipMaskManager::StencilClipMode clipMode; |
| 1019 if (this->isClipInStencil() && drawState.isClipState()) { |
| 1020 clipMode = GrClipMaskManager::kRespectClip_StencilClipMode; |
| 1021 // We can't be modifying the clip and respecting it at the same time. |
| 1022 SkASSERT(!drawState.isStateFlagEnabled( |
| 1023 GrGpu::kModifyStencilClip_StateBit)); |
| 1024 } else if (drawState.isStateFlagEnabled( |
| 1025 GrGpu::kModifyStencilClip_StateBit)) { |
| 1026 clipMode = GrClipMaskManager::kModifyClip_StencilClipMode; |
| 1027 } else { |
| 1028 clipMode = GrClipMaskManager::kIgnoreClip_StencilClipMode; |
| 1029 } |
| 1030 |
| 1031 // TODO: dynamically attach a stencil buffer |
| 1032 int stencilBits = 0; |
| 1033 GrStencilBuffer* stencilBuffer = |
| 1034 drawState.getRenderTarget()->getStencilBuffer(); |
| 1035 if (NULL != stencilBuffer) { |
| 1036 stencilBits = stencilBuffer->bits(); |
| 1037 this->adjustStencilParams(settings, clipMode, stencilBits); |
| 1038 } |
| 1039 } |
| 1040 |
| OLD | NEW |