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 |
11 #include "GrColor.h" | 11 #include "GrColor.h" |
12 #include "GrRenderTarget.h" | 12 #include "GrRenderTarget.h" |
13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
14 #include "SkSurfaceProps.h" | 14 #include "SkSurfaceProps.h" |
15 | 15 |
16 class GrClip; | 16 class GrClip; |
17 class GrContext; | 17 class GrContext; |
18 class GrDrawBatch; | 18 class GrDrawBatch; |
| 19 class GrDrawPathBatchBase; |
19 class GrDrawingManager; | 20 class GrDrawingManager; |
20 class GrDrawTarget; | 21 class GrDrawTarget; |
21 class GrPaint; | 22 class GrPaint; |
22 class GrPathProcessor; | 23 class GrPathProcessor; |
23 class GrPathRange; | |
24 class GrPathRangeDraw; | |
25 class GrPipelineBuilder; | 24 class GrPipelineBuilder; |
26 class GrRenderTarget; | 25 class GrRenderTarget; |
27 class GrStrokeInfo; | 26 class GrStrokeInfo; |
28 class GrSurface; | 27 class GrSurface; |
29 class GrTextContext; | 28 class GrTextContext; |
30 class SkDrawFilter; | 29 class SkDrawFilter; |
31 struct SkIPoint; | 30 struct SkIPoint; |
32 struct SkIRect; | 31 struct SkIRect; |
33 class SkMatrix; | 32 class SkMatrix; |
34 class SkPaint; | 33 class SkPaint; |
(...skipping 21 matching lines...) Expand all Loading... |
56 SkScalar x, SkScalar y, const SkIRect& clipBounds); | 55 SkScalar x, SkScalar y, const SkIRect& clipBounds); |
57 void drawPosText(const GrClip&, const GrPaint&, const SkPaint&, | 56 void drawPosText(const GrClip&, const GrPaint&, const SkPaint&, |
58 const SkMatrix& viewMatrix, const char text[], size_t byteL
ength, | 57 const SkMatrix& viewMatrix, const char text[], size_t byteL
ength, |
59 const SkScalar pos[], int scalarsPerPosition, | 58 const SkScalar pos[], int scalarsPerPosition, |
60 const SkPoint& offset, const SkIRect& clipBounds); | 59 const SkPoint& offset, const SkIRect& clipBounds); |
61 void drawTextBlob(const GrClip&, const SkPaint&, | 60 void drawTextBlob(const GrClip&, const SkPaint&, |
62 const SkMatrix& viewMatrix, const SkTextBlob*, | 61 const SkMatrix& viewMatrix, const SkTextBlob*, |
63 SkScalar x, SkScalar y, | 62 SkScalar x, SkScalar y, |
64 SkDrawFilter*, const SkIRect& clipBounds); | 63 SkDrawFilter*, const SkIRect& clipBounds); |
65 | 64 |
66 // drawPathsFromRange is thanks to GrStencilAndCoverTextContext | |
67 // TODO: remove once path batches can be created external to GrDrawTarget. | |
68 void drawPathsFromRange(const GrPipelineBuilder*, | |
69 const SkMatrix& viewMatrix, | |
70 const SkMatrix& localMatrix, | |
71 GrColor color, | |
72 GrPathRange* range, | |
73 GrPathRangeDraw* draw, | |
74 int /*GrPathRendering::FillType*/ fill, | |
75 const SkRect& bounds); | |
76 | |
77 /** | 65 /** |
78 * Provides a perfomance hint that the render target's contents are allowed | 66 * Provides a perfomance hint that the render target's contents are allowed |
79 * to become undefined. | 67 * to become undefined. |
80 */ | 68 */ |
81 void discard(); | 69 void discard(); |
82 | 70 |
83 /** | 71 /** |
84 * Clear the entire or rect of the render target, ignoring any clips. | 72 * Clear the entire or rect of the render target, ignoring any clips. |
85 * @param rect the rect to clear or the whole thing if rect is NULL. | 73 * @param rect the rect to clear or the whole thing if rect is NULL. |
86 * @param color the color to clear to. | 74 * @param color the color to clear to. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 const SkRect& dst); | 255 const SkRect& dst); |
268 | 256 |
269 /** | 257 /** |
270 * Draws a batch | 258 * Draws a batch |
271 * | 259 * |
272 * @param paint describes how to color pixels. | 260 * @param paint describes how to color pixels. |
273 * @param batch the batch to draw | 261 * @param batch the batch to draw |
274 */ | 262 */ |
275 void drawBatch(const GrClip&, const GrPaint&, GrDrawBatch*); | 263 void drawBatch(const GrClip&, const GrPaint&, GrDrawBatch*); |
276 | 264 |
| 265 /** |
| 266 * Draws a path batch. This needs to be separate from drawBatch because we i
nstall path stencil |
| 267 * settings late. |
| 268 * |
| 269 * TODO: Figure out a better model that allows us to roll this method into d
rawBatch. |
| 270 */ |
| 271 void drawPathBatch(const GrPipelineBuilder&, GrDrawPathBatchBase*); |
| 272 |
277 int width() const { return fRenderTarget->width(); } | 273 int width() const { return fRenderTarget->width(); } |
278 int height() const { return fRenderTarget->height(); } | 274 int height() const { return fRenderTarget->height(); } |
279 int numColorSamples() const { return fRenderTarget->numColorSamples(); } | 275 int numColorSamples() const { return fRenderTarget->numColorSamples(); } |
280 | 276 |
281 GrRenderTarget* accessRenderTarget() { return fRenderTarget; } | 277 GrRenderTarget* accessRenderTarget() { return fRenderTarget; } |
282 | 278 |
283 private: | 279 private: |
284 friend class GrAtlasTextContext; // for access to drawBatch | 280 friend class GrAtlasTextContext; // for access to drawBatch |
285 friend class GrDrawingManager; // for ctor | 281 friend class GrDrawingManager; // for ctor |
286 | 282 |
(...skipping 19 matching lines...) Expand all Loading... |
306 | 302 |
307 // In MDB-mode the drawTarget can be closed by some other drawContext that h
as picked | 303 // In MDB-mode the drawTarget can be closed by some other drawContext that h
as picked |
308 // it up. For this reason, the drawTarget should only ever be accessed via '
getDrawTarget'. | 304 // it up. For this reason, the drawTarget should only ever be accessed via '
getDrawTarget'. |
309 GrDrawTarget* fDrawTarget; | 305 GrDrawTarget* fDrawTarget; |
310 GrTextContext* fTextContext; // lazily gotten from GrContext::DrawingMana
ger | 306 GrTextContext* fTextContext; // lazily gotten from GrContext::DrawingMana
ger |
311 | 307 |
312 SkSurfaceProps fSurfaceProps; | 308 SkSurfaceProps fSurfaceProps; |
313 }; | 309 }; |
314 | 310 |
315 #endif | 311 #endif |
OLD | NEW |