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