OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #ifndef GrGpu_DEFINED | 10 #ifndef GrGpu_DEFINED |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 case kLines_GrPrimitiveType: | 359 case kLines_GrPrimitiveType: |
360 case kLineStrip_GrPrimitiveType: | 360 case kLineStrip_GrPrimitiveType: |
361 return kDrawLines_DrawType; | 361 return kDrawLines_DrawType; |
362 default: | 362 default: |
363 GrCrash("Unexpected primitive type"); | 363 GrCrash("Unexpected primitive type"); |
364 return kDrawTriangles_DrawType; | 364 return kDrawTriangles_DrawType; |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 // prepares clip flushes gpu state before a draw | 368 // prepares clip flushes gpu state before a draw |
369 bool setupClipAndFlushState(DrawType); | 369 bool setupClipAndFlushState(DrawType, const GrDeviceCoordTexture* dstCopy); |
370 | 370 |
371 // Functions used to map clip-respecting stencil tests into normal | 371 // Functions used to map clip-respecting stencil tests into normal |
372 // stencil funcs supported by GPUs. | 372 // stencil funcs supported by GPUs. |
373 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, | 373 static GrStencilFunc ConvertStencilFunc(bool stencilInClip, |
374 GrStencilFunc func); | 374 GrStencilFunc func); |
375 static void ConvertStencilFuncAndMask(GrStencilFunc func, | 375 static void ConvertStencilFuncAndMask(GrStencilFunc func, |
376 bool clipInStencil, | 376 bool clipInStencil, |
377 unsigned int clipBit, | 377 unsigned int clipBit, |
378 unsigned int userBits, | 378 unsigned int userBits, |
379 unsigned int* ref, | 379 unsigned int* ref, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 // width and height may be larger than rt (if underlying API allows it). | 475 // width and height may be larger than rt (if underlying API allows it). |
476 // Should attach the SB to the RT. Returns false if compatible sb could | 476 // Should attach the SB to the RT. Returns false if compatible sb could |
477 // not be created. | 477 // not be created. |
478 virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width,
int height) = 0; | 478 virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width,
int height) = 0; |
479 | 479 |
480 // attaches an existing SB to an existing RT. | 480 // attaches an existing SB to an existing RT. |
481 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) = 0; | 481 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) = 0; |
482 | 482 |
483 // The GrGpu typically records the clients requested state and then flushes | 483 // The GrGpu typically records the clients requested state and then flushes |
484 // deltas from previous state at draw time. This function does the | 484 // deltas from previous state at draw time. This function does the |
485 // backend-specific flush of the state | 485 // backend-specific flush of the state. |
486 // returns false if current state is unsupported. | 486 // returns false if current state is unsupported. |
487 virtual bool flushGraphicsState(DrawType) = 0; | 487 virtual bool flushGraphicsState(DrawType, const GrDeviceCoordTexture* dstCop
y) = 0; |
488 | 488 |
489 // clears the entire stencil buffer to 0 | 489 // clears the entire stencil buffer to 0 |
490 virtual void clearStencil() = 0; | 490 virtual void clearStencil() = 0; |
491 | 491 |
492 // Given a rt, find or create a stencil buffer and attach it | 492 // Given a rt, find or create a stencil buffer and attach it |
493 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); | 493 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
494 | 494 |
495 // GrDrawTarget overrides | 495 // GrDrawTarget overrides |
496 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; | 496 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; |
497 virtual void onStencilPath(const GrPath* path, const SkStrokeRec& stroke, | 497 virtual void onStencilPath(const GrPath* path, const SkStrokeRec& stroke, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 // these are mutable so they can be created on-demand | 531 // these are mutable so they can be created on-demand |
532 mutable GrVertexBuffer* fUnitSqu
areVertexBuffer; | 532 mutable GrVertexBuffer* fUnitSqu
areVertexBuffer; |
533 mutable GrIndexBuffer* fQuadInd
exBuffer; | 533 mutable GrIndexBuffer* fQuadInd
exBuffer; |
534 bool fContext
IsDirty; | 534 bool fContext
IsDirty; |
535 ResourceList fResourc
eList; | 535 ResourceList fResourc
eList; |
536 | 536 |
537 typedef GrDrawTarget INHERITED; | 537 typedef GrDrawTarget INHERITED; |
538 }; | 538 }; |
539 | 539 |
540 #endif | 540 #endif |
OLD | NEW |