OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 | 9 |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 SkAutoTUnref<GrStencilBuffer> sb(static_cast<GrStencilBuffer*>( | 91 SkAutoTUnref<GrStencilBuffer> sb(static_cast<GrStencilBuffer*>( |
92 this->getContext()->getResourceCache()->findAndRefUniqueResource(sbKey))
); | 92 this->getContext()->getResourceCache()->findAndRefUniqueResource(sbKey))
); |
93 if (sb) { | 93 if (sb) { |
94 if (this->attachStencilBufferToRenderTarget(sb, rt)) { | 94 if (this->attachStencilBufferToRenderTarget(sb, rt)) { |
95 rt->renderTargetPriv().didAttachStencilBuffer(sb); | 95 rt->renderTargetPriv().didAttachStencilBuffer(sb); |
96 return true; | 96 return true; |
97 } | 97 } |
98 return false; | 98 return false; |
99 } | 99 } |
100 if (this->createStencilBufferForRenderTarget(rt, width, height)) { | 100 if (this->createStencilBufferForRenderTarget(rt, width, height)) { |
| 101 // Right now we're clearing the stencil buffer here after it is |
| 102 // attached to an RT for the first time. When we start matching |
| 103 // stencil buffers with smaller color targets this will no longer |
| 104 // be correct because it won't be guaranteed to clear the entire |
| 105 // sb. |
| 106 // We used to clear down in the GL subclass using a special purpose |
| 107 // FBO. But iOS doesn't allow a stencil-only FBO. It reports unsupported |
| 108 // FBO status. |
| 109 this->clearStencil(rt); |
101 GrStencilBuffer* sb = rt->renderTargetPriv().getStencilBuffer(); | 110 GrStencilBuffer* sb = rt->renderTargetPriv().getStencilBuffer(); |
102 sb->resourcePriv().setUniqueKey(sbKey); | 111 sb->resourcePriv().setUniqueKey(sbKey); |
103 return true; | 112 return true; |
104 } else { | 113 } else { |
105 return false; | 114 return false; |
106 } | 115 } |
107 } | 116 } |
108 | 117 |
109 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc) { | 118 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc) { |
110 this->handleDirtyContext(); | 119 this->handleDirtyContext(); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 GrDrawTarget::PathIndexType indexType, | 313 GrDrawTarget::PathIndexType indexType, |
305 const float transformValues[], | 314 const float transformValues[], |
306 GrDrawTarget::PathTransformType transformType, | 315 GrDrawTarget::PathTransformType transformType, |
307 int count, | 316 int count, |
308 const GrStencilSettings& stencilSettings) { | 317 const GrStencilSettings& stencilSettings) { |
309 this->handleDirtyContext(); | 318 this->handleDirtyContext(); |
310 pathRange->willDrawPaths(indices, indexType, count); | 319 pathRange->willDrawPaths(indices, indexType, count); |
311 this->onDrawPaths(args, pathRange, indices, indexType, transformValues, | 320 this->onDrawPaths(args, pathRange, indices, indexType, transformValues, |
312 transformType, count, stencilSettings); | 321 transformType, count, stencilSettings); |
313 } | 322 } |
OLD | NEW |