| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 | 209 |
| 210 GrIndexBuffer* GrGpu::createIndexBuffer(size_t size, bool dynamic) { | 210 GrIndexBuffer* GrGpu::createIndexBuffer(size_t size, bool dynamic) { |
| 211 this->handleDirtyContext(); | 211 this->handleDirtyContext(); |
| 212 return this->onCreateIndexBuffer(size, dynamic); | 212 return this->onCreateIndexBuffer(size, dynamic); |
| 213 } | 213 } |
| 214 | 214 |
| 215 GrPath* GrGpu::createPath(const SkPath& path, const SkStrokeRec& stroke) { | 215 GrPath* GrGpu::createPath(const SkPath& path, const SkStrokeRec& stroke) { |
| 216 SkASSERT(this->caps()->pathRenderingSupport()); | 216 SkASSERT(this->caps()->pathRenderingSupport()); |
| 217 this->handleDirtyContext(); | 217 this->handleDirtyContext(); |
| 218 return this->onCreatePath(path, stroke); | 218 return this->pathRendering()->createPath(path, stroke); |
| 219 } | 219 } |
| 220 | 220 |
| 221 GrPathRange* GrGpu::createPathRange(size_t size, const SkStrokeRec& stroke) { | 221 GrPathRange* GrGpu::createPathRange(size_t size, const SkStrokeRec& stroke) { |
| 222 SkASSERT(this->caps()->pathRenderingSupport()); | |
| 223 this->handleDirtyContext(); | 222 this->handleDirtyContext(); |
| 224 return this->onCreatePathRange(size, stroke); | 223 return this->pathRendering()->createPathRange(size, stroke); |
| 225 } | 224 } |
| 226 | 225 |
| 227 void GrGpu::clear(const SkIRect* rect, | 226 void GrGpu::clear(const SkIRect* rect, |
| 228 GrColor color, | 227 GrColor color, |
| 229 bool canIgnoreRect, | 228 bool canIgnoreRect, |
| 230 GrRenderTarget* renderTarget) { | 229 GrRenderTarget* renderTarget) { |
| 231 GrDrawState::AutoRenderTargetRestore art; | 230 GrDrawState::AutoRenderTargetRestore art; |
| 232 if (NULL != renderTarget) { | 231 if (NULL != renderTarget) { |
| 233 art.set(this->drawState(), renderTarget); | 232 art.set(this->drawState(), renderTarget); |
| 234 } | 233 } |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } | 399 } |
| 401 | 400 |
| 402 void GrGpu::onStencilPath(const GrPath* path, SkPath::FillType fill) { | 401 void GrGpu::onStencilPath(const GrPath* path, SkPath::FillType fill) { |
| 403 this->handleDirtyContext(); | 402 this->handleDirtyContext(); |
| 404 | 403 |
| 405 GrDrawState::AutoRestoreEffects are; | 404 GrDrawState::AutoRestoreEffects are; |
| 406 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are, NULL))
{ | 405 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are, NULL))
{ |
| 407 return; | 406 return; |
| 408 } | 407 } |
| 409 | 408 |
| 410 this->onGpuStencilPath(path, fill); | 409 this->pathRendering()->stencilPath(path, fill); |
| 411 } | 410 } |
| 412 | 411 |
| 413 | 412 |
| 414 void GrGpu::onDrawPath(const GrPath* path, SkPath::FillType fill, | 413 void GrGpu::onDrawPath(const GrPath* path, SkPath::FillType fill, |
| 415 const GrDeviceCoordTexture* dstCopy) { | 414 const GrDeviceCoordTexture* dstCopy) { |
| 416 this->handleDirtyContext(); | 415 this->handleDirtyContext(); |
| 417 | 416 |
| 418 drawState()->setDefaultVertexAttribs(); | 417 drawState()->setDefaultVertexAttribs(); |
| 419 | 418 |
| 420 GrDrawState::AutoRestoreEffects are; | 419 GrDrawState::AutoRestoreEffects are; |
| 421 if (!this->setupClipAndFlushState(kDrawPath_DrawType, dstCopy, &are, NULL))
{ | 420 if (!this->setupClipAndFlushState(kDrawPath_DrawType, dstCopy, &are, NULL))
{ |
| 422 return; | 421 return; |
| 423 } | 422 } |
| 424 | 423 |
| 425 this->onGpuDrawPath(path, fill); | 424 this->pathRendering()->drawPath(path, fill); |
| 426 } | 425 } |
| 427 | 426 |
| 428 void GrGpu::onDrawPaths(const GrPathRange* pathRange, | 427 void GrGpu::onDrawPaths(const GrPathRange* pathRange, |
| 429 const uint32_t indices[], int count, | 428 const uint32_t indices[], int count, |
| 430 const float transforms[], PathTransformType transformsTy
pe, | 429 const float transforms[], PathTransformType transformsTy
pe, |
| 431 SkPath::FillType fill, const GrDeviceCoordTexture* dstCo
py) { | 430 SkPath::FillType fill, const GrDeviceCoordTexture* dstCo
py) { |
| 432 this->handleDirtyContext(); | 431 this->handleDirtyContext(); |
| 433 | 432 |
| 434 drawState()->setDefaultVertexAttribs(); | 433 drawState()->setDefaultVertexAttribs(); |
| 435 | 434 |
| 436 GrDrawState::AutoRestoreEffects are; | 435 GrDrawState::AutoRestoreEffects are; |
| 437 if (!this->setupClipAndFlushState(kDrawPaths_DrawType, dstCopy, &are, NULL))
{ | 436 if (!this->setupClipAndFlushState(kDrawPaths_DrawType, dstCopy, &are, NULL))
{ |
| 438 return; | 437 return; |
| 439 } | 438 } |
| 440 | 439 |
| 441 this->onGpuDrawPaths(pathRange, indices, count, transforms, transformsType,
fill); | 440 this->pathRendering()->drawPaths(pathRange, indices, count, transforms, tran
sformsType, fill); |
| 442 } | 441 } |
| 443 | 442 |
| 444 void GrGpu::finalizeReservedVertices() { | 443 void GrGpu::finalizeReservedVertices() { |
| 445 SkASSERT(NULL != fVertexPool); | 444 SkASSERT(NULL != fVertexPool); |
| 446 fVertexPool->unmap(); | 445 fVertexPool->unmap(); |
| 447 } | 446 } |
| 448 | 447 |
| 449 void GrGpu::finalizeReservedIndices() { | 448 void GrGpu::finalizeReservedIndices() { |
| 450 SkASSERT(NULL != fIndexPool); | 449 SkASSERT(NULL != fIndexPool); |
| 451 fIndexPool->unmap(); | 450 fIndexPool->unmap(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 } | 570 } |
| 572 | 571 |
| 573 void GrGpu::releaseIndexArray() { | 572 void GrGpu::releaseIndexArray() { |
| 574 // if index source was array, we stowed data in the pool | 573 // if index source was array, we stowed data in the pool |
| 575 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 574 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
| 576 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 575 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
| 577 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 576 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
| 578 fIndexPool->putBack(bytes); | 577 fIndexPool->putBack(bytes); |
| 579 --fIndexPoolUseCnt; | 578 --fIndexPoolUseCnt; |
| 580 } | 579 } |
| OLD | NEW |