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 GrDrawContext_DEFINED | 8 #ifndef GrDrawContext_DEFINED |
9 #define GrDrawContext_DEFINED | 9 #define GrDrawContext_DEFINED |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 struct SkPoint; | 33 struct SkPoint; |
34 struct SkRect; | 34 struct SkRect; |
35 class SkRRect; | 35 class SkRRect; |
36 class SkTextBlob; | 36 class SkTextBlob; |
37 | 37 |
38 /* | 38 /* |
39 * A helper object to orchestrate draws | 39 * A helper object to orchestrate draws |
40 */ | 40 */ |
41 class SK_API GrDrawContext : public SkRefCnt { | 41 class SK_API GrDrawContext : public SkRefCnt { |
42 public: | 42 public: |
43 SK_DECLARE_INST_COUNT(GrDrawContext) | |
44 | |
45 ~GrDrawContext() override; | 43 ~GrDrawContext() override; |
46 | 44 |
47 void copySurface(GrRenderTarget* dst, GrSurface* src, | 45 void copySurface(GrRenderTarget* dst, GrSurface* src, |
48 const SkIRect& srcRect, const SkIPoint& dstPoint); | 46 const SkIRect& srcRect, const SkIPoint& dstPoint); |
49 | 47 |
50 // TODO: it is odd that we need both the SkPaint in the following 3 methods. | 48 // TODO: it is odd that we need both the SkPaint in the following 3 methods. |
51 // We should extract the text parameters from SkPaint and pass them separate
ly | 49 // We should extract the text parameters from SkPaint and pass them separate
ly |
52 // akin to GrStrokeInfo (GrTextInfo?) | 50 // akin to GrStrokeInfo (GrTextInfo?) |
53 void drawText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint
&, | 51 void drawText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint
&, |
54 const SkMatrix& viewMatrix, const char text[], size_t byteLeng
th, | 52 const SkMatrix& viewMatrix, const char text[], size_t byteLeng
th, |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 244 |
247 GrDrawContext(GrContext*, GrDrawTarget*, const SkSurfaceProps&); | 245 GrDrawContext(GrContext*, GrDrawTarget*, const SkSurfaceProps&); |
248 | 246 |
249 // Sets the paint. Returns true on success; false on failure. | 247 // Sets the paint. Returns true on success; false on failure. |
250 bool prepareToDraw(GrPipelineBuilder*, | 248 bool prepareToDraw(GrPipelineBuilder*, |
251 GrRenderTarget* rt, | 249 GrRenderTarget* rt, |
252 const GrClip&, | 250 const GrClip&, |
253 const GrPaint* paint); | 251 const GrPaint* paint); |
254 GrTextContext* createTextContext(GrRenderTarget*, const SkSurfaceProps&); | 252 GrTextContext* createTextContext(GrRenderTarget*, const SkSurfaceProps&); |
255 | 253 |
256 // A simpler version of the above which just returns true on success; false
on failure. | 254 // A simpler version of the above which just returns true on success; false
on failure. |
257 // Clip is *NOT* set | 255 // Clip is *NOT* set |
258 bool prepareToDraw(GrRenderTarget* rt); | 256 bool prepareToDraw(GrRenderTarget* rt); |
259 | 257 |
260 void internalDrawPath(GrDrawTarget*, | 258 void internalDrawPath(GrDrawTarget*, |
261 GrPipelineBuilder*, | 259 GrPipelineBuilder*, |
262 const SkMatrix& viewMatrix, | 260 const SkMatrix& viewMatrix, |
263 GrColor, | 261 GrColor, |
264 bool useAA, | 262 bool useAA, |
265 const SkPath&, | 263 const SkPath&, |
266 const GrStrokeInfo&); | 264 const GrStrokeInfo&); |
267 | 265 |
268 // This entry point allows the GrTextContext-derived classes to add their ba
tches to | 266 // This entry point allows the GrTextContext-derived classes to add their ba
tches to |
269 // the drawTarget. | 267 // the drawTarget. |
270 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrBatch* batch); | 268 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrBatch* batch); |
271 | 269 |
272 GrContext* fContext; // owning context -> no ref | 270 GrContext* fContext; // owning context -> no ref |
273 GrDrawTarget* fDrawTarget; | 271 GrDrawTarget* fDrawTarget; |
274 GrTextContext* fTextContext; // lazily created | 272 GrTextContext* fTextContext; // lazily created |
275 | 273 |
276 SkSurfaceProps fSurfaceProps; | 274 SkSurfaceProps fSurfaceProps; |
277 }; | 275 }; |
278 | 276 |
279 #endif | 277 #endif |
OLD | NEW |