| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrContext_DEFINED | 8 #ifndef GrContext_DEFINED |
| 9 #define GrContext_DEFINED | 9 #define GrContext_DEFINED |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 class GrPipelineBuilder; | 34 class GrPipelineBuilder; |
| 35 class GrResourceEntry; | 35 class GrResourceEntry; |
| 36 class GrResourceCache; | 36 class GrResourceCache; |
| 37 class GrTestTarget; | 37 class GrTestTarget; |
| 38 class GrTextContext; | 38 class GrTextContext; |
| 39 class GrTextureParams; | 39 class GrTextureParams; |
| 40 class GrVertexBuffer; | 40 class GrVertexBuffer; |
| 41 class GrVertexBufferAllocPool; | 41 class GrVertexBufferAllocPool; |
| 42 class GrStrokeInfo; | 42 class GrStrokeInfo; |
| 43 class GrSoftwarePathRenderer; | 43 class GrSoftwarePathRenderer; |
| 44 class SkGpuDevice; |
| 44 class SkStrokeRec; | 45 class SkStrokeRec; |
| 45 | 46 |
| 46 class SK_API GrContext : public SkRefCnt { | 47 class SK_API GrContext : public SkRefCnt { |
| 47 public: | 48 public: |
| 48 SK_DECLARE_INST_COUNT(GrContext) | 49 SK_DECLARE_INST_COUNT(GrContext) |
| 49 | 50 |
| 50 struct Options { | 51 struct Options { |
| 51 Options() : fDrawPathToCompressedTexture(false) { } | 52 Options() : fDrawPathToCompressedTexture(false) { } |
| 52 | 53 |
| 53 // EXPERIMENTAL | 54 // EXPERIMENTAL |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return NULL; | 195 return NULL; |
| 195 } | 196 } |
| 196 | 197 |
| 197 /** | 198 /** |
| 198 * Determines whether a resource is in the cache. If the resource is found i
t | 199 * Determines whether a resource is in the cache. If the resource is found i
t |
| 199 * will not be locked or returned. This call does not affect the priority of | 200 * will not be locked or returned. This call does not affect the priority of |
| 200 * the resource for deletion. | 201 * the resource for deletion. |
| 201 */ | 202 */ |
| 202 bool isResourceInCache(const GrUniqueKey& key) const; | 203 bool isResourceInCache(const GrUniqueKey& key) const; |
| 203 | 204 |
| 204 /** | |
| 205 * Creates a new text rendering context that is optimal for the | |
| 206 * render target and the context. Caller assumes the ownership | |
| 207 * of the returned object. The returned object must be deleted | |
| 208 * before the context is destroyed. | |
| 209 */ | |
| 210 GrTextContext* createTextContext(GrRenderTarget*, | |
| 211 const SkDeviceProperties&, | |
| 212 bool enableDistanceFieldFonts); | |
| 213 | |
| 214 /////////////////////////////////////////////////////////////////////////// | 205 /////////////////////////////////////////////////////////////////////////// |
| 215 // Textures | 206 // Textures |
| 216 | 207 |
| 217 /** | 208 /** |
| 218 * Creates a new texture in the resource cache and returns it. The caller ow
ns a | 209 * Creates a new texture in the resource cache and returns it. The caller ow
ns a |
| 219 * ref on the returned texture which must be balanced by a call to unref. | 210 * ref on the returned texture which must be balanced by a call to unref. |
| 220 * | 211 * |
| 221 * @param desc Description of the texture properties. | 212 * @param desc Description of the texture properties. |
| 222 * @param budgeted Does the texture count against the resource cache budget
? | 213 * @param budgeted Does the texture count against the resource cache budget
? |
| 223 * @param srcData Pointer to the pixel values (optional). | 214 * @param srcData Pointer to the pixel values (optional). |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 GrPipelineBuilder*, | 747 GrPipelineBuilder*, |
| 757 const SkMatrix& viewMatrix, | 748 const SkMatrix& viewMatrix, |
| 758 GrColor, | 749 GrColor, |
| 759 bool useAA, | 750 bool useAA, |
| 760 const SkPath&, | 751 const SkPath&, |
| 761 const GrStrokeInfo&); | 752 const GrStrokeInfo&); |
| 762 | 753 |
| 763 GrTexture* internalRefScratchTexture(const GrSurfaceDesc&, uint32_t flags); | 754 GrTexture* internalRefScratchTexture(const GrSurfaceDesc&, uint32_t flags); |
| 764 | 755 |
| 765 /** | 756 /** |
| 757 * Creates a new text rendering context that is optimal for the |
| 758 * render target and the context. Caller assumes the ownership |
| 759 * of the returned object. The returned object must be deleted |
| 760 * before the context is destroyed. |
| 761 * TODO we can possibly bury this behind context, but we need to be able to
use the |
| 762 * drawText_asPaths logic on SkGpuDevice |
| 763 */ |
| 764 GrTextContext* createTextContext(GrRenderTarget*, |
| 765 SkGpuDevice*, |
| 766 const SkDeviceProperties&, |
| 767 bool enableDistanceFieldFonts); |
| 768 |
| 769 |
| 770 /** |
| 766 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair | 771 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair |
| 767 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they | 772 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they |
| 768 * return NULL. | 773 * return NULL. |
| 769 */ | 774 */ |
| 770 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); | 775 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
| 771 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); | 776 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
| 772 | 777 |
| 773 /** | 778 /** |
| 774 * This callback allows the resource cache to callback into the GrContext | 779 * This callback allows the resource cache to callback into the GrContext |
| 775 * when the cache is still over budget after a purge. | 780 * when the cache is still over budget after a purge. |
| 776 */ | 781 */ |
| 777 static void OverBudgetCB(void* data); | 782 static void OverBudgetCB(void* data); |
| 778 | 783 |
| 784 // TODO see note on createTextContext |
| 785 friend class SkGpuDevice; |
| 786 |
| 779 typedef SkRefCnt INHERITED; | 787 typedef SkRefCnt INHERITED; |
| 780 }; | 788 }; |
| 781 | 789 |
| 782 #endif | 790 #endif |
| OLD | NEW |