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 |
11 #include "GrClipData.h" | 11 #include "GrClipData.h" |
12 #include "GrColor.h" | 12 #include "GrColor.h" |
13 #include "GrPaint.h" | 13 #include "GrPaint.h" |
14 #include "GrPathRendererChain.h" | 14 #include "GrPathRendererChain.h" |
15 #include "GrRenderTarget.h" | 15 #include "GrRenderTarget.h" |
16 #include "GrTexture.h" | 16 #include "GrTexture.h" |
17 #include "SkMatrix.h" | 17 #include "SkMatrix.h" |
18 #include "SkPathEffect.h" | 18 #include "SkPathEffect.h" |
19 #include "SkTypes.h" | 19 #include "SkTypes.h" |
20 | 20 |
21 class GrAARectRenderer; | 21 class GrAARectRenderer; |
22 class GrAutoScratchTexture; | 22 class GrAutoScratchTexture; |
23 class GrDrawState; | 23 class GrDrawState; |
24 class GrDrawTarget; | 24 class GrDrawTarget; |
25 class GrEffect; | |
26 class GrFontCache; | 25 class GrFontCache; |
| 26 class GrFragmentProcessor; |
27 class GrGpu; | 27 class GrGpu; |
28 class GrGpuTraceMarker; | 28 class GrGpuTraceMarker; |
29 class GrIndexBuffer; | 29 class GrIndexBuffer; |
30 class GrIndexBufferAllocPool; | 30 class GrIndexBufferAllocPool; |
31 class GrInOrderDrawBuffer; | 31 class GrInOrderDrawBuffer; |
32 class GrLayerCache; | 32 class GrLayerCache; |
33 class GrOvalRenderer; | 33 class GrOvalRenderer; |
34 class GrPath; | 34 class GrPath; |
35 class GrPathRenderer; | 35 class GrPathRenderer; |
36 class GrResourceEntry; | 36 class GrResourceEntry; |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 } | 752 } |
753 private: | 753 private: |
754 GrContext* fContext; | 754 GrContext* fContext; |
755 GrRenderTarget* fPrevTarget; | 755 GrRenderTarget* fPrevTarget; |
756 }; | 756 }; |
757 | 757 |
758 /** | 758 /** |
759 * Save/restore the view-matrix in the context. It can optionally adjust a p
aint to account | 759 * Save/restore the view-matrix in the context. It can optionally adjust a p
aint to account |
760 * for a coordinate system change. Here is an example of how the paint param
can be used: | 760 * for a coordinate system change. Here is an example of how the paint param
can be used: |
761 * | 761 * |
762 * A GrPaint is setup with GrEffects. The stages will have access to the pre
-matrix source | 762 * A GrPaint is setup with GrProcessors. The stages will have access to the
pre-matrix source |
763 * geometry positions when the draw is executed. Later on a decision is made
to transform the | 763 * geometry positions when the draw is executed. Later on a decision is made
to transform the |
764 * geometry to device space on the CPU. The effects now need to know that th
e space in which | 764 * geometry to device space on the CPU. The effects now need to know that th
e space in which |
765 * the geometry will be specified has changed. | 765 * the geometry will be specified has changed. |
766 * | 766 * |
767 * Note that when restore is called (or in the destructor) the context's mat
rix will be | 767 * Note that when restore is called (or in the destructor) the context's mat
rix will be |
768 * restored. However, the paint will not be restored. The caller must make a
copy of the | 768 * restored. However, the paint will not be restored. The caller must make a
copy of the |
769 * paint if necessary. Hint: use SkTCopyOnFirstWrite if the AutoMatrix is co
nditionally | 769 * paint if necessary. Hint: use SkTCopyOnFirstWrite if the AutoMatrix is co
nditionally |
770 * initialized. | 770 * initialized. |
771 */ | 771 */ |
772 class AutoMatrix : public ::SkNoncopyable { | 772 class AutoMatrix : public ::SkNoncopyable { |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 | 1059 |
1060 // Add an existing texture to the texture cache. This is intended solely | 1060 // Add an existing texture to the texture cache. This is intended solely |
1061 // for use with textures released from an GrAutoScratchTexture. | 1061 // for use with textures released from an GrAutoScratchTexture. |
1062 void addExistingTextureToCache(GrTexture* texture); | 1062 void addExistingTextureToCache(GrTexture* texture); |
1063 | 1063 |
1064 /** | 1064 /** |
1065 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair | 1065 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair |
1066 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they | 1066 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they |
1067 * return NULL. | 1067 * return NULL. |
1068 */ | 1068 */ |
1069 const GrEffect* createPMToUPMEffect(GrTexture* texture, | 1069 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
1070 bool swapRAndB, | 1070 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
1071 const SkMatrix& matrix); | |
1072 const GrEffect* createUPMToPMEffect(GrTexture* texture, | |
1073 bool swapRAndB, | |
1074 const SkMatrix& matrix); | |
1075 | 1071 |
1076 /** | 1072 /** |
1077 * This callback allows the resource cache to callback into the GrContext | 1073 * This callback allows the resource cache to callback into the GrContext |
1078 * when the cache is still overbudget after a purge. | 1074 * when the cache is still overbudget after a purge. |
1079 */ | 1075 */ |
1080 static bool OverbudgetCB(void* data); | 1076 static bool OverbudgetCB(void* data); |
1081 | 1077 |
1082 typedef SkRefCnt INHERITED; | 1078 typedef SkRefCnt INHERITED; |
1083 }; | 1079 }; |
1084 | 1080 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 } | 1158 } |
1163 | 1159 |
1164 GrTexture* texture() { return fTexture; } | 1160 GrTexture* texture() { return fTexture; } |
1165 | 1161 |
1166 private: | 1162 private: |
1167 GrContext* fContext; | 1163 GrContext* fContext; |
1168 GrTexture* fTexture; | 1164 GrTexture* fTexture; |
1169 }; | 1165 }; |
1170 | 1166 |
1171 #endif | 1167 #endif |
OLD | NEW |