OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef GrContext_DEFINED | 10 #ifndef GrContext_DEFINED |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 */ | 49 */ |
50 static GrContext* Create(GrBackend, GrBackendContext); | 50 static GrContext* Create(GrBackend, GrBackendContext); |
51 | 51 |
52 /** | 52 /** |
53 * Returns the number of GrContext instances for the current thread. | 53 * Returns the number of GrContext instances for the current thread. |
54 */ | 54 */ |
55 static int GetThreadInstanceCount(); | 55 static int GetThreadInstanceCount(); |
56 | 56 |
57 virtual ~GrContext(); | 57 virtual ~GrContext(); |
58 | 58 |
59 enum GrState { | |
bsalomon
2013/06/18 10:16:32
For enums that are nested within a class we don't
| |
60 kGrState_RenderTarget = 0x01 << 0, | |
61 kGrState_Texture = 0x01 << 1, | |
bsalomon
2013/06/18 10:16:32
TextureBindings?
| |
62 kGrState_View = 0x01 << 2, | |
bsalomon
2013/06/18 10:16:32
View could use a comment, not obvious what state i
| |
63 kGrState_Blend = 0x01 << 3, | |
64 kGrState_AA = 0x01 << 4, | |
65 kGrState_Vertex = 0x01 << 5, | |
66 kGrState_Stencil = 0x01 << 6, | |
67 kGrState_PixelStore = 0x01 << 7, | |
68 kGrState_Program = 0x01 << 8, | |
69 kGrState_PathStencil = 0x01 << 9, | |
70 kGrState_Misc = 0x01 << 10, | |
71 kGrState_ALL = 0xffff | |
72 }; | |
59 /** | 73 /** |
60 * The GrContext normally assumes that no outsider is setting state | 74 * The GrContext normally assumes that no outsider is setting state |
61 * 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 |
62 * 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 |
63 * be called frequently for good performance. | 77 * be called frequently for good performance. |
64 */ | 78 */ |
65 void resetContext(); | 79 void resetContext(GrState state = kGrState_ALL); |
80 | |
81 /** | |
82 * Similiar to resetContext, but only reset texture binding state. | |
83 */ | |
84 void resetTextureBinding(); | |
bsalomon
2013/06/18 10:16:32
Let's just stick with the one resetContext() call
| |
66 | 85 |
67 /** | 86 /** |
68 * Callback function to allow classes to cleanup on GrContext destruction. | 87 * Callback function to allow classes to cleanup on GrContext destruction. |
69 * The 'info' field is filled in with the 'info' passed to addCleanUp. | 88 * The 'info' field is filled in with the 'info' passed to addCleanUp. |
70 */ | 89 */ |
71 typedef void (*PFCleanUpFunc)(const GrContext* context, void* info); | 90 typedef void (*PFCleanUpFunc)(const GrContext* context, void* info); |
72 | 91 |
73 /** | 92 /** |
74 * Add a function to be called from within GrContext's destructor. | 93 * Add a function to be called from within GrContext's destructor. |
75 * This gives classes a chance to free resources held on a per context basis . | 94 * This gives classes a chance to free resources held on a per context basis . |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1020 } | 1039 } |
1021 | 1040 |
1022 GrTexture* texture() { return fTexture; } | 1041 GrTexture* texture() { return fTexture; } |
1023 | 1042 |
1024 private: | 1043 private: |
1025 GrContext* fContext; | 1044 GrContext* fContext; |
1026 GrTexture* fTexture; | 1045 GrTexture* fTexture; |
1027 }; | 1046 }; |
1028 | 1047 |
1029 #endif | 1048 #endif |
OLD | NEW |