Chromium Code Reviews| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 4); | 293 4); |
| 294 } | 294 } |
| 295 | 295 |
| 296 return fQuadIndexBuffer; | 296 return fQuadIndexBuffer; |
| 297 } | 297 } |
| 298 | 298 |
| 299 //////////////////////////////////////////////////////////////////////////////// | 299 //////////////////////////////////////////////////////////////////////////////// |
| 300 | 300 |
| 301 bool GrGpu::setupClipAndFlushState(DrawType type, | 301 bool GrGpu::setupClipAndFlushState(DrawType type, |
| 302 const GrDeviceCoordTexture* dstCopy, | 302 const GrDeviceCoordTexture* dstCopy, |
| 303 GrDrawState::AutoRestoreEffects* are, | 303 const GrDrawTarget::DrawInfo& drawInfo, |
| 304 const SkRect* devBounds) { | 304 GrDrawState::AutoRestoreEffects* are) { |
| 305 GrDrawState::AutoRestoreStencil asr; | 305 DrawInfo modifiableDrawInfo = drawInfo; |
| 306 if (!fClipMaskManager.setupClipping(this->getClip(), are, &asr, devBounds)) { | 306 GrDrawState::AutoRestoreStencil arStencil; |
|
bsalomon
2014/10/27 19:41:23
Here it's arStencil, but the param is named asSten
| |
| 307 if (!fClipMaskManager.setupClipping(this->getClip(), | |
| 308 &modifiableDrawInfo, | |
| 309 are, | |
| 310 &arStencil)) { | |
| 307 return false; | 311 return false; |
| 308 } | 312 } |
| 309 | 313 |
| 310 if (!this->flushGraphicsState(type, dstCopy)) { | 314 if (!this->flushGraphicsState(modifiableDrawInfo, type, dstCopy)) { |
| 311 return false; | 315 return false; |
| 312 } | 316 } |
| 313 | 317 |
| 314 return true; | 318 return true; |
| 315 } | 319 } |
| 316 | 320 |
| 317 //////////////////////////////////////////////////////////////////////////////// | 321 //////////////////////////////////////////////////////////////////////////////// |
| 318 | 322 |
| 319 void GrGpu::geometrySourceWillPush() { | 323 void GrGpu::geometrySourceWillPush() { |
| 320 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 324 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 340 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) { | 344 void GrGpu::geometrySourceWillPop(const GeometrySrcState& restoredState) { |
| 341 // if popping last entry then pops are unbalanced with pushes | 345 // if popping last entry then pops are unbalanced with pushes |
| 342 SkASSERT(fGeomPoolStateStack.count() > 1); | 346 SkASSERT(fGeomPoolStateStack.count() > 1); |
| 343 fGeomPoolStateStack.pop_back(); | 347 fGeomPoolStateStack.pop_back(); |
| 344 } | 348 } |
| 345 | 349 |
| 346 void GrGpu::onDraw(const DrawInfo& info) { | 350 void GrGpu::onDraw(const DrawInfo& info) { |
| 347 this->handleDirtyContext(); | 351 this->handleDirtyContext(); |
| 348 GrDrawState::AutoRestoreEffects are; | 352 GrDrawState::AutoRestoreEffects are; |
| 349 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()), | 353 if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()), |
| 350 info.getDstCopy(), &are, info.getDevBounds ())) { | 354 info.getDstCopy(), |
|
bsalomon
2014/10/27 19:41:23
Need to pass dst copy separately when it's already
| |
| 355 info, | |
| 356 &are)) { | |
| 351 return; | 357 return; |
| 352 } | 358 } |
| 353 this->onGpuDraw(info); | 359 this->onGpuDraw(info); |
| 354 } | 360 } |
| 355 | 361 |
| 356 void GrGpu::onStencilPath(const GrPath* path, SkPath::FillType fill) { | 362 void GrGpu::onStencilPath(const GrPath* path, SkPath::FillType fill) { |
| 357 this->handleDirtyContext(); | 363 this->handleDirtyContext(); |
| 358 | 364 |
| 365 GrDrawTarget::DrawInfo drawInfo; | |
| 359 GrDrawState::AutoRestoreEffects are; | 366 GrDrawState::AutoRestoreEffects are; |
| 360 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are, NULL)) { | 367 if (!this->setupClipAndFlushState(kStencilPath_DrawType, |
| 368 NULL, | |
| 369 drawInfo, | |
| 370 &are)) { | |
| 361 return; | 371 return; |
| 362 } | 372 } |
| 363 | 373 |
| 364 this->pathRendering()->stencilPath(path, fill); | 374 this->pathRendering()->stencilPath(path, fill); |
| 365 } | 375 } |
| 366 | 376 |
| 367 | 377 |
| 368 void GrGpu::onDrawPath(const GrPath* path, SkPath::FillType fill, | 378 void GrGpu::onDrawPath(const GrPath* path, SkPath::FillType fill, |
| 369 const GrDeviceCoordTexture* dstCopy) { | 379 const GrDeviceCoordTexture* dstCopy) { |
| 370 this->handleDirtyContext(); | 380 this->handleDirtyContext(); |
| 371 | 381 |
| 372 drawState()->setDefaultVertexAttribs(); | 382 drawState()->setDefaultVertexAttribs(); |
| 373 | 383 |
| 384 GrDrawTarget::DrawInfo drawInfo; | |
|
bsalomon
2014/10/27 19:41:23
Eek
| |
| 374 GrDrawState::AutoRestoreEffects are; | 385 GrDrawState::AutoRestoreEffects are; |
| 375 if (!this->setupClipAndFlushState(kDrawPath_DrawType, dstCopy, &are, NULL)) { | 386 if (!this->setupClipAndFlushState(kDrawPath_DrawType, |
| 387 dstCopy, | |
| 388 drawInfo, | |
| 389 &are)) { | |
| 376 return; | 390 return; |
| 377 } | 391 } |
| 378 | 392 |
| 379 this->pathRendering()->drawPath(path, fill); | 393 this->pathRendering()->drawPath(path, fill); |
| 380 } | 394 } |
| 381 | 395 |
| 382 void GrGpu::onDrawPaths(const GrPathRange* pathRange, | 396 void GrGpu::onDrawPaths(const GrPathRange* pathRange, |
| 383 const uint32_t indices[], int count, | 397 const uint32_t indices[], int count, |
| 384 const float transforms[], PathTransformType transformsTy pe, | 398 const float transforms[], PathTransformType transformsTy pe, |
| 385 SkPath::FillType fill, const GrDeviceCoordTexture* dstCo py) { | 399 SkPath::FillType fill, const GrDeviceCoordTexture* dstCo py) { |
| 386 this->handleDirtyContext(); | 400 this->handleDirtyContext(); |
| 387 | 401 |
| 388 drawState()->setDefaultVertexAttribs(); | 402 drawState()->setDefaultVertexAttribs(); |
| 389 | 403 |
| 404 GrDrawTarget::DrawInfo drawInfo; | |
| 390 GrDrawState::AutoRestoreEffects are; | 405 GrDrawState::AutoRestoreEffects are; |
| 391 if (!this->setupClipAndFlushState(kDrawPaths_DrawType, dstCopy, &are, NULL)) { | 406 if (!this->setupClipAndFlushState(kDrawPaths_DrawType, |
| 407 dstCopy, | |
| 408 drawInfo, | |
| 409 &are)) { | |
| 392 return; | 410 return; |
| 393 } | 411 } |
| 394 | 412 |
| 395 pathRange->willDrawPaths(indices, count); | 413 pathRange->willDrawPaths(indices, count); |
| 396 this->pathRendering()->drawPaths(pathRange, indices, count, transforms, tran sformsType, fill); | 414 this->pathRendering()->drawPaths(pathRange, indices, count, transforms, tran sformsType, fill); |
| 397 } | 415 } |
| 398 | 416 |
| 399 void GrGpu::finalizeReservedVertices() { | 417 void GrGpu::finalizeReservedVertices() { |
| 400 SkASSERT(fVertexPool); | 418 SkASSERT(fVertexPool); |
| 401 fVertexPool->unmap(); | 419 fVertexPool->unmap(); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 526 } | 544 } |
| 527 | 545 |
| 528 void GrGpu::releaseIndexArray() { | 546 void GrGpu::releaseIndexArray() { |
| 529 // if index source was array, we stowed data in the pool | 547 // if index source was array, we stowed data in the pool |
| 530 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 548 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
| 531 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 549 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
| 532 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 550 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
| 533 fIndexPool->putBack(bytes); | 551 fIndexPool->putBack(bytes); |
| 534 --fIndexPoolUseCnt; | 552 --fIndexPoolUseCnt; |
| 535 } | 553 } |
| OLD | NEW |