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