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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 * GrDrawState's stencil settings and stencil clipping. | 308 * GrDrawState's stencil settings and stencil clipping. |
309 */ | 309 */ |
310 void setStencilSettings(const GrStencilSettings& settings) { | 310 void setStencilSettings(const GrStencilSettings& settings) { |
311 fStencilSettings = settings; | 311 fStencilSettings = settings; |
312 } | 312 } |
313 void disableStencil() { fStencilSettings.setDisabled(); } | 313 void disableStencil() { fStencilSettings.setDisabled(); } |
314 | 314 |
315 // GrGpu subclass sets clip bit in the stencil buffer. The subclass is | 315 // GrGpu subclass sets clip bit in the stencil buffer. The subclass is |
316 // free to clear the remaining bits to zero if masked clears are more | 316 // free to clear the remaining bits to zero if masked clears are more |
317 // expensive than clearing all bits. | 317 // expensive than clearing all bits. |
318 virtual void clearStencilClip(const SkIRect& rect, bool insideClip) = 0; | 318 virtual void clearStencilClip(GrRenderTarget*, const SkIRect& rect, bool ins
ideClip) = 0; |
319 | 319 |
320 enum PrivateDrawStateStateBits { | 320 enum PrivateDrawStateStateBits { |
321 kFirstBit = (GrDrawState::kLastPublicStateBit << 1), | 321 kFirstBit = (GrDrawState::kLastPublicStateBit << 1), |
322 | 322 |
323 kModifyStencilClip_StateBit = kFirstBit, // allows draws to modify | 323 kModifyStencilClip_StateBit = kFirstBit, // allows draws to modify |
324 // stencil bits used for | 324 // stencil bits used for |
325 // clipping. | 325 // clipping. |
326 }; | 326 }; |
327 | 327 |
328 void getPathStencilSettingsForFillType(SkPath::FillType fill, GrStencilSetti
ngs* outStencilSettings); | 328 void getPathStencilSettingsForFillType(SkPath::FillType fill, GrStencilSetti
ngs* outStencilSettings); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 virtual GrTexture* onCreateCompressedTexture(const GrTextureDesc& desc, | 428 virtual GrTexture* onCreateCompressedTexture(const GrTextureDesc& desc, |
429 const void* srcData) = 0; | 429 const void* srcData) = 0; |
430 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; | 430 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; |
431 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&) = 0; | 431 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&) = 0; |
432 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; | 432 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; |
433 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; | 433 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; |
434 | 434 |
435 // overridden by backend-specific derived class to perform the clear and | 435 // overridden by backend-specific derived class to perform the clear and |
436 // clearRect. NULL rect means clear whole target. If canIgnoreRect is | 436 // clearRect. NULL rect means clear whole target. If canIgnoreRect is |
437 // true, it is okay to perform a full clear instead of a partial clear | 437 // true, it is okay to perform a full clear instead of a partial clear |
438 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect)
= 0; | 438 virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, |
| 439 bool canIgnoreRect) = 0; |
439 | 440 |
440 // overridden by backend-specific derived class to perform the draw call. | 441 // overridden by backend-specific derived class to perform the draw call. |
441 virtual void onGpuDraw(const DrawInfo&) = 0; | 442 virtual void onGpuDraw(const DrawInfo&) = 0; |
442 | 443 |
443 // overridden by backend-specific derived class to perform the read pixels. | 444 // overridden by backend-specific derived class to perform the read pixels. |
444 virtual bool onReadPixels(GrRenderTarget* target, | 445 virtual bool onReadPixels(GrRenderTarget* target, |
445 int left, int top, int width, int height, | 446 int left, int top, int width, int height, |
446 GrPixelConfig, | 447 GrPixelConfig, |
447 void* buffer, | 448 void* buffer, |
448 size_t rowBytes) = 0; | 449 size_t rowBytes) = 0; |
(...skipping 14 matching lines...) Expand all Loading... |
463 | 464 |
464 // attaches an existing SB to an existing RT. | 465 // attaches an existing SB to an existing RT. |
465 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) = 0; | 466 virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTar
get*) = 0; |
466 | 467 |
467 // The GrGpu typically records the clients requested state and then flushes | 468 // The GrGpu typically records the clients requested state and then flushes |
468 // deltas from previous state at draw time. This function does the | 469 // deltas from previous state at draw time. This function does the |
469 // backend-specific flush of the state. | 470 // backend-specific flush of the state. |
470 // returns false if current state is unsupported. | 471 // returns false if current state is unsupported. |
471 virtual bool flushGraphicsState(DrawType, const GrDeviceCoordTexture* dstCop
y) = 0; | 472 virtual bool flushGraphicsState(DrawType, const GrDeviceCoordTexture* dstCop
y) = 0; |
472 | 473 |
473 // clears the entire stencil buffer to 0 | 474 // clears target's entire stencil buffer to 0 |
474 virtual void clearStencil() = 0; | 475 virtual void clearStencil(GrRenderTarget* target) = 0; |
475 | 476 |
476 // Given a rt, find or create a stencil buffer and attach it | 477 // Given a rt, find or create a stencil buffer and attach it |
477 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); | 478 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); |
478 | 479 |
479 // GrDrawTarget overrides | 480 // GrDrawTarget overrides |
480 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; | 481 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; |
481 virtual void onStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE; | 482 virtual void onStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE; |
482 virtual void onDrawPath(const GrPath*, SkPath::FillType, | 483 virtual void onDrawPath(const GrPath*, SkPath::FillType, |
483 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 484 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
484 virtual void onDrawPaths(const GrPathRange*, | 485 virtual void onDrawPaths(const GrPathRange*, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 // counts number of uses of vertex/index pool in the geometry stack | 518 // counts number of uses of vertex/index pool in the geometry stack |
518 int fVertexP
oolUseCnt; | 519 int fVertexP
oolUseCnt; |
519 int fIndexPo
olUseCnt; | 520 int fIndexPo
olUseCnt; |
520 // these are mutable so they can be created on-demand | 521 // these are mutable so they can be created on-demand |
521 mutable GrIndexBuffer* fQuadInd
exBuffer; | 522 mutable GrIndexBuffer* fQuadInd
exBuffer; |
522 | 523 |
523 typedef GrDrawTarget INHERITED; | 524 typedef GrDrawTarget INHERITED; |
524 }; | 525 }; |
525 | 526 |
526 #endif | 527 #endif |
OLD | NEW |