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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (this->createStencilBufferForRenderTarget(rt, | 118 if (this->createStencilBufferForRenderTarget(rt, |
119 rt->width(), rt->height())) { | 119 rt->width(), rt->height())) { |
120 // Right now we're clearing the stencil buffer here after it is | 120 // Right now we're clearing the stencil buffer here after it is |
121 // attached to an RT for the first time. When we start matching | 121 // attached to an RT for the first time. When we start matching |
122 // stencil buffers with smaller color targets this will no longer | 122 // stencil buffers with smaller color targets this will no longer |
123 // be correct because it won't be guaranteed to clear the entire | 123 // be correct because it won't be guaranteed to clear the entire |
124 // sb. | 124 // sb. |
125 // We used to clear down in the GL subclass using a special purpose | 125 // We used to clear down in the GL subclass using a special purpose |
126 // FBO. But iOS doesn't allow a stencil-only FBO. It reports unsupported | 126 // FBO. But iOS doesn't allow a stencil-only FBO. It reports unsupported |
127 // FBO status. | 127 // FBO status. |
128 GrDrawState::AutoRenderTargetRestore artr(this->drawState(), rt); | 128 this->clearStencil(rt); |
129 this->clearStencil(); | |
130 return true; | 129 return true; |
131 } else { | 130 } else { |
132 return false; | 131 return false; |
133 } | 132 } |
134 } | 133 } |
135 | 134 |
136 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc) { | 135 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc) { |
137 this->handleDirtyContext(); | 136 this->handleDirtyContext(); |
138 GrTexture* tex = this->onWrapBackendTexture(desc); | 137 GrTexture* tex = this->onWrapBackendTexture(desc); |
139 if (NULL == tex) { | 138 if (NULL == tex) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 172 |
174 GrPathRange* GrGpu::createPathRange(size_t size, const SkStrokeRec& stroke) { | 173 GrPathRange* GrGpu::createPathRange(size_t size, const SkStrokeRec& stroke) { |
175 this->handleDirtyContext(); | 174 this->handleDirtyContext(); |
176 return this->pathRendering()->createPathRange(size, stroke); | 175 return this->pathRendering()->createPathRange(size, stroke); |
177 } | 176 } |
178 | 177 |
179 void GrGpu::clear(const SkIRect* rect, | 178 void GrGpu::clear(const SkIRect* rect, |
180 GrColor color, | 179 GrColor color, |
181 bool canIgnoreRect, | 180 bool canIgnoreRect, |
182 GrRenderTarget* renderTarget) { | 181 GrRenderTarget* renderTarget) { |
183 GrDrawState::AutoRenderTargetRestore art; | 182 if (NULL == renderTarget) { |
184 if (NULL != renderTarget) { | 183 renderTarget = this->getDrawState().getRenderTarget(); |
185 art.set(this->drawState(), renderTarget); | |
186 } | 184 } |
187 if (NULL == this->getDrawState().getRenderTarget()) { | 185 if (NULL == renderTarget) { |
188 SkASSERT(0); | 186 SkASSERT(0); |
189 return; | 187 return; |
190 } | 188 } |
191 this->handleDirtyContext(); | 189 this->handleDirtyContext(); |
192 this->onClear(rect, color, canIgnoreRect); | 190 this->onClear(renderTarget, rect, color, canIgnoreRect); |
193 } | 191 } |
194 | 192 |
195 bool GrGpu::readPixels(GrRenderTarget* target, | 193 bool GrGpu::readPixels(GrRenderTarget* target, |
196 int left, int top, int width, int height, | 194 int left, int top, int width, int height, |
197 GrPixelConfig config, void* buffer, | 195 GrPixelConfig config, void* buffer, |
198 size_t rowBytes) { | 196 size_t rowBytes) { |
199 this->handleDirtyContext(); | 197 this->handleDirtyContext(); |
200 return this->onReadPixels(target, left, top, width, height, | 198 return this->onReadPixels(target, left, top, width, height, |
201 config, buffer, rowBytes); | 199 config, buffer, rowBytes); |
202 } | 200 } |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 522 } |
525 | 523 |
526 void GrGpu::releaseIndexArray() { | 524 void GrGpu::releaseIndexArray() { |
527 // if index source was array, we stowed data in the pool | 525 // if index source was array, we stowed data in the pool |
528 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 526 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
529 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 527 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
530 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 528 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
531 fIndexPool->putBack(bytes); | 529 fIndexPool->putBack(bytes); |
532 --fIndexPoolUseCnt; | 530 --fIndexPoolUseCnt; |
533 } | 531 } |
OLD | NEW |