| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class GrVertexBuffer; | 42 class GrVertexBuffer; |
| 43 class GrVertexBufferAllocPool; | 43 class GrVertexBufferAllocPool; |
| 44 class GrStrokeInfo; | 44 class GrStrokeInfo; |
| 45 class GrSoftwarePathRenderer; | 45 class GrSoftwarePathRenderer; |
| 46 class SkStrokeRec; | 46 class SkStrokeRec; |
| 47 | 47 |
| 48 class SK_API GrContext : public SkRefCnt { | 48 class SK_API GrContext : public SkRefCnt { |
| 49 public: | 49 public: |
| 50 SK_DECLARE_INST_COUNT(GrContext) | 50 SK_DECLARE_INST_COUNT(GrContext) |
| 51 | 51 |
| 52 struct Options { |
| 53 Options() : fDrawPathToCompressedTexture(false) { } |
| 54 |
| 55 // EXPERIMENTAL |
| 56 // May be removed in the future, or may become standard depending |
| 57 // on the outcomes of a variety of internal tests. |
| 58 bool fDrawPathToCompressedTexture; |
| 59 }; |
| 60 |
| 52 /** | 61 /** |
| 53 * Creates a GrContext for a backend context. | 62 * Creates a GrContext for a backend context. |
| 54 */ | 63 */ |
| 55 static GrContext* Create(GrBackend, GrBackendContext); | 64 static GrContext* Create(GrBackend, GrBackendContext, const Options* opts =
NULL); |
| 56 | 65 |
| 57 virtual ~GrContext(); | 66 virtual ~GrContext(); |
| 58 | 67 |
| 59 /** | 68 /** |
| 60 * The GrContext normally assumes that no outsider is setting state | 69 * The GrContext normally assumes that no outsider is setting state |
| 61 * within the underlying 3D API's context/device/whatever. This call informs | 70 * 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 | 71 * the context that the state was modified and it should resend. Shouldn't |
| 63 * be called frequently for good performance. | 72 * be called frequently for good performance. |
| 64 * The flag bits, state, is dpendent on which backend is used by the | 73 * The flag bits, state, is dpendent on which backend is used by the |
| 65 * context, either GL or D3D (possible in future). | 74 * context, either GL or D3D (possible in future). |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 GrStencilBuffer* findStencilBuffer(int width, int height, int sampleCnt); | 941 GrStencilBuffer* findStencilBuffer(int width, int height, int sampleCnt); |
| 933 | 942 |
| 934 GrPathRenderer* getPathRenderer( | 943 GrPathRenderer* getPathRenderer( |
| 935 const SkPath& path, | 944 const SkPath& path, |
| 936 const SkStrokeRec& stroke, | 945 const SkStrokeRec& stroke, |
| 937 const GrDrawTarget* target, | 946 const GrDrawTarget* target, |
| 938 bool allowSW, | 947 bool allowSW, |
| 939 GrPathRendererChain::DrawType drawType = GrPathRendererChain
::kColor_DrawType, | 948 GrPathRendererChain::DrawType drawType = GrPathRendererChain
::kColor_DrawType, |
| 940 GrPathRendererChain::StencilSupport* stencilSupport = NULL); | 949 GrPathRendererChain::StencilSupport* stencilSupport = NULL); |
| 941 | 950 |
| 951 /** |
| 952 * This returns a copy of the the GrContext::Options that was passed to the |
| 953 * constructor of this class. |
| 954 */ |
| 955 const Options& getOptions() const { return fOptions; } |
| 956 |
| 942 #if GR_CACHE_STATS | 957 #if GR_CACHE_STATS |
| 943 void printCacheStats() const; | 958 void printCacheStats() const; |
| 944 #endif | 959 #endif |
| 945 | 960 |
| 946 private: | 961 private: |
| 947 // Used to indicate whether a draw should be performed immediately or queued
in fDrawBuffer. | 962 // Used to indicate whether a draw should be performed immediately or queued
in fDrawBuffer. |
| 948 enum BufferedDraw { | 963 enum BufferedDraw { |
| 949 kYes_BufferedDraw, | 964 kYes_BufferedDraw, |
| 950 kNo_BufferedDraw, | 965 kNo_BufferedDraw, |
| 951 }; | 966 }; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 980 | 995 |
| 981 struct CleanUpData { | 996 struct CleanUpData { |
| 982 PFCleanUpFunc fFunc; | 997 PFCleanUpFunc fFunc; |
| 983 void* fInfo; | 998 void* fInfo; |
| 984 }; | 999 }; |
| 985 | 1000 |
| 986 SkTDArray<CleanUpData> fCleanUpData; | 1001 SkTDArray<CleanUpData> fCleanUpData; |
| 987 | 1002 |
| 988 int fMaxTextureSizeOverride; | 1003 int fMaxTextureSizeOverride; |
| 989 | 1004 |
| 990 GrContext(); // init must be called after the constructor. | 1005 const Options fOptions; |
| 1006 |
| 1007 GrContext(const Options&); // init must be called after the constructor. |
| 991 bool init(GrBackend, GrBackendContext); | 1008 bool init(GrBackend, GrBackendContext); |
| 992 | 1009 |
| 993 void setupDrawBuffer(); | 1010 void setupDrawBuffer(); |
| 994 | 1011 |
| 995 class AutoRestoreEffects; | 1012 class AutoRestoreEffects; |
| 996 class AutoCheckFlush; | 1013 class AutoCheckFlush; |
| 997 /// Sets the paint and returns the target to draw into. The paint can be NUL
L in which case the | 1014 /// Sets the paint and returns the target to draw into. The paint can be NUL
L in which case the |
| 998 /// draw state is left unmodified. | 1015 /// draw state is left unmodified. |
| 999 GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects
*, AutoCheckFlush*); | 1016 GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects
*, AutoCheckFlush*); |
| 1000 | 1017 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 } | 1144 } |
| 1128 | 1145 |
| 1129 GrTexture* texture() { return fTexture; } | 1146 GrTexture* texture() { return fTexture; } |
| 1130 | 1147 |
| 1131 private: | 1148 private: |
| 1132 GrContext* fContext; | 1149 GrContext* fContext; |
| 1133 GrTexture* fTexture; | 1150 GrTexture* fTexture; |
| 1134 }; | 1151 }; |
| 1135 | 1152 |
| 1136 #endif | 1153 #endif |
| OLD | NEW |