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 GrDrawTarget_DEFINED | 8 #ifndef GrDrawTarget_DEFINED |
9 #define GrDrawTarget_DEFINED | 9 #define GrDrawTarget_DEFINED |
10 | 10 |
11 #include "GrClip.h" | 11 #include "GrClip.h" |
12 #include "GrClipMaskManager.h" | 12 #include "GrClipMaskManager.h" |
13 #include "GrContext.h" | 13 #include "GrContext.h" |
14 #include "GrPathProcessor.h" | 14 #include "GrPathProcessor.h" |
15 #include "GrPrimitiveProcessor.h" | 15 #include "GrPrimitiveProcessor.h" |
16 #include "GrIndexBuffer.h" | 16 #include "GrIndexBuffer.h" |
17 #include "GrPathRendering.h" | 17 #include "GrPathRendering.h" |
18 #include "GrPipelineBuilder.h" | 18 #include "GrPipelineBuilder.h" |
19 #include "GrPipeline.h" | 19 #include "GrPipeline.h" |
20 #include "GrVertexBuffer.h" | 20 #include "GrVertexBuffer.h" |
21 #include "GrXferProcessor.h" | 21 #include "GrXferProcessor.h" |
22 | 22 |
| 23 #include "batches/GrDrawBatch.h" |
| 24 |
23 #include "SkClipStack.h" | 25 #include "SkClipStack.h" |
24 #include "SkMatrix.h" | 26 #include "SkMatrix.h" |
25 #include "SkPath.h" | 27 #include "SkPath.h" |
26 #include "SkStringUtils.h" | 28 #include "SkStringUtils.h" |
27 #include "SkStrokeRec.h" | 29 #include "SkStrokeRec.h" |
28 #include "SkTArray.h" | 30 #include "SkTArray.h" |
29 #include "SkTLazy.h" | 31 #include "SkTLazy.h" |
30 #include "SkTypes.h" | 32 #include "SkTypes.h" |
31 #include "SkXfermode.h" | 33 #include "SkXfermode.h" |
32 | 34 |
33 class GrBatch; | 35 class GrBatch; |
34 class GrClip; | 36 class GrClip; |
35 class GrCaps; | 37 class GrCaps; |
36 class GrPath; | 38 class GrPath; |
37 class GrDrawBatch; | |
38 class GrDrawPathBatchBase; | 39 class GrDrawPathBatchBase; |
39 class GrPathRangeDraw; | 40 class GrPathRangeDraw; |
40 | 41 |
41 class GrDrawTarget final : public SkRefCnt { | 42 class GrDrawTarget final : public SkRefCnt { |
42 public: | 43 public: |
43 // The context may not be fully constructed and should not be used during Gr
DrawTarget | 44 // The context may not be fully constructed and should not be used during Gr
DrawTarget |
44 // construction. | 45 // construction. |
45 GrDrawTarget(GrGpu* gpu, GrResourceProvider*); | 46 GrDrawTarget(GrGpu* gpu, GrResourceProvider*); |
46 | 47 |
47 ~GrDrawTarget() override; | 48 ~GrDrawTarget() override; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 * size in dst with top left at dstPoint. If the src rect is clipped by the | 164 * size in dst with top left at dstPoint. If the src rect is clipped by the |
164 * src bounds then pixel values in the dst rect corresponding to area clipp
ed | 165 * src bounds then pixel values in the dst rect corresponding to area clipp
ed |
165 * by the src rect are not overwritten. This method is not guaranteed to suc
ceed | 166 * by the src rect are not overwritten. This method is not guaranteed to suc
ceed |
166 * depending on the type of surface, configs, etc, and the backend-specific | 167 * depending on the type of surface, configs, etc, and the backend-specific |
167 * limitations. | 168 * limitations. |
168 */ | 169 */ |
169 void copySurface(GrSurface* dst, | 170 void copySurface(GrSurface* dst, |
170 GrSurface* src, | 171 GrSurface* src, |
171 const SkIRect& srcRect, | 172 const SkIRect& srcRect, |
172 const SkIPoint& dstPoint); | 173 const SkIPoint& dstPoint); |
173 /** | |
174 * Release any resources that are cached but not currently in use. This | |
175 * is intended to give an application some recourse when resources are low. | |
176 * TODO: Stop holding on to resources. | |
177 */ | |
178 virtual void purgeResources() { | |
179 // The clip mask manager can rebuild all its clip masks so just get rid
of them all. | |
180 fClipMaskManager->purgeResources(); | |
181 }; | |
182 | 174 |
183 bool programUnitTest(GrContext* owner, int maxStages); | 175 bool programUnitTest(GrContext* owner, int maxStages); |
184 | 176 |
185 /** Provides access to internal functions to GrClipMaskManager without frien
ding all of | 177 /** Provides access to internal functions to GrClipMaskManager without frien
ding all of |
186 GrDrawTarget to CMM. */ | 178 GrDrawTarget to CMM. */ |
187 class CMMAccess { | 179 class CMMAccess { |
188 public: | 180 public: |
189 CMMAccess(GrDrawTarget* drawTarget) : fDrawTarget(drawTarget) {} | 181 CMMAccess(GrDrawTarget* drawTarget) : fDrawTarget(drawTarget) {} |
190 private: | 182 private: |
191 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarg
et* rt) const { | 183 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarg
et* rt) const { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 GrContext* fContext; | 228 GrContext* fContext; |
237 GrGpu* fGpu; | 229 GrGpu* fGpu; |
238 GrResourceProvider* fResourceProvider; | 230 GrResourceProvider* fResourceProvider; |
239 bool fFlushing; | 231 bool fFlushing; |
240 GrBatchToken fLastFlushToken; | 232 GrBatchToken fLastFlushToken; |
241 | 233 |
242 typedef SkRefCnt INHERITED; | 234 typedef SkRefCnt INHERITED; |
243 }; | 235 }; |
244 | 236 |
245 #endif | 237 #endif |
OLD | NEW |