| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
| 9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
| 10 | 10 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 return kDrawPoints_DrawType; | 322 return kDrawPoints_DrawType; |
| 323 case kLines_GrPrimitiveType: | 323 case kLines_GrPrimitiveType: |
| 324 case kLineStrip_GrPrimitiveType: | 324 case kLineStrip_GrPrimitiveType: |
| 325 return kDrawLines_DrawType; | 325 return kDrawLines_DrawType; |
| 326 default: | 326 default: |
| 327 SkFAIL("Unexpected primitive type"); | 327 SkFAIL("Unexpected primitive type"); |
| 328 return kDrawTriangles_DrawType; | 328 return kDrawTriangles_DrawType; |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 // prepares clip flushes gpu state before a draw | |
| 333 bool setupClipAndFlushState(DrawType, | |
| 334 const GrDeviceCoordTexture* dstCopy, | |
| 335 const SkRect* devBounds, | |
| 336 GrDrawState::AutoRestoreEffects*, | |
| 337 GrDrawState::AutoRestoreStencil*); | |
| 338 | |
| 339 // Functions used to map clip-respecting stencil tests into normal | 332 // Functions used to map clip-respecting stencil tests into normal |
| 340 // stencil funcs supported by GPUs. | 333 // stencil funcs supported by GPUs. |
| 341 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, | 334 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
| 342 GrStencilFunc func); | 335 GrStencilFunc func); |
| 343 static void ConvertStencilFuncAndMask(GrStencilFunc func, | 336 static void ConvertStencilFuncAndMask(GrStencilFunc func, |
| 344 bool clipInStencil, | 337 bool clipInStencil, |
| 345 unsigned int clipBit, | 338 unsigned int clipBit, |
| 346 unsigned int userBits, | 339 unsigned int userBits, |
| 347 unsigned int* ref, | 340 unsigned int* ref, |
| 348 unsigned int* mask); | 341 unsigned int* mask); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 const GrClipMaskManager::ScissorState&, | 436 const GrClipMaskManager::ScissorState&, |
| 444 const GrDeviceCoordTexture* dstCopy) = 0; | 437 const GrDeviceCoordTexture* dstCopy) = 0; |
| 445 | 438 |
| 446 // clears target's entire stencil buffer to 0 | 439 // clears target's entire stencil buffer to 0 |
| 447 virtual void clearStencil(GrRenderTarget* target) = 0; | 440 virtual void clearStencil(GrRenderTarget* target) = 0; |
| 448 | 441 |
| 449 // Given a rt, find or create a stencil buffer and attach it | 442 // Given a rt, find or create a stencil buffer and attach it |
| 450 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); | 443 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
| 451 | 444 |
| 452 // GrDrawTarget overrides | 445 // GrDrawTarget overrides |
| 453 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; | 446 virtual void onDraw(const DrawInfo&, const GrClipMaskManager::ScissorState&)
SK_OVERRIDE; |
| 454 virtual void onStencilPath(const GrPath*, GrPathRendering::FillType) SK_OVER
RIDE; | 447 virtual void onStencilPath(const GrPath*, |
| 455 virtual void onDrawPath(const GrPath*, GrPathRendering::FillType, | 448 const GrClipMaskManager::ScissorState&, |
| 449 const GrStencilSettings&) SK_OVERRIDE; |
| 450 virtual void onDrawPath(const GrPath*, |
| 451 const GrClipMaskManager::ScissorState&, |
| 452 const GrStencilSettings&, |
| 456 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 453 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| 457 virtual void onDrawPaths(const GrPathRange*, | 454 virtual void onDrawPaths(const GrPathRange*, |
| 458 const uint32_t indices[], int count, | 455 const uint32_t indices[], |
| 459 const float transforms[], PathTransformType, | 456 int count, |
| 460 GrPathRendering::FillType, const GrDeviceCoordTextu
re*) SK_OVERRIDE; | 457 const float transforms[], |
| 458 PathTransformType, |
| 459 const GrClipMaskManager::ScissorState&, |
| 460 const GrStencilSettings&, |
| 461 const GrDeviceCoordTexture*) SK_OVERRIDE; |
| 461 | 462 |
| 462 // readies the pools to provide vertex/index data. | 463 // readies the pools to provide vertex/index data. |
| 463 void prepareVertexPool(); | 464 void prepareVertexPool(); |
| 464 void prepareIndexPool(); | 465 void prepareIndexPool(); |
| 465 | 466 |
| 466 void resetContext() { | 467 void resetContext() { |
| 467 this->onResetContext(fResetBits); | 468 this->onResetContext(fResetBits); |
| 468 fResetBits = 0; | 469 fResetBits = 0; |
| 469 ++fResetTimestamp; | 470 ++fResetTimestamp; |
| 470 } | 471 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 486 // counts number of uses of vertex/index pool in the geometry stack | 487 // counts number of uses of vertex/index pool in the geometry stack |
| 487 int fVertexP
oolUseCnt; | 488 int fVertexP
oolUseCnt; |
| 488 int fIndexPo
olUseCnt; | 489 int fIndexPo
olUseCnt; |
| 489 // these are mutable so they can be created on-demand | 490 // these are mutable so they can be created on-demand |
| 490 mutable GrIndexBuffer* fQuadInd
exBuffer; | 491 mutable GrIndexBuffer* fQuadInd
exBuffer; |
| 491 | 492 |
| 492 typedef GrClipTarget INHERITED; | 493 typedef GrClipTarget INHERITED; |
| 493 }; | 494 }; |
| 494 | 495 |
| 495 #endif | 496 #endif |
| OLD | NEW |