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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // May be removed in the future, or may become standard depending | 56 // May be removed in the future, or may become standard depending |
57 // on the outcomes of a variety of internal tests. | 57 // on the outcomes of a variety of internal tests. |
58 bool fDrawPathToCompressedTexture; | 58 bool fDrawPathToCompressedTexture; |
59 }; | 59 }; |
60 | 60 |
61 /** | 61 /** |
62 * Creates a GrContext for a backend context. | 62 * Creates a GrContext for a backend context. |
63 */ | 63 */ |
64 static GrContext* Create(GrBackend, GrBackendContext, const Options* opts =
NULL); | 64 static GrContext* Create(GrBackend, GrBackendContext, const Options* opts =
NULL); |
65 | 65 |
| 66 /** |
| 67 * Only defined in test apps. |
| 68 */ |
| 69 static GrContext* CreateMockContext(); |
| 70 |
66 virtual ~GrContext(); | 71 virtual ~GrContext(); |
67 | 72 |
68 /** | 73 /** |
69 * The GrContext normally assumes that no outsider is setting state | 74 * The GrContext normally assumes that no outsider is setting state |
70 * within the underlying 3D API's context/device/whatever. This call informs | 75 * within the underlying 3D API's context/device/whatever. This call informs |
71 * the context that the state was modified and it should resend. Shouldn't | 76 * the context that the state was modified and it should resend. Shouldn't |
72 * be called frequently for good performance. | 77 * be called frequently for good performance. |
73 * The flag bits, state, is dpendent on which backend is used by the | 78 * The flag bits, state, is dpendent on which backend is used by the |
74 * context, either GL or D3D (possible in future). | 79 * context, either GL or D3D (possible in future). |
75 */ | 80 */ |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 }; | 976 }; |
972 | 977 |
973 SkTDArray<CleanUpData> fCleanUpData; | 978 SkTDArray<CleanUpData> fCleanUpData; |
974 | 979 |
975 int fMaxTextureSizeOverride; | 980 int fMaxTextureSizeOverride; |
976 | 981 |
977 const Options fOptions; | 982 const Options fOptions; |
978 | 983 |
979 GrContext(const Options&); // init must be called after the constructor. | 984 GrContext(const Options&); // init must be called after the constructor. |
980 bool init(GrBackend, GrBackendContext); | 985 bool init(GrBackend, GrBackendContext); |
| 986 void initMockContext(); |
| 987 void initCommon(); |
981 | 988 |
982 void setupDrawBuffer(); | 989 void setupDrawBuffer(); |
983 | 990 |
984 class AutoRestoreEffects; | 991 class AutoRestoreEffects; |
985 class AutoCheckFlush; | 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*, AutoCheckFl
ush*); | 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, |
(...skipping 18 matching lines...) Expand all Loading... |
1009 /** | 1016 /** |
1010 * This callback allows the resource cache to callback into the GrContext | 1017 * This callback allows the resource cache to callback into the GrContext |
1011 * when the cache is still overbudget after a purge. | 1018 * when the cache is still overbudget after a purge. |
1012 */ | 1019 */ |
1013 static bool OverbudgetCB(void* data); | 1020 static bool OverbudgetCB(void* data); |
1014 | 1021 |
1015 typedef SkRefCnt INHERITED; | 1022 typedef SkRefCnt INHERITED; |
1016 }; | 1023 }; |
1017 | 1024 |
1018 #endif | 1025 #endif |
OLD | NEW |