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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 tex->unref(); | 77 tex->unref(); |
78 return NULL; | 78 return NULL; |
79 } | 79 } |
80 } | 80 } |
81 } | 81 } |
82 return tex; | 82 return tex; |
83 } | 83 } |
84 | 84 |
85 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { | 85 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { |
86 SkASSERT(NULL == rt->getStencilBuffer()); | 86 SkASSERT(NULL == rt->getStencilBuffer()); |
87 GrStencilBuffer* sb = | 87 SkAutoTUnref<GrStencilBuffer> sb( |
88 this->getContext()->findStencilBuffer(rt->width(), | 88 this->getContext()->findAndRefStencilBuffer(rt->width(), rt->height(), r
t->numSamples())); |
89 rt->height(), | |
90 rt->numSamples()); | |
91 if (sb) { | 89 if (sb) { |
92 rt->setStencilBuffer(sb); | 90 rt->setStencilBuffer(sb); |
93 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); | 91 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); |
94 if (!attached) { | 92 if (!attached) { |
95 rt->setStencilBuffer(NULL); | 93 rt->setStencilBuffer(NULL); |
96 } | 94 } |
97 return attached; | 95 return attached; |
98 } | 96 } |
99 if (this->createStencilBufferForRenderTarget(rt, | 97 if (this->createStencilBufferForRenderTarget(rt, rt->width(), rt->height()))
{ |
100 rt->width(), rt->height())) { | |
101 // Right now we're clearing the stencil buffer here after it is | 98 // 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 | 99 // attached to an RT for the first time. When we start matching |
103 // stencil buffers with smaller color targets this will no longer | 100 // stencil buffers with smaller color targets this will no longer |
104 // be correct because it won't be guaranteed to clear the entire | 101 // be correct because it won't be guaranteed to clear the entire |
105 // sb. | 102 // sb. |
106 // We used to clear down in the GL subclass using a special purpose | 103 // 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 | 104 // FBO. But iOS doesn't allow a stencil-only FBO. It reports unsupported |
108 // FBO status. | 105 // FBO status. |
109 this->clearStencil(rt); | 106 this->clearStencil(rt); |
110 return true; | 107 return true; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 this->handleDirtyContext(); | 368 this->handleDirtyContext(); |
372 | 369 |
373 if (!this->flushGraphicsState(kDrawPaths_DrawType, scissorState, dstCopy)) { | 370 if (!this->flushGraphicsState(kDrawPaths_DrawType, scissorState, dstCopy)) { |
374 return; | 371 return; |
375 } | 372 } |
376 | 373 |
377 pathRange->willDrawPaths(indices, count); | 374 pathRange->willDrawPaths(indices, count); |
378 this->pathRendering()->drawPaths(pathRange, indices, count, transforms, tran
sformsType, | 375 this->pathRendering()->drawPaths(pathRange, indices, count, transforms, tran
sformsType, |
379 stencilSettings); | 376 stencilSettings); |
380 } | 377 } |
OLD | NEW |