| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 } | 326 } |
| 327 | 327 |
| 328 return fQuadIndexBuffer; | 328 return fQuadIndexBuffer; |
| 329 } | 329 } |
| 330 | 330 |
| 331 //////////////////////////////////////////////////////////////////////////////// | 331 //////////////////////////////////////////////////////////////////////////////// |
| 332 | 332 |
| 333 bool GrGpu::setupClipAndFlushState(DrawType type, const GrDeviceCoordTexture* ds
tCopy, | 333 bool GrGpu::setupClipAndFlushState(DrawType type, const GrDeviceCoordTexture* ds
tCopy, |
| 334 GrDrawState::AutoRestoreEffects* are) { | 334 GrDrawState::AutoRestoreEffects* are, |
| 335 if (!fClipMaskManager.setupClipping(this->getClip(), are)) { | 335 const SkRect* devBounds) { |
| 336 if (!fClipMaskManager.setupClipping(this->getClip(), are, devBounds)) { |
| 336 return false; | 337 return false; |
| 337 } | 338 } |
| 338 | 339 |
| 339 if (!this->flushGraphicsState(type, dstCopy)) { | 340 if (!this->flushGraphicsState(type, dstCopy)) { |
| 340 return false; | 341 return false; |
| 341 } | 342 } |
| 342 | 343 |
| 343 return true; | 344 return true; |
| 344 } | 345 } |
| 345 | 346 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 369 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) { | 370 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) { |
| 370 // if popping last entry then pops are unbalanced with pushes | 371 // if popping last entry then pops are unbalanced with pushes |
| 371 SkASSERT(fGeomPoolStateStack.count() > 1); | 372 SkASSERT(fGeomPoolStateStack.count() > 1); |
| 372 fGeomPoolStateStack.pop_back(); | 373 fGeomPoolStateStack.pop_back(); |
| 373 } | 374 } |
| 374 | 375 |
| 375 void GrGpu::onDraw(const DrawInfo& info) { | 376 void GrGpu::onDraw(const DrawInfo& info) { |
| 376 this->handleDirtyContext(); | 377 this->handleDirtyContext(); |
| 377 GrDrawState::AutoRestoreEffects are; | 378 GrDrawState::AutoRestoreEffects are; |
| 378 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()), | 379 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()), |
| 379 info.getDstCopy(), | 380 info.getDstCopy(), &are, info.getDevBounds
())) { |
| 380 &are)) { | |
| 381 return; | 381 return; |
| 382 } | 382 } |
| 383 this->onGpuDraw(info); | 383 this->onGpuDraw(info); |
| 384 } | 384 } |
| 385 | 385 |
| 386 void GrGpu::onStencilPath(const GrPath* path, SkPath::FillType fill) { | 386 void GrGpu::onStencilPath(const GrPath* path, SkPath::FillType fill) { |
| 387 this->handleDirtyContext(); | 387 this->handleDirtyContext(); |
| 388 | 388 |
| 389 GrDrawState::AutoRestoreEffects are; | 389 GrDrawState::AutoRestoreEffects are; |
| 390 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are)) { | 390 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are, NULL))
{ |
| 391 return; | 391 return; |
| 392 } | 392 } |
| 393 | 393 |
| 394 this->onGpuStencilPath(path, fill); | 394 this->onGpuStencilPath(path, fill); |
| 395 } | 395 } |
| 396 | 396 |
| 397 | 397 |
| 398 void GrGpu::onDrawPath(const GrPath* path, SkPath::FillType fill, | 398 void GrGpu::onDrawPath(const GrPath* path, SkPath::FillType fill, |
| 399 const GrDeviceCoordTexture* dstCopy) { | 399 const GrDeviceCoordTexture* dstCopy) { |
| 400 this->handleDirtyContext(); | 400 this->handleDirtyContext(); |
| 401 | 401 |
| 402 drawState()->setDefaultVertexAttribs(); | 402 drawState()->setDefaultVertexAttribs(); |
| 403 | 403 |
| 404 GrDrawState::AutoRestoreEffects are; | 404 GrDrawState::AutoRestoreEffects are; |
| 405 if (!this->setupClipAndFlushState(kDrawPath_DrawType, dstCopy, &are)) { | 405 if (!this->setupClipAndFlushState(kDrawPath_DrawType, dstCopy, &are, NULL))
{ |
| 406 return; | 406 return; |
| 407 } | 407 } |
| 408 | 408 |
| 409 this->onGpuDrawPath(path, fill); | 409 this->onGpuDrawPath(path, fill); |
| 410 } | 410 } |
| 411 | 411 |
| 412 void GrGpu::finalizeReservedVertices() { | 412 void GrGpu::finalizeReservedVertices() { |
| 413 SkASSERT(NULL != fVertexPool); | 413 SkASSERT(NULL != fVertexPool); |
| 414 fVertexPool->unlock(); | 414 fVertexPool->unlock(); |
| 415 } | 415 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 } | 539 } |
| 540 | 540 |
| 541 void GrGpu::releaseIndexArray() { | 541 void GrGpu::releaseIndexArray() { |
| 542 // if index source was array, we stowed data in the pool | 542 // if index source was array, we stowed data in the pool |
| 543 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 543 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
| 544 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 544 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
| 545 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 545 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
| 546 fIndexPool->putBack(bytes); | 546 fIndexPool->putBack(bytes); |
| 547 --fIndexPoolUseCnt; | 547 --fIndexPoolUseCnt; |
| 548 } | 548 } |
| OLD | NEW |