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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); | 891 void removeGpuTraceMarker(const GrGpuTraceMarker* marker); |
892 | 892 |
893 /** | 893 /** |
894 * 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 |
895 * called to check the cache for a SB that matches an RT's criteria. | 895 * called to check the cache for a SB that matches an RT's criteria. |
896 */ | 896 */ |
897 void addStencilBuffer(GrStencilBuffer* sb); | 897 void addStencilBuffer(GrStencilBuffer* sb); |
898 GrStencilBuffer* findAndRefStencilBuffer(int width, int height, int sampleCn
t); | 898 GrStencilBuffer* findAndRefStencilBuffer(int width, int height, int sampleCn
t); |
899 | 899 |
900 GrPathRenderer* getPathRenderer( | 900 GrPathRenderer* getPathRenderer( |
| 901 const GrDrawTarget* target, |
| 902 const GrDrawState*, |
901 const SkPath& path, | 903 const SkPath& path, |
902 const SkStrokeRec& stroke, | 904 const SkStrokeRec& stroke, |
903 const GrDrawTarget* target, | |
904 bool allowSW, | 905 bool allowSW, |
905 GrPathRendererChain::DrawType drawType = GrPathRendererChain
::kColor_DrawType, | 906 GrPathRendererChain::DrawType drawType = GrPathRendererChain
::kColor_DrawType, |
906 GrPathRendererChain::StencilSupport* stencilSupport = NULL); | 907 GrPathRendererChain::StencilSupport* stencilSupport = NULL); |
907 | 908 |
908 /** | 909 /** |
909 * This returns a copy of the the GrContext::Options that was passed to the | 910 * This returns a copy of the the GrContext::Options that was passed to the |
910 * constructor of this class. | 911 * constructor of this class. |
911 */ | 912 */ |
912 const Options& getOptions() const { return fOptions; } | 913 const Options& getOptions() const { return fOptions; } |
913 | 914 |
(...skipping 23 matching lines...) Expand all Loading... |
937 | 938 |
938 #if GR_GPU_STATS | 939 #if GR_GPU_STATS |
939 const GPUStats* gpuStats() const; | 940 const GPUStats* gpuStats() const; |
940 #endif | 941 #endif |
941 | 942 |
942 private: | 943 private: |
943 GrGpu* fGpu; | 944 GrGpu* fGpu; |
944 SkMatrix fViewMatrix; | 945 SkMatrix fViewMatrix; |
945 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 946 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
946 const GrClipData* fClip; // TODO: make this ref counted | 947 const GrClipData* fClip; // TODO: make this ref counted |
947 GrDrawState* fDrawState; | |
948 | 948 |
949 GrResourceCache2* fResourceCache2; | 949 GrResourceCache2* fResourceCache2; |
950 GrFontCache* fFontCache; | 950 GrFontCache* fFontCache; |
951 SkAutoTDelete<GrLayerCache> fLayerCache; | 951 SkAutoTDelete<GrLayerCache> fLayerCache; |
952 | 952 |
953 GrPathRendererChain* fPathRendererChain; | 953 GrPathRendererChain* fPathRendererChain; |
954 GrSoftwarePathRenderer* fSoftwarePathRenderer; | 954 GrSoftwarePathRenderer* fSoftwarePathRenderer; |
955 | 955 |
956 GrVertexBufferAllocPool* fDrawBufferVBAllocPool; | 956 GrVertexBufferAllocPool* fDrawBufferVBAllocPool; |
957 GrIndexBufferAllocPool* fDrawBufferIBAllocPool; | 957 GrIndexBufferAllocPool* fDrawBufferIBAllocPool; |
(...skipping 19 matching lines...) Expand all Loading... |
977 | 977 |
978 const Options fOptions; | 978 const Options fOptions; |
979 | 979 |
980 GrContext(const Options&); // init must be called after the constructor. | 980 GrContext(const Options&); // init must be called after the constructor. |
981 bool init(GrBackend, GrBackendContext); | 981 bool init(GrBackend, GrBackendContext); |
982 void initMockContext(); | 982 void initMockContext(); |
983 void initCommon(); | 983 void initCommon(); |
984 | 984 |
985 void setupDrawBuffer(); | 985 void setupDrawBuffer(); |
986 | 986 |
987 class AutoRestoreEffects; | |
988 class AutoCheckFlush; | 987 class AutoCheckFlush; |
989 /// Sets the paint and returns the target to draw into. The paint can be NUL
L in which case the | 988 /// Sets the paint and returns the target to draw into. The paint can be NUL
L in which case the |
990 /// draw state is left unmodified. | 989 /// draw state is left unmodified. |
991 GrDrawTarget* prepareToDraw(const GrPaint*, AutoRestoreEffects*, AutoCheckFl
ush*); | 990 GrDrawTarget* prepareToDraw(GrDrawState* ds, const GrPaint* paint, const Aut
oCheckFlush*); |
992 | 991 |
993 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path, | 992 void internalDrawPath(GrDrawTarget*, |
994 const GrStrokeInfo& stroke); | 993 GrDrawState*, |
| 994 bool useAA, |
| 995 const SkPath&, |
| 996 const GrStrokeInfo&); |
995 | 997 |
996 GrTexture* createResizedTexture(const GrSurfaceDesc& desc, | 998 GrTexture* createResizedTexture(const GrSurfaceDesc& desc, |
997 const GrCacheID& cacheID, | 999 const GrCacheID& cacheID, |
998 const void* srcData, | 1000 const void* srcData, |
999 size_t rowBytes, | 1001 size_t rowBytes, |
1000 bool filter); | 1002 bool filter); |
1001 | 1003 |
1002 /** | 1004 /** |
1003 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair | 1005 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair |
1004 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they | 1006 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they |
1005 * return NULL. | 1007 * return NULL. |
1006 */ | 1008 */ |
1007 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); | 1009 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
1008 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); | 1010 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
1009 | 1011 |
1010 /** | 1012 /** |
1011 * This callback allows the resource cache to callback into the GrContext | 1013 * This callback allows the resource cache to callback into the GrContext |
1012 * when the cache is still over budget after a purge. | 1014 * when the cache is still over budget after a purge. |
1013 */ | 1015 */ |
1014 static void OverBudgetCB(void* data); | 1016 static void OverBudgetCB(void* data); |
1015 | 1017 |
1016 typedef SkRefCnt INHERITED; | 1018 typedef SkRefCnt INHERITED; |
1017 }; | 1019 }; |
1018 | 1020 |
1019 #endif | 1021 #endif |
OLD | NEW |