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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 GrFree(indices); | 285 GrFree(indices); |
286 } | 286 } |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 return fQuadIndexBuffer; | 290 return fQuadIndexBuffer; |
291 } | 291 } |
292 | 292 |
293 //////////////////////////////////////////////////////////////////////////////// | 293 //////////////////////////////////////////////////////////////////////////////// |
294 | 294 |
295 bool GrGpu::setupClipAndFlushState(DrawType type, const GrDeviceCoordTexture* ds
tCopy) { | 295 bool GrGpu::setupClipAndFlushState(DrawType type, const GrDeviceCoordTexture* ds
tCopy, |
296 | 296 GrDrawState::AutoRestoreEffects* are) { |
297 if (!fClipMaskManager.setupClipping(this->getClip())) { | 297 if (!fClipMaskManager.setupClipping(this->getClip(), are)) { |
298 return false; | 298 return false; |
299 } | 299 } |
300 | 300 |
301 if (!this->flushGraphicsState(type, dstCopy)) { | 301 if (!this->flushGraphicsState(type, dstCopy)) { |
302 return false; | 302 return false; |
303 } | 303 } |
304 | 304 |
305 return true; | 305 return true; |
306 } | 306 } |
307 | 307 |
(...skipping 21 matching lines...) Expand all Loading... |
329 } | 329 } |
330 | 330 |
331 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) { | 331 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) { |
332 // if popping last entry then pops are unbalanced with pushes | 332 // if popping last entry then pops are unbalanced with pushes |
333 GrAssert(fGeomPoolStateStack.count() > 1); | 333 GrAssert(fGeomPoolStateStack.count() > 1); |
334 fGeomPoolStateStack.pop_back(); | 334 fGeomPoolStateStack.pop_back(); |
335 } | 335 } |
336 | 336 |
337 void GrGpu::onDraw(const DrawInfo& info) { | 337 void GrGpu::onDraw(const DrawInfo& info) { |
338 this->handleDirtyContext(); | 338 this->handleDirtyContext(); |
| 339 GrDrawState::AutoRestoreEffects are; |
339 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()), | 340 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()), |
340 info.getDstCopy())) { | 341 info.getDstCopy(), |
| 342 &are)) { |
341 return; | 343 return; |
342 } | 344 } |
343 this->onGpuDraw(info); | 345 this->onGpuDraw(info); |
344 } | 346 } |
345 | 347 |
346 void GrGpu::onStencilPath(const GrPath* path, const SkStrokeRec&, SkPath::FillTy
pe fill) { | 348 void GrGpu::onStencilPath(const GrPath* path, const SkStrokeRec&, SkPath::FillTy
pe fill) { |
347 this->handleDirtyContext(); | 349 this->handleDirtyContext(); |
348 | 350 |
349 // TODO: make this more efficient (don't copy and copy back) | 351 // TODO: make this more efficient (don't copy and copy back) |
350 GrAutoTRestore<GrStencilSettings> asr(this->drawState()->stencil()); | 352 GrAutoTRestore<GrStencilSettings> asr(this->drawState()->stencil()); |
351 | 353 |
352 this->setStencilPathSettings(*path, fill, this->drawState()->stencil()); | 354 this->setStencilPathSettings(*path, fill, this->drawState()->stencil()); |
353 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL)) { | 355 GrDrawState::AutoRestoreEffects are; |
| 356 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are)) { |
354 return; | 357 return; |
355 } | 358 } |
356 | 359 |
357 this->onGpuStencilPath(path, fill); | 360 this->onGpuStencilPath(path, fill); |
358 } | 361 } |
359 | 362 |
360 void GrGpu::finalizeReservedVertices() { | 363 void GrGpu::finalizeReservedVertices() { |
361 GrAssert(NULL != fVertexPool); | 364 GrAssert(NULL != fVertexPool); |
362 fVertexPool->unlock(); | 365 fVertexPool->unlock(); |
363 } | 366 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 } | 490 } |
488 | 491 |
489 void GrGpu::releaseIndexArray() { | 492 void GrGpu::releaseIndexArray() { |
490 // if index source was array, we stowed data in the pool | 493 // if index source was array, we stowed data in the pool |
491 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 494 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
492 GrAssert(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 495 GrAssert(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
493 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 496 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
494 fIndexPool->putBack(bytes); | 497 fIndexPool->putBack(bytes); |
495 --fIndexPoolUseCnt; | 498 --fIndexPoolUseCnt; |
496 } | 499 } |
OLD | NEW |