| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 default: | 328 default: |
| 329 SkFAIL("Unexpected primitive type"); | 329 SkFAIL("Unexpected primitive type"); |
| 330 return kDrawTriangles_DrawType; | 330 return kDrawTriangles_DrawType; |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 | 333 |
| 334 // prepares clip flushes gpu state before a draw | 334 // prepares clip flushes gpu state before a draw |
| 335 bool setupClipAndFlushState(DrawType, | 335 bool setupClipAndFlushState(DrawType, |
| 336 const GrDeviceCoordTexture* dstCopy, | 336 const GrDeviceCoordTexture* dstCopy, |
| 337 const SkRect* devBounds, | 337 const SkRect* devBounds, |
| 338 GrDrawState::AutoRestoreEffects*); | 338 GrDrawState::AutoRestoreEffects*, |
| 339 GrDrawState::AutoRestoreStencil*); |
| 339 | 340 |
| 340 // Functions used to map clip-respecting stencil tests into normal | 341 // Functions used to map clip-respecting stencil tests into normal |
| 341 // stencil funcs supported by GPUs. | 342 // stencil funcs supported by GPUs. |
| 342 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, | 343 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
| 343 GrStencilFunc func); | 344 GrStencilFunc func); |
| 344 static void ConvertStencilFuncAndMask(GrStencilFunc func, | 345 static void ConvertStencilFuncAndMask(GrStencilFunc func, |
| 345 bool clipInStencil, | 346 bool clipInStencil, |
| 346 unsigned int clipBit, | 347 unsigned int clipBit, |
| 347 unsigned int userBits, | 348 unsigned int userBits, |
| 348 unsigned int* ref, | 349 unsigned int* ref, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 const GrDeviceCoordTexture* dstCopy) = 0; | 446 const GrDeviceCoordTexture* dstCopy) = 0; |
| 446 | 447 |
| 447 // clears target's entire stencil buffer to 0 | 448 // clears target's entire stencil buffer to 0 |
| 448 virtual void clearStencil(GrRenderTarget* target) = 0; | 449 virtual void clearStencil(GrRenderTarget* target) = 0; |
| 449 | 450 |
| 450 // Given a rt, find or create a stencil buffer and attach it | 451 // Given a rt, find or create a stencil buffer and attach it |
| 451 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); | 452 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
| 452 | 453 |
| 453 // GrDrawTarget overrides | 454 // GrDrawTarget overrides |
| 454 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; | 455 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; |
| 455 virtual void onStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE; | 456 virtual void onStencilPath(const GrPath*, GrPathRendering::FillType) SK_OVER
RIDE; |
| 456 virtual void onDrawPath(const GrPath*, SkPath::FillType, | 457 virtual void onDrawPath(const GrPath*, GrPathRendering::FillType, |
| 457 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 458 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| 458 virtual void onDrawPaths(const GrPathRange*, | 459 virtual void onDrawPaths(const GrPathRange*, |
| 459 const uint32_t indices[], int count, | 460 const uint32_t indices[], int count, |
| 460 const float transforms[], PathTransformType, | 461 const float transforms[], PathTransformType, |
| 461 SkPath::FillType, const GrDeviceCoordTexture*) SK_O
VERRIDE; | 462 GrPathRendering::FillType, const GrDeviceCoordTextu
re*) SK_OVERRIDE; |
| 462 | 463 |
| 463 // readies the pools to provide vertex/index data. | 464 // readies the pools to provide vertex/index data. |
| 464 void prepareVertexPool(); | 465 void prepareVertexPool(); |
| 465 void prepareIndexPool(); | 466 void prepareIndexPool(); |
| 466 | 467 |
| 467 void resetContext() { | 468 void resetContext() { |
| 468 this->onResetContext(fResetBits); | 469 this->onResetContext(fResetBits); |
| 469 fResetBits = 0; | 470 fResetBits = 0; |
| 470 ++fResetTimestamp; | 471 ++fResetTimestamp; |
| 471 } | 472 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 487 // counts number of uses of vertex/index pool in the geometry stack | 488 // counts number of uses of vertex/index pool in the geometry stack |
| 488 int fVertexP
oolUseCnt; | 489 int fVertexP
oolUseCnt; |
| 489 int fIndexPo
olUseCnt; | 490 int fIndexPo
olUseCnt; |
| 490 // these are mutable so they can be created on-demand | 491 // these are mutable so they can be created on-demand |
| 491 mutable GrIndexBuffer* fQuadInd
exBuffer; | 492 mutable GrIndexBuffer* fQuadInd
exBuffer; |
| 492 | 493 |
| 493 typedef GrClipTarget INHERITED; | 494 typedef GrClipTarget INHERITED; |
| 494 }; | 495 }; |
| 495 | 496 |
| 496 #endif | 497 #endif |
| OLD | NEW |