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 "SkRegion.h" | |
14 #include "SkSurfaceProps.h" | 15 #include "SkSurfaceProps.h" |
15 #include "../private/GrSingleOwner.h" | 16 #include "../private/GrSingleOwner.h" |
16 | 17 |
17 class GrAtlasTextContext; | 18 class GrAtlasTextContext; |
18 class GrAuditTrail; | 19 class GrAuditTrail; |
19 class GrClip; | 20 class GrClip; |
20 class GrContext; | 21 class GrContext; |
21 class GrDrawBatch; | 22 class GrDrawBatch; |
22 class GrDrawPathBatchBase; | 23 class GrDrawPathBatchBase; |
23 class GrDrawingManager; | 24 class GrDrawingManager; |
24 class GrDrawTarget; | 25 class GrDrawTarget; |
25 class GrPaint; | 26 class GrPaint; |
26 class GrPathProcessor; | 27 class GrPathProcessor; |
27 class GrPipelineBuilder; | 28 class GrPipelineBuilder; |
28 class GrRenderTarget; | 29 class GrRenderTarget; |
30 class GrStencilSettings; | |
29 class GrStrokeInfo; | 31 class GrStrokeInfo; |
30 class GrSurface; | 32 class GrSurface; |
31 class SkDrawFilter; | 33 class SkDrawFilter; |
32 struct SkIPoint; | 34 struct SkIPoint; |
33 struct SkIRect; | 35 struct SkIRect; |
34 class SkMatrix; | 36 class SkMatrix; |
35 class SkPaint; | 37 class SkPaint; |
36 class SkPath; | 38 class SkPath; |
37 struct SkPoint; | 39 struct SkPoint; |
38 struct SkRect; | 40 struct SkRect; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 * is always a single pixel thick, else the rect is | 97 * is always a single pixel thick, else the rect is |
96 * mitered/beveled stroked based on stroke width. | 98 * mitered/beveled stroked based on stroke width. |
97 * The rects coords are used to access the paint (through texture matrix) | 99 * The rects coords are used to access the paint (through texture matrix) |
98 */ | 100 */ |
99 void drawRect(const GrClip&, | 101 void drawRect(const GrClip&, |
100 const GrPaint& paint, | 102 const GrPaint& paint, |
101 const SkMatrix& viewMatrix, | 103 const SkMatrix& viewMatrix, |
102 const SkRect&, | 104 const SkRect&, |
103 const GrStrokeInfo* strokeInfo = NULL); | 105 const GrStrokeInfo* strokeInfo = NULL); |
104 | 106 |
107 bool stencilRect(const SkIRect* scissorRect, | |
joshualitt
2016/03/01 17:34:50
I really like the direction this CL is going, but
bsalomon
2016/03/01 17:38:55
I think the name here isn't quite right... it isn'
bsalomon
2016/03/01 17:40:06
I think some way of hiding this is in order (priv
robertphillips
2016/03/01 20:11:57
Done - for now. I was hoping to fold the stencil-o
robertphillips
2016/03/01 20:11:57
Done. I have added GrDrawContextPriv.
| |
108 const GrStencilSettings&, | |
109 SkRegion::Op op, | |
110 bool invert, | |
111 bool doAA, | |
112 const SkMatrix& viewMatrix, | |
113 const SkRect&); | |
114 | |
105 /** | 115 /** |
106 * Maps a rectangle of shader coordinates to a rectangle and fills that rect angle. | 116 * Maps a rectangle of shader coordinates to a rectangle and fills that rect angle. |
107 * | 117 * |
108 * @param paint describes how to color pixels. | 118 * @param paint describes how to color pixels. |
109 * @param viewMatrix transformation matrix which applies to rectToDraw | 119 * @param viewMatrix transformation matrix which applies to rectToDraw |
110 * @param rectToDraw the rectangle to draw | 120 * @param rectToDraw the rectangle to draw |
111 * @param localRect the rectangle of shader coordinates applied to rectT oDraw | 121 * @param localRect the rectangle of shader coordinates applied to rectT oDraw |
112 */ | 122 */ |
113 void fillRectToRect(const GrClip&, | 123 void fillRectToRect(const GrClip&, |
114 const GrPaint& paint, | 124 const GrPaint& paint, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 * @param path the path to draw | 158 * @param path the path to draw |
149 * @param strokeInfo the stroke information (width, join, cap) and | 159 * @param strokeInfo the stroke information (width, join, cap) and |
150 * the dash information (intervals, count, phase). | 160 * the dash information (intervals, count, phase). |
151 */ | 161 */ |
152 void drawPath(const GrClip&, | 162 void drawPath(const GrClip&, |
153 const GrPaint&, | 163 const GrPaint&, |
154 const SkMatrix& viewMatrix, | 164 const SkMatrix& viewMatrix, |
155 const SkPath&, | 165 const SkPath&, |
156 const GrStrokeInfo&); | 166 const GrStrokeInfo&); |
157 | 167 |
168 bool stencilPath(const SkIRect* scissorRect, | |
169 const GrStencilSettings&, | |
170 SkRegion::Op op, | |
171 bool invert, | |
172 bool doAA, | |
173 const SkMatrix& viewMatrix, | |
174 const SkPath&); | |
175 | |
158 /** | 176 /** |
159 * Draws vertices with a paint. | 177 * Draws vertices with a paint. |
160 * | 178 * |
161 * @param paint describes how to color pixels. | 179 * @param paint describes how to color pixels. |
162 * @param viewMatrix transformation matrix | 180 * @param viewMatrix transformation matrix |
163 * @param primitiveType primitives type to draw. | 181 * @param primitiveType primitives type to draw. |
164 * @param vertexCount number of vertices. | 182 * @param vertexCount number of vertices. |
165 * @param positions array of vertex positions, required. | 183 * @param positions array of vertex positions, required. |
166 * @param texCoords optional array of texture coordinates used | 184 * @param texCoords optional array of texture coordinates used |
167 * to access the paint. | 185 * to access the paint. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 GrAuditTrail* auditTrail() { return fAuditTrail; } | 291 GrAuditTrail* auditTrail() { return fAuditTrail; } |
274 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } | 292 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } |
275 | 293 |
276 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) | 294 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) |
277 SkDEBUGCODE(void validate() const;) | 295 SkDEBUGCODE(void validate() const;) |
278 | 296 |
279 private: | 297 private: |
280 friend class GrAtlasTextBlob; // for access to drawBatch | 298 friend class GrAtlasTextBlob; // for access to drawBatch |
281 friend class GrDrawingManager; // for ctor | 299 friend class GrDrawingManager; // for ctor |
282 | 300 |
301 GrDrawBatch* getFillRectBatch(const GrPaint& paint, | |
302 const SkMatrix& viewMatrix, | |
303 const SkRect& rect); | |
304 | |
283 void internalDrawPath(GrPipelineBuilder*, | 305 void internalDrawPath(GrPipelineBuilder*, |
284 const SkMatrix& viewMatrix, | 306 const SkMatrix& viewMatrix, |
285 GrColor, | 307 GrColor, |
286 bool useAA, | 308 bool useAA, |
287 const SkPath&, | 309 const SkPath&, |
288 const GrStrokeInfo&); | 310 const GrStrokeInfo&); |
289 | 311 |
290 // This entry point allows the GrTextContext-derived classes to add their ba tches to | 312 // This entry point allows the GrTextContext-derived classes to add their ba tches to |
291 // the drawTarget. | 313 // the drawTarget. |
292 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch); | 314 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch); |
(...skipping 10 matching lines...) Expand all Loading... | |
303 GrContext* fContext; | 325 GrContext* fContext; |
304 | 326 |
305 SkSurfaceProps fSurfaceProps; | 327 SkSurfaceProps fSurfaceProps; |
306 GrAuditTrail* fAuditTrail; | 328 GrAuditTrail* fAuditTrail; |
307 | 329 |
308 // In debug builds we guard against improper thread handling | 330 // In debug builds we guard against improper thread handling |
309 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) | 331 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
310 }; | 332 }; |
311 | 333 |
312 #endif | 334 #endif |
OLD | NEW |