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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 void unimpl(const char[]); | 84 void unimpl(const char[]); |
85 | 85 |
86 /** | 86 /** |
87 * Creates a texture object. If kRenderTarget_GrSurfaceFlag the texture can | 87 * Creates a texture object. If kRenderTarget_GrSurfaceFlag the texture can |
88 * be used as a render target by calling GrTexture::asRenderTarget(). Not al
l | 88 * be used as a render target by calling GrTexture::asRenderTarget(). Not al
l |
89 * pixel configs can be used as render targets. Support for configs as textu
res | 89 * pixel configs can be used as render targets. Support for configs as textu
res |
90 * or render targets can be checked using GrDrawTargetCaps. | 90 * or render targets can be checked using GrDrawTargetCaps. |
91 * | 91 * |
92 * @param desc describes the texture to be created. | 92 * @param desc describes the texture to be created. |
| 93 * @param budgeted does this texture count against the resource cache bud
get? |
93 * @param srcData texel data to load texture. Begins with full-size | 94 * @param srcData texel data to load texture. Begins with full-size |
94 * palette data for paletted textures. For compressed | 95 * palette data for paletted textures. For compressed |
95 * formats it contains the compressed pixel data. Otherwi
se, | 96 * formats it contains the compressed pixel data. Otherwi
se, |
96 * it contains width*height texels. If NULL texture data | 97 * it contains width*height texels. If NULL texture data |
97 * is uninitialized. | 98 * is uninitialized. |
98 * @param rowBytes the number of bytes between consecutive rows. Zero | 99 * @param rowBytes the number of bytes between consecutive rows. Zero |
99 * means rows are tightly packed. This field is ignored | 100 * means rows are tightly packed. This field is ignored |
100 * for compressed formats. | 101 * for compressed formats. |
101 * | 102 * |
102 * @return The texture object if successful, otherwise NULL. | 103 * @return The texture object if successful, otherwise NULL. |
103 */ | 104 */ |
104 GrTexture* createTexture(const GrSurfaceDesc& desc, const void* srcData, siz
e_t rowBytes); | 105 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, |
| 106 const void* srcData, size_t rowBytes); |
105 | 107 |
106 /** | 108 /** |
107 * Implements GrContext::wrapBackendTexture | 109 * Implements GrContext::wrapBackendTexture |
108 */ | 110 */ |
109 GrTexture* wrapBackendTexture(const GrBackendTextureDesc&); | 111 GrTexture* wrapBackendTexture(const GrBackendTextureDesc&); |
110 | 112 |
111 /** | 113 /** |
112 * Implements GrContext::wrapBackendTexture | 114 * Implements GrContext::wrapBackendTexture |
113 */ | 115 */ |
114 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&); | 116 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 418 |
417 // Subclass must initialize this in its constructor. | 419 // Subclass must initialize this in its constructor. |
418 SkAutoTUnref<const GrDrawTargetCaps> fCaps; | 420 SkAutoTUnref<const GrDrawTargetCaps> fCaps; |
419 | 421 |
420 private: | 422 private: |
421 // called when the 3D context state is unknown. Subclass should emit any | 423 // called when the 3D context state is unknown. Subclass should emit any |
422 // assumed 3D context state and dirty any state cache. | 424 // assumed 3D context state and dirty any state cache. |
423 virtual void onResetContext(uint32_t resetBits) = 0; | 425 virtual void onResetContext(uint32_t resetBits) = 0; |
424 | 426 |
425 // overridden by backend-specific derived class to create objects. | 427 // overridden by backend-specific derived class to create objects. |
426 virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, | 428 virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, bool budgeted, |
427 const void* srcData, | 429 const void* srcData, size_t rowBytes) = 0
; |
428 size_t rowBytes) = 0; | 430 virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, bool
budgeted, |
429 virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, | |
430 const void* srcData) = 0; | 431 const void* srcData) = 0; |
431 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; | 432 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) = 0; |
432 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&) = 0; | 433 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge
tDesc&) = 0; |
433 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; | 434 virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) = 0; |
434 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; | 435 virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) = 0; |
435 | 436 |
436 // overridden by backend-specific derived class to perform the clear. | 437 // overridden by backend-specific derived class to perform the clear. |
437 virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, | 438 virtual void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, |
438 bool canIgnoreRect) = 0; | 439 bool canIgnoreRect) = 0; |
439 | 440 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 int fGpuTrac
eMarkerCount; | 512 int fGpuTrac
eMarkerCount; |
512 GrTraceMarkerSet fActiveT
raceMarkers; | 513 GrTraceMarkerSet fActiveT
raceMarkers; |
513 GrTraceMarkerSet fStoredT
raceMarkers; | 514 GrTraceMarkerSet fStoredT
raceMarkers; |
514 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 515 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
515 GrContext* fContext
; | 516 GrContext* fContext
; |
516 | 517 |
517 typedef SkRefCnt INHERITED; | 518 typedef SkRefCnt INHERITED; |
518 }; | 519 }; |
519 | 520 |
520 #endif | 521 #endif |
OLD | NEW |