| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 fResetBits |= state; | 64 fResetBits |= state; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void unimpl(const char[]); | 67 void unimpl(const char[]); |
| 68 | 68 |
| 69 /** | 69 /** |
| 70 * Creates a texture object. If desc width or height is not a power of | 70 * Creates a texture object. If desc width or height is not a power of |
| 71 * two but underlying API requires a power of two texture then srcData | 71 * two but underlying API requires a power of two texture then srcData |
| 72 * will be embedded in a power of two texture. The extra width and height | 72 * will be embedded in a power of two texture. The extra width and height |
| 73 * is filled as though srcData were rendered clamped into the texture. | 73 * is filled as though srcData were rendered clamped into the texture. |
| 74 * The exception is when using compressed data formats. In this case, the |
| 75 * desc width and height must be a multiple of the compressed format block |
| 76 * size otherwise this function returns NULL. Similarly, if the underlying |
| 77 * API requires a power of two texture and the source width and height are n
ot |
| 78 * a power of two, then this function returns NULL. |
| 74 * | 79 * |
| 75 * If kRenderTarget_TextureFlag is specified the GrRenderTarget is | 80 * If kRenderTarget_TextureFlag is specified the GrRenderTarget is |
| 76 * accessible via GrTexture::asRenderTarget(). The texture will hold a ref | 81 * accessible via GrTexture::asRenderTarget(). The texture will hold a ref |
| 77 * on the render target until the texture is destroyed. | 82 * on the render target until the texture is destroyed. Compressed textures |
| 83 * cannot have the kRenderTarget_TextureFlag set. |
| 78 * | 84 * |
| 79 * @param desc describes the texture to be created. | 85 * @param desc describes the texture to be created. |
| 80 * @param srcData texel data to load texture. Begins with full-size | 86 * @param srcData texel data to load texture. Begins with full-size |
| 81 * palette data for paletted textures. Contains width* | 87 * palette data for paletted textures. For compressed |
| 82 * height texels. If NULL texture data is uninitialized. | 88 * formats it contains the compressed pixel data. Otherwi
se, |
| 89 * it contains width*height texels. If NULL texture data |
| 90 * is uninitialized. |
| 91 * @param rowBytes the number of bytes between consecutive rows. Zero |
| 92 * means rows are tightly packed. This field is ignored |
| 93 * for compressed formats. |
| 83 * | 94 * |
| 84 * @return The texture object if successful, otherwise NULL. | 95 * @return The texture object if successful, otherwise NULL. |
| 85 */ | 96 */ |
| 86 GrTexture* createTexture(const GrTextureDesc& desc, | 97 GrTexture* createTexture(const GrTextureDesc& desc, |
| 87 const void* srcData, size_t rowBytes); | 98 const void* srcData, size_t rowBytes); |
| 88 | 99 |
| 89 /** | 100 /** |
| 90 * Implements GrContext::wrapBackendTexture | 101 * Implements GrContext::wrapBackendTexture |
| 91 */ | 102 */ |
| 92 GrTexture* wrapBackendTexture(const GrBackendTextureDesc&); | 103 GrTexture* wrapBackendTexture(const GrBackendTextureDesc&); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 418 |
| 408 | 419 |
| 409 // called when the 3D context state is unknown. Subclass should emit any | 420 // called when the 3D context state is unknown. Subclass should emit any |
| 410 // assumed 3D context state and dirty any state cache. | 421 // assumed 3D context state and dirty any state cache. |
| 411 virtual void onResetContext(uint32_t resetBits) = 0; | 422 virtual void onResetContext(uint32_t resetBits) = 0; |
| 412 | 423 |
| 413 // overridden by backend-specific derived class to create objects. | 424 // overridden by backend-specific derived class to create objects. |
| 414 virtual GrTexture* onCreateTexture(const GrTextureDesc& desc, | 425 virtual GrTexture* onCreateTexture(const GrTextureDesc& desc, |
| 415 const void* srcData, | 426 const void* srcData, |
| 416 size_t rowBytes) = 0; | 427 size_t rowBytes) = 0; |
| 428 virtual GrTexture* onCreateCompressedTexture(const GrTextureDesc& desc, |
| 429 const void* srcData) = 0; |
| 417 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; | 430 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; |
| 418 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&) = 0; | 431 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&) = 0; |
| 419 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; | 432 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; |
| 420 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; | 433 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; |
| 421 virtual GrPath* onCreatePath(const SkPath& path, const SkStrokeRec&) = 0; | 434 virtual GrPath* onCreatePath(const SkPath& path, const SkStrokeRec&) = 0; |
| 422 | 435 |
| 423 // overridden by backend-specific derived class to perform the clear and | 436 // overridden by backend-specific derived class to perform the clear and |
| 424 // clearRect. NULL rect means clear whole target. If canIgnoreRect is | 437 // clearRect. NULL rect means clear whole target. If canIgnoreRect is |
| 425 // true, it is okay to perform a full clear instead of a partial clear | 438 // true, it is okay to perform a full clear instead of a partial clear |
| 426 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect)
= 0; | 439 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect)
= 0; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 // these are mutable so they can be created on-demand | 527 // these are mutable so they can be created on-demand |
| 515 mutable GrIndexBuffer* fQuadInd
exBuffer; | 528 mutable GrIndexBuffer* fQuadInd
exBuffer; |
| 516 // Used to abandon/release all resources created by this GrGpu. TODO: Move t
his | 529 // Used to abandon/release all resources created by this GrGpu. TODO: Move t
his |
| 517 // functionality to GrResourceCache. | 530 // functionality to GrResourceCache. |
| 518 ObjectList fObjectL
ist; | 531 ObjectList fObjectL
ist; |
| 519 | 532 |
| 520 typedef GrDrawTarget INHERITED; | 533 typedef GrDrawTarget INHERITED; |
| 521 }; | 534 }; |
| 522 | 535 |
| 523 #endif | 536 #endif |
| OLD | NEW |