| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 tex->unref(); | 111 tex->unref(); |
| 112 return NULL; | 112 return NULL; |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 return tex; | 116 return tex; |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { | 119 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { |
| 120 SkASSERT(NULL == rt->getStencilBuffer()); | 120 SkASSERT(NULL == rt->getStencilBuffer()); |
| 121 GrStencilBuffer* sb = | 121 SkAutoTUnref<GrStencilBuffer> sb( |
| 122 this->getContext()->findStencilBuffer(rt->width(), | 122 this->getContext()->findAndRefStencilBuffer(rt->width(), rt->height(), r
t->numSamples())); |
| 123 rt->height(), | |
| 124 rt->numSamples()); | |
| 125 if (sb) { | 123 if (sb) { |
| 126 rt->setStencilBuffer(sb); | 124 rt->setStencilBuffer(sb); |
| 127 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); | 125 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); |
| 128 if (!attached) { | 126 if (!attached) { |
| 129 rt->setStencilBuffer(NULL); | 127 rt->setStencilBuffer(NULL); |
| 130 } | 128 } |
| 131 return attached; | 129 return attached; |
| 132 } | 130 } |
| 133 if (this->createStencilBufferForRenderTarget(rt, | 131 if (this->createStencilBufferForRenderTarget(rt, rt->width(), rt->height()))
{ |
| 134 rt->width(), rt->height())) { | |
| 135 // Right now we're clearing the stencil buffer here after it is | 132 // Right now we're clearing the stencil buffer here after it is |
| 136 // attached to an RT for the first time. When we start matching | 133 // attached to an RT for the first time. When we start matching |
| 137 // stencil buffers with smaller color targets this will no longer | 134 // stencil buffers with smaller color targets this will no longer |
| 138 // be correct because it won't be guaranteed to clear the entire | 135 // be correct because it won't be guaranteed to clear the entire |
| 139 // sb. | 136 // sb. |
| 140 // We used to clear down in the GL subclass using a special purpose | 137 // We used to clear down in the GL subclass using a special purpose |
| 141 // FBO. But iOS doesn't allow a stencil-only FBO. It reports unsupported | 138 // FBO. But iOS doesn't allow a stencil-only FBO. It reports unsupported |
| 142 // FBO status. | 139 // FBO status. |
| 143 this->clearStencil(rt); | 140 this->clearStencil(rt); |
| 144 return true; | 141 return true; |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 | 607 |
| 611 void GrGpu::releaseGeometry() { | 608 void GrGpu::releaseGeometry() { |
| 612 int popCnt = fGeoSrcStateStack.count() - 1; | 609 int popCnt = fGeoSrcStateStack.count() - 1; |
| 613 while (popCnt) { | 610 while (popCnt) { |
| 614 this->popGeometrySource(); | 611 this->popGeometrySource(); |
| 615 --popCnt; | 612 --popCnt; |
| 616 } | 613 } |
| 617 this->resetVertexSource(); | 614 this->resetVertexSource(); |
| 618 this->resetIndexSource(); | 615 this->resetIndexSource(); |
| 619 } | 616 } |
| OLD | NEW |