| 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 // the GrStencilAttachment. | 419 // the GrStencilAttachment. |
| 420 virtual GrStencilAttachment* createStencilAttachmentForRenderTarget(const Gr
RenderTarget*, | 420 virtual GrStencilAttachment* createStencilAttachmentForRenderTarget(const Gr
RenderTarget*, |
| 421 int widt
h, | 421 int widt
h, |
| 422 int heig
ht) = 0; | 422 int heig
ht) = 0; |
| 423 // clears target's entire stencil buffer to 0 | 423 // clears target's entire stencil buffer to 0 |
| 424 virtual void clearStencil(GrRenderTarget* target) = 0; | 424 virtual void clearStencil(GrRenderTarget* target) = 0; |
| 425 | 425 |
| 426 // draws an outline rectangle for debugging/visualization purposes. | 426 // draws an outline rectangle for debugging/visualization purposes. |
| 427 virtual void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) = 0
; | 427 virtual void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) = 0
; |
| 428 | 428 |
| 429 // Determines whether a copy of a texture must be made in order to be compat
ible with | 429 // Determines whether a texture will need to be rescaled in order to be used
with the |
| 430 // a given GrTextureParams. If so, the width, height and filter used for the
copy are | 430 // GrTextureParams. This variation is called when the caller will create a n
ew texture using the |
| 431 // output via the CopyParams. | 431 // texture provider from a non-texture src (cpu-backed image, ...). |
| 432 bool makeCopyForTextureParams(int width, int height, const GrTextureParams&, | 432 bool makeCopyForTextureParams(int width, int height, const GrTextureParams&, |
| 433 GrTextureProducer::CopyParams*) const; | 433 GrTextureProducer::CopyParams*) const; |
| 434 |
| 435 // Like the above but this variation should be called when the caller is not
creating the |
| 436 // original texture but rather was handed the original texture. It adds addi
tional checks |
| 437 // relevant to original textures that were created external to Skia via |
| 438 // GrTextureProvider::wrap methods. |
| 439 bool makeCopyForTextureParams(GrTexture* texture, const GrTextureParams& par
ams, |
| 440 GrTextureProducer::CopyParams* copyParams) con
st { |
| 441 if (this->makeCopyForTextureParams(texture->width(), texture->height(),
params, |
| 442 copyParams)) { |
| 443 return true; |
| 444 } |
| 445 return this->onMakeCopyForTextureParams(texture, params, copyParams); |
| 446 } |
| 434 | 447 |
| 435 // This is only to be used in GL-specific tests. | 448 // This is only to be used in GL-specific tests. |
| 436 virtual const GrGLContext* glContextForTesting() const { return nullptr; } | 449 virtual const GrGLContext* glContextForTesting() const { return nullptr; } |
| 437 | 450 |
| 438 // This is only to be used by testing code | 451 // This is only to be used by testing code |
| 439 virtual void resetShaderCacheForTesting() const {} | 452 virtual void resetShaderCacheForTesting() const {} |
| 440 | 453 |
| 441 protected: | 454 protected: |
| 442 // Functions used to map clip-respecting stencil tests into normal | 455 // Functions used to map clip-respecting stencil tests into normal |
| 443 // stencil funcs supported by GPUs. | 456 // stencil funcs supported by GPUs. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) =
0; | 512 virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) =
0; |
| 500 | 513 |
| 501 | 514 |
| 502 // Overridden by backend specific classes to perform a clear of the stencil
clip bits. This is | 515 // Overridden by backend specific classes to perform a clear of the stencil
clip bits. This is |
| 503 // ONLY used by the the clip target | 516 // ONLY used by the the clip target |
| 504 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i
nsideClip) = 0; | 517 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i
nsideClip) = 0; |
| 505 | 518 |
| 506 // overridden by backend-specific derived class to perform the draw call. | 519 // overridden by backend-specific derived class to perform the draw call. |
| 507 virtual void onDraw(const DrawArgs&, const GrNonInstancedVertices&) = 0; | 520 virtual void onDraw(const DrawArgs&, const GrNonInstancedVertices&) = 0; |
| 508 | 521 |
| 522 virtual bool onMakeCopyForTextureParams(GrTexture* texture, const GrTextureP
arams&, |
| 523 GrTextureProducer::CopyParams*) cons
t { return false; } |
| 524 |
| 509 virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int r
eadHeight, | 525 virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int r
eadHeight, |
| 510 size_t rowBytes, GrPixelConfig readConfig,
DrawPreference*, | 526 size_t rowBytes, GrPixelConfig readConfig,
DrawPreference*, |
| 511 ReadPixelTempDrawInfo*) = 0; | 527 ReadPixelTempDrawInfo*) = 0; |
| 512 virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int heig
ht, size_t rowBytes, | 528 virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int heig
ht, size_t rowBytes, |
| 513 GrPixelConfig srcConfig, DrawPreference*, | 529 GrPixelConfig srcConfig, DrawPreference*, |
| 514 WritePixelTempDrawInfo*) = 0; | 530 WritePixelTempDrawInfo*) = 0; |
| 515 | 531 |
| 516 // overridden by backend-specific derived class to perform the surface read | 532 // overridden by backend-specific derived class to perform the surface read |
| 517 virtual bool onReadPixels(GrSurface*, | 533 virtual bool onReadPixels(GrSurface*, |
| 518 int left, int top, | 534 int left, int top, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 ResetTimestamp fResetTi
mestamp; | 567 ResetTimestamp fResetTi
mestamp; |
| 552 uint32_t fResetBi
ts; | 568 uint32_t fResetBi
ts; |
| 553 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 569 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
| 554 GrContext* fContext
; | 570 GrContext* fContext
; |
| 555 | 571 |
| 556 friend class GrPathRendering; | 572 friend class GrPathRendering; |
| 557 typedef SkRefCnt INHERITED; | 573 typedef SkRefCnt INHERITED; |
| 558 }; | 574 }; |
| 559 | 575 |
| 560 #endif | 576 #endif |
| OLD | NEW |