| 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 15 matching lines...) Expand all Loading... |
| 26 class GrGpu; | 26 class GrGpu; |
| 27 class GrGpuTraceMarker; | 27 class GrGpuTraceMarker; |
| 28 class GrIndexBuffer; | 28 class GrIndexBuffer; |
| 29 class GrIndexBufferAllocPool; | 29 class GrIndexBufferAllocPool; |
| 30 class GrInOrderDrawBuffer; | 30 class GrInOrderDrawBuffer; |
| 31 class GrLayerCache; | 31 class GrLayerCache; |
| 32 class GrOvalRenderer; | 32 class GrOvalRenderer; |
| 33 class GrPath; | 33 class GrPath; |
| 34 class GrPathRenderer; | 34 class GrPathRenderer; |
| 35 class GrResourceEntry; | 35 class GrResourceEntry; |
| 36 class GrResourceCache; |
| 36 class GrResourceCache2; | 37 class GrResourceCache2; |
| 37 class GrStencilBuffer; | 38 class GrStencilBuffer; |
| 38 class GrTestTarget; | 39 class GrTestTarget; |
| 39 class GrTextContext; | 40 class GrTextContext; |
| 40 class GrTextureParams; | 41 class GrTextureParams; |
| 41 class GrVertexBuffer; | 42 class GrVertexBuffer; |
| 42 class GrVertexBufferAllocPool; | 43 class GrVertexBufferAllocPool; |
| 43 class GrStrokeInfo; | 44 class GrStrokeInfo; |
| 44 class GrSoftwarePathRenderer; | 45 class GrSoftwarePathRenderer; |
| 45 class SkStrokeRec; | 46 class SkStrokeRec; |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 | 876 |
| 876 /////////////////////////////////////////////////////////////////////////// | 877 /////////////////////////////////////////////////////////////////////////// |
| 877 // Functions intended for internal use only. | 878 // Functions intended for internal use only. |
| 878 GrGpu* getGpu() { return fGpu; } | 879 GrGpu* getGpu() { return fGpu; } |
| 879 const GrGpu* getGpu() const { return fGpu; } | 880 const GrGpu* getGpu() const { return fGpu; } |
| 880 GrFontCache* getFontCache() { return fFontCache; } | 881 GrFontCache* getFontCache() { return fFontCache; } |
| 881 GrLayerCache* getLayerCache() { return fLayerCache.get(); } | 882 GrLayerCache* getLayerCache() { return fLayerCache.get(); } |
| 882 GrDrawTarget* getTextTarget(); | 883 GrDrawTarget* getTextTarget(); |
| 883 const GrIndexBuffer* getQuadIndexBuffer() const; | 884 const GrIndexBuffer* getQuadIndexBuffer() const; |
| 884 GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; } | 885 GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; } |
| 886 GrResourceCache* getResourceCache() { return fResourceCache; } |
| 885 GrResourceCache2* getResourceCache2() { return fResourceCache2; } | 887 GrResourceCache2* getResourceCache2() { return fResourceCache2; } |
| 886 | 888 |
| 887 // Called by tests that draw directly to the context via GrDrawTarget | 889 // Called by tests that draw directly to the context via GrDrawTarget |
| 888 void getTestTarget(GrTestTarget*); | 890 void getTestTarget(GrTestTarget*); |
| 889 | 891 |
| 890 void addGpuTraceMarker(const GrGpuTraceMarker* marker); | 892 void addGpuTraceMarker(const GrGpuTraceMarker* marker); |
| 891 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); | 893 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); |
| 892 | 894 |
| 893 /** | 895 /** |
| 894 * Stencil buffers add themselves to the cache using addStencilBuffer. findS
tencilBuffer is | 896 * Stencil buffers add themselves to the cache using addStencilBuffer. findS
tencilBuffer is |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 const GPUStats* gpuStats() const; | 941 const GPUStats* gpuStats() const; |
| 940 #endif | 942 #endif |
| 941 | 943 |
| 942 private: | 944 private: |
| 943 GrGpu* fGpu; | 945 GrGpu* fGpu; |
| 944 SkMatrix fViewMatrix; | 946 SkMatrix fViewMatrix; |
| 945 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 947 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
| 946 const GrClipData* fClip; // TODO: make this ref counted | 948 const GrClipData* fClip; // TODO: make this ref counted |
| 947 GrDrawState* fDrawState; | 949 GrDrawState* fDrawState; |
| 948 | 950 |
| 951 GrResourceCache* fResourceCache; |
| 949 GrResourceCache2* fResourceCache2; | 952 GrResourceCache2* fResourceCache2; |
| 950 GrFontCache* fFontCache; | 953 GrFontCache* fFontCache; |
| 951 SkAutoTDelete<GrLayerCache> fLayerCache; | 954 SkAutoTDelete<GrLayerCache> fLayerCache; |
| 952 | 955 |
| 953 GrPathRendererChain* fPathRendererChain; | 956 GrPathRendererChain* fPathRendererChain; |
| 954 GrSoftwarePathRenderer* fSoftwarePathRenderer; | 957 GrSoftwarePathRenderer* fSoftwarePathRenderer; |
| 955 | 958 |
| 956 GrVertexBufferAllocPool* fDrawBufferVBAllocPool; | 959 GrVertexBufferAllocPool* fDrawBufferVBAllocPool; |
| 957 GrIndexBufferAllocPool* fDrawBufferIBAllocPool; | 960 GrIndexBufferAllocPool* fDrawBufferIBAllocPool; |
| 958 GrInOrderDrawBuffer* fDrawBuffer; | 961 GrInOrderDrawBuffer* fDrawBuffer; |
| 959 | 962 |
| 963 // Set by OverbudgetCB() to request that GrContext flush before exiting a dr
aw. |
| 964 bool fFlushToReduceCacheSize; |
| 965 |
| 960 GrAARectRenderer* fAARectRenderer; | 966 GrAARectRenderer* fAARectRenderer; |
| 961 GrOvalRenderer* fOvalRenderer; | 967 GrOvalRenderer* fOvalRenderer; |
| 962 | 968 |
| 963 bool fDidTestPMConversions; | 969 bool fDidTestPMConversions; |
| 964 int fPMToUPMConversion; | 970 int fPMToUPMConversion; |
| 965 int fUPMToPMConversion; | 971 int fUPMToPMConversion; |
| 966 | 972 |
| 967 struct CleanUpData { | 973 struct CleanUpData { |
| 968 PFCleanUpFunc fFunc; | 974 PFCleanUpFunc fFunc; |
| 969 void* fInfo; | 975 void* fInfo; |
| 970 }; | 976 }; |
| 971 | 977 |
| 972 SkTDArray<CleanUpData> fCleanUpData; | 978 SkTDArray<CleanUpData> fCleanUpData; |
| 973 | 979 |
| 974 int fMaxTextureSizeOverride; | 980 int fMaxTextureSizeOverride; |
| 975 | 981 |
| 976 const Options fOptions; | 982 const Options fOptions; |
| 977 | 983 |
| 978 GrContext(const Options&); // init must be called after the constructor. | 984 GrContext(const Options&); // init must be called after the constructor. |
| 979 bool init(GrBackend, GrBackendContext); | 985 bool init(GrBackend, GrBackendContext); |
| 980 void initMockContext(); | 986 void initMockContext(); |
| 981 void initCommon(); | 987 void initCommon(); |
| 982 | 988 |
| 983 void setupDrawBuffer(); | 989 void setupDrawBuffer(); |
| 984 | 990 |
| 985 class AutoRestoreEffects; | 991 class AutoRestoreEffects; |
| 992 class AutoCheckFlush; |
| 986 /// Sets the paint and returns the target to draw into. The paint can be NUL
L in which case the | 993 /// Sets the paint and returns the target to draw into. The paint can be NUL
L in which case the |
| 987 /// draw state is left unmodified. | 994 /// draw state is left unmodified. |
| 988 GrDrawTarget* prepareToDraw(const GrPaint*, AutoRestoreEffects*); | 995 GrDrawTarget* prepareToDraw(const GrPaint*, AutoRestoreEffects*, AutoCheckFl
ush*); |
| 989 | 996 |
| 990 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path, | 997 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path, |
| 991 const GrStrokeInfo& stroke); | 998 const GrStrokeInfo& stroke); |
| 992 | 999 |
| 993 GrTexture* createResizedTexture(const GrSurfaceDesc& desc, | 1000 GrTexture* createResizedTexture(const GrSurfaceDesc& desc, |
| 994 const GrCacheID& cacheID, | 1001 const GrCacheID& cacheID, |
| 995 const void* srcData, | 1002 const void* srcData, |
| 996 size_t rowBytes, | 1003 size_t rowBytes, |
| 997 bool filter); | 1004 bool filter); |
| 998 | 1005 |
| 1006 GrTexture* createNewScratchTexture(const GrSurfaceDesc& desc); |
| 1007 |
| 999 /** | 1008 /** |
| 1000 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair | 1009 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair |
| 1001 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they | 1010 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they |
| 1002 * return NULL. | 1011 * return NULL. |
| 1003 */ | 1012 */ |
| 1004 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); | 1013 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
| 1005 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); | 1014 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
| 1006 | 1015 |
| 1007 /** | 1016 /** |
| 1008 * This callback allows the resource cache to callback into the GrContext | 1017 * This callback allows the resource cache to callback into the GrContext |
| 1009 * when the cache is still over budget after a purge. | 1018 * when the cache is still overbudget after a purge. |
| 1010 */ | 1019 */ |
| 1011 static void OverBudgetCB(void* data); | 1020 static bool OverbudgetCB(void* data); |
| 1012 | 1021 |
| 1013 typedef SkRefCnt INHERITED; | 1022 typedef SkRefCnt INHERITED; |
| 1014 }; | 1023 }; |
| 1015 | 1024 |
| 1016 #endif | 1025 #endif |
| OLD | NEW |