| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 return kDrawPoints_DrawType; | 319 return kDrawPoints_DrawType; |
| 320 case kLines_GrPrimitiveType: | 320 case kLines_GrPrimitiveType: |
| 321 case kLineStrip_GrPrimitiveType: | 321 case kLineStrip_GrPrimitiveType: |
| 322 return kDrawLines_DrawType; | 322 return kDrawLines_DrawType; |
| 323 default: | 323 default: |
| 324 SkFAIL("Unexpected primitive type"); | 324 SkFAIL("Unexpected primitive type"); |
| 325 return kDrawTriangles_DrawType; | 325 return kDrawTriangles_DrawType; |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 | 328 |
| 329 // prepares clip flushes gpu state before a draw | |
| 330 bool setupClipAndFlushState(DrawType, | |
| 331 const GrDeviceCoordTexture* dstCopy, | |
| 332 const SkRect* devBounds, | |
| 333 GrDrawState::AutoRestoreEffects*, | |
| 334 GrDrawState::AutoRestoreStencil*); | |
| 335 | |
| 336 // Functions used to map clip-respecting stencil tests into normal | 329 // Functions used to map clip-respecting stencil tests into normal |
| 337 // stencil funcs supported by GPUs. | 330 // stencil funcs supported by GPUs. |
| 338 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, | 331 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
| 339 GrStencilFunc func); | 332 GrStencilFunc func); |
| 340 static void ConvertStencilFuncAndMask(GrStencilFunc func, | 333 static void ConvertStencilFuncAndMask(GrStencilFunc func, |
| 341 bool clipInStencil, | 334 bool clipInStencil, |
| 342 unsigned int clipBit, | 335 unsigned int clipBit, |
| 343 unsigned int userBits, | 336 unsigned int userBits, |
| 344 unsigned int* ref, | 337 unsigned int* ref, |
| 345 unsigned int* mask); | 338 unsigned int* mask); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 const GrClipMaskManager::ScissorState&, | 428 const GrClipMaskManager::ScissorState&, |
| 436 const GrDeviceCoordTexture* dstCopy) = 0; | 429 const GrDeviceCoordTexture* dstCopy) = 0; |
| 437 | 430 |
| 438 // clears target's entire stencil buffer to 0 | 431 // clears target's entire stencil buffer to 0 |
| 439 virtual void clearStencil(GrRenderTarget* target) = 0; | 432 virtual void clearStencil(GrRenderTarget* target) = 0; |
| 440 | 433 |
| 441 // Given a rt, find or create a stencil buffer and attach it | 434 // Given a rt, find or create a stencil buffer and attach it |
| 442 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); | 435 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
| 443 | 436 |
| 444 // GrDrawTarget overrides | 437 // GrDrawTarget overrides |
| 445 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; | 438 virtual void onDraw(const DrawInfo&, const GrClipMaskManager::ScissorState&)
SK_OVERRIDE; |
| 446 virtual void onStencilPath(const GrPath*, GrPathRendering::FillType) SK_OVER
RIDE; | 439 virtual void onStencilPath(const GrPath*, |
| 447 virtual void onDrawPath(const GrPath*, GrPathRendering::FillType, | 440 const GrClipMaskManager::ScissorState&, |
| 441 const GrStencilSettings&) SK_OVERRIDE; |
| 442 virtual void onDrawPath(const GrPath*, |
| 443 const GrClipMaskManager::ScissorState&, |
| 444 const GrStencilSettings&, |
| 448 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 445 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| 449 virtual void onDrawPaths(const GrPathRange*, | 446 virtual void onDrawPaths(const GrPathRange*, |
| 450 const uint32_t indices[], int count, | 447 const uint32_t indices[], |
| 451 const float transforms[], PathTransformType, | 448 int count, |
| 452 GrPathRendering::FillType, const GrDeviceCoordTextu
re*) SK_OVERRIDE; | 449 const float transforms[], |
| 450 PathTransformType, |
| 451 const GrClipMaskManager::ScissorState&, |
| 452 const GrStencilSettings&, |
| 453 const GrDeviceCoordTexture*) SK_OVERRIDE; |
| 453 | 454 |
| 454 // readies the pools to provide vertex/index data. | 455 // readies the pools to provide vertex/index data. |
| 455 void prepareVertexPool(); | 456 void prepareVertexPool(); |
| 456 void prepareIndexPool(); | 457 void prepareIndexPool(); |
| 457 | 458 |
| 458 void resetContext() { | 459 void resetContext() { |
| 459 this->onResetContext(fResetBits); | 460 this->onResetContext(fResetBits); |
| 460 fResetBits = 0; | 461 fResetBits = 0; |
| 461 ++fResetTimestamp; | 462 ++fResetTimestamp; |
| 462 } | 463 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 478 // counts number of uses of vertex/index pool in the geometry stack | 479 // counts number of uses of vertex/index pool in the geometry stack |
| 479 int fVertexP
oolUseCnt; | 480 int fVertexP
oolUseCnt; |
| 480 int fIndexPo
olUseCnt; | 481 int fIndexPo
olUseCnt; |
| 481 // these are mutable so they can be created on-demand | 482 // these are mutable so they can be created on-demand |
| 482 mutable GrIndexBuffer* fQuadInd
exBuffer; | 483 mutable GrIndexBuffer* fQuadInd
exBuffer; |
| 483 | 484 |
| 484 typedef GrClipTarget INHERITED; | 485 typedef GrClipTarget INHERITED; |
| 485 }; | 486 }; |
| 486 | 487 |
| 487 #endif | 488 #endif |
| OLD | NEW |