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