OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrDrawingManager_DEFINED | 8 #ifndef GrDrawingManager_DEFINED |
9 #define GrDrawingManager_DEFINED | 9 #define GrDrawingManager_DEFINED |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // | 29 // |
30 // In the future this class will allocate a new GrDrawContext for | 30 // In the future this class will allocate a new GrDrawContext for |
31 // each GrRenderTarget/GrDrawTarget and manage the DAG. | 31 // each GrRenderTarget/GrDrawTarget and manage the DAG. |
32 class GrDrawingManager { | 32 class GrDrawingManager { |
33 public: | 33 public: |
34 ~GrDrawingManager(); | 34 ~GrDrawingManager(); |
35 | 35 |
36 bool abandoned() const { return fAbandoned; } | 36 bool abandoned() const { return fAbandoned; } |
37 void freeGpuResources(); | 37 void freeGpuResources(); |
38 | 38 |
39 GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps* surface
Props); | 39 GrDrawContext* drawContext(GrRenderTarget* rt, const SkSurfaceProps*); |
40 | 40 |
41 GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget* rt); | 41 GrTextContext* textContext(const SkSurfaceProps& props, GrRenderTarget* rt); |
42 | 42 |
43 // The caller automatically gets a ref on the returned drawTarget. It must | 43 // The caller automatically gets a ref on the returned drawTarget. It must |
44 // be balanced by an unref call. | 44 // be balanced by an unref call. |
45 GrDrawTarget* newDrawTarget(GrRenderTarget* rt); | 45 GrDrawTarget* newDrawTarget(GrRenderTarget* rt); |
46 | 46 |
47 GrContext* getContext() { return fContext; } | 47 GrContext* getContext() { return fContext; } |
48 | 48 |
49 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, | 49 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, |
50 bool allowSW, | 50 bool allowSW, |
51 GrPathRendererChain::DrawType drawType, | 51 GrPathRendererChain::DrawType drawType, |
52 GrPathRenderer::StencilSupport* stencilSuppo
rt = NULL); | 52 GrPathRenderer::StencilSupport* stencilSuppo
rt = NULL); |
53 | 53 |
54 static bool ProgramUnitTest(GrContext* context, int maxStages); | 54 static bool ProgramUnitTest(GrContext* context, int maxStages); |
55 | 55 |
56 private: | 56 private: |
57 GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsFor
DrawTargets, | 57 GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsFor
DrawTargets, |
58 GrSingleOwner* singleOwner) | 58 GrSingleOwner* singleOwner) |
59 : fContext(context) | 59 : fContext(context) |
60 , fOptionsForDrawTargets(optionsForDrawTargets) | 60 , fOptionsForDrawTargets(optionsForDrawTargets) |
61 , fSingleOwner(singleOwner) | 61 , fSingleOwner(singleOwner) |
62 , fAbandoned(false) | 62 , fAbandoned(false) |
63 , fNVPRTextContext(nullptr) | 63 , fNVPRTextContext(nullptr) |
| 64 , fAtlasTextContext(nullptr) |
64 , fPathRendererChain(nullptr) | 65 , fPathRendererChain(nullptr) |
65 , fSoftwarePathRenderer(nullptr) | 66 , fSoftwarePathRenderer(nullptr) |
66 , fFlushState(context->getGpu(), context->resourceProvider()) | 67 , fFlushState(context->getGpu(), context->resourceProvider()) |
67 , fFlushing(false) { | 68 , fFlushing(false) { |
68 sk_bzero(fTextContexts, sizeof(fTextContexts)); | |
69 } | 69 } |
70 | 70 |
71 void abandon(); | 71 void abandon(); |
72 void cleanup(); | 72 void cleanup(); |
73 void reset(); | 73 void reset(); |
74 void flush(); | 74 void flush(); |
75 | 75 |
76 friend class GrContext; // for access to: ctor, abandon, reset & flush | 76 friend class GrContext; // for access to: ctor, abandon, reset & flush |
77 | 77 |
78 static const int kNumPixelGeometries = 5; // The different pixel geometries | 78 static const int kNumPixelGeometries = 5; // The different pixel geometries |
79 static const int kNumDFTOptions = 2; // DFT or no DFT | 79 static const int kNumDFTOptions = 2; // DFT or no DFT |
80 | 80 |
81 GrContext* fContext; | 81 GrContext* fContext; |
82 GrDrawTarget::Options fOptionsForDrawTargets; | 82 GrDrawTarget::Options fOptionsForDrawTargets; |
83 | 83 |
84 // In debug builds we guard against improper thread handling | 84 // In debug builds we guard against improper thread handling |
85 GrSingleOwner* fSingleOwner; | 85 GrSingleOwner* fSingleOwner; |
86 | 86 |
87 bool fAbandoned; | 87 bool fAbandoned; |
88 SkTDArray<GrDrawTarget*> fDrawTargets; | 88 SkTDArray<GrDrawTarget*> fDrawTargets; |
89 | 89 |
90 GrTextContext* fNVPRTextContext; | 90 GrTextContext* fNVPRTextContext; |
91 GrTextContext* fTextContexts[kNumPixelGeometries][kNumDFTOption
s]; | 91 GrTextContext* fAtlasTextContext; |
92 | 92 |
93 GrPathRendererChain* fPathRendererChain; | 93 GrPathRendererChain* fPathRendererChain; |
94 GrSoftwarePathRenderer* fSoftwarePathRenderer; | 94 GrSoftwarePathRenderer* fSoftwarePathRenderer; |
95 | 95 |
96 GrBatchFlushState fFlushState; | 96 GrBatchFlushState fFlushState; |
97 bool fFlushing; | 97 bool fFlushing; |
98 }; | 98 }; |
99 | 99 |
100 #endif | 100 #endif |
OLD | NEW |