| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 default: | 334 default: |
| 335 SkFAIL("Unexpected primitive type"); | 335 SkFAIL("Unexpected primitive type"); |
| 336 return kDrawTriangles_DrawType; | 336 return kDrawTriangles_DrawType; |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 | 339 |
| 340 // prepares clip flushes gpu state before a draw | 340 // prepares clip flushes gpu state before a draw |
| 341 bool setupClipAndFlushState(DrawType, | 341 bool setupClipAndFlushState(DrawType, |
| 342 const GrDeviceCoordTexture* dstCopy, | 342 const GrDeviceCoordTexture* dstCopy, |
| 343 const SkRect* devBounds, | 343 const SkRect* devBounds, |
| 344 GrDrawState::AutoRestoreEffects*); | 344 GrDrawState::AutoRestoreEffects*, |
| 345 GrDrawState::AutoRestoreStencil*); |
| 345 | 346 |
| 346 // Functions used to map clip-respecting stencil tests into normal | 347 // Functions used to map clip-respecting stencil tests into normal |
| 347 // stencil funcs supported by GPUs. | 348 // stencil funcs supported by GPUs. |
| 348 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, | 349 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
| 349 GrStencilFunc func); | 350 GrStencilFunc func); |
| 350 static void ConvertStencilFuncAndMask(GrStencilFunc func, | 351 static void ConvertStencilFuncAndMask(GrStencilFunc func, |
| 351 bool clipInStencil, | 352 bool clipInStencil, |
| 352 unsigned int clipBit, | 353 unsigned int clipBit, |
| 353 unsigned int userBits, | 354 unsigned int userBits, |
| 354 unsigned int* ref, | 355 unsigned int* ref, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 const GrDeviceCoordTexture* dstCopy) = 0; | 452 const GrDeviceCoordTexture* dstCopy) = 0; |
| 452 | 453 |
| 453 // clears target's entire stencil buffer to 0 | 454 // clears target's entire stencil buffer to 0 |
| 454 virtual void clearStencil(GrRenderTarget* target) = 0; | 455 virtual void clearStencil(GrRenderTarget* target) = 0; |
| 455 | 456 |
| 456 // Given a rt, find or create a stencil buffer and attach it | 457 // Given a rt, find or create a stencil buffer and attach it |
| 457 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); | 458 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
| 458 | 459 |
| 459 // GrDrawTarget overrides | 460 // GrDrawTarget overrides |
| 460 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; | 461 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; |
| 461 virtual void onStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE; | 462 virtual void onStencilPath(const GrPath*, GrPathRendering::FillType) SK_OVER
RIDE; |
| 462 virtual void onDrawPath(const GrPath*, SkPath::FillType, | 463 virtual void onDrawPath(const GrPath*, GrPathRendering::FillType, |
| 463 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 464 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| 464 virtual void onDrawPaths(const GrPathRange*, | 465 virtual void onDrawPaths(const GrPathRange*, |
| 465 const uint32_t indices[], int count, | 466 const uint32_t indices[], int count, |
| 466 const float transforms[], PathTransformType, | 467 const float transforms[], PathTransformType, |
| 467 SkPath::FillType, const GrDeviceCoordTexture*) SK_O
VERRIDE; | 468 GrPathRendering::FillType, const GrDeviceCoordTextu
re*) SK_OVERRIDE; |
| 468 | 469 |
| 469 // readies the pools to provide vertex/index data. | 470 // readies the pools to provide vertex/index data. |
| 470 void prepareVertexPool(); | 471 void prepareVertexPool(); |
| 471 void prepareIndexPool(); | 472 void prepareIndexPool(); |
| 472 | 473 |
| 473 void resetContext() { | 474 void resetContext() { |
| 474 // We call this because the client may have messed with the | 475 // We call this because the client may have messed with the |
| 475 // stencil buffer. Perhaps we should detect whether it is a | 476 // stencil buffer. Perhaps we should detect whether it is a |
| 476 // internally created stencil buffer and if so skip the invalidate. | 477 // internally created stencil buffer and if so skip the invalidate. |
| 477 fClipMaskManager.invalidateStencilMask(); | 478 fClipMaskManager.invalidateStencilMask(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 497 // counts number of uses of vertex/index pool in the geometry stack | 498 // counts number of uses of vertex/index pool in the geometry stack |
| 498 int fVertexP
oolUseCnt; | 499 int fVertexP
oolUseCnt; |
| 499 int fIndexPo
olUseCnt; | 500 int fIndexPo
olUseCnt; |
| 500 // these are mutable so they can be created on-demand | 501 // these are mutable so they can be created on-demand |
| 501 mutable GrIndexBuffer* fQuadInd
exBuffer; | 502 mutable GrIndexBuffer* fQuadInd
exBuffer; |
| 502 | 503 |
| 503 typedef GrClipTarget INHERITED; | 504 typedef GrClipTarget INHERITED; |
| 504 }; | 505 }; |
| 505 | 506 |
| 506 #endif | 507 #endif |
| OLD | NEW |