Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: include/gpu/GrDrawContext.h

Issue 1957363002: Replace GrStrokeInfo with GrStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@resscale
Patch Set: Fix issue where hairlines were going to MSAAPathRenderer Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 class GrContext; 21 class GrContext;
22 class GrDrawBatch; 22 class GrDrawBatch;
23 class GrDrawContextPriv; 23 class GrDrawContextPriv;
24 class GrDrawPathBatchBase; 24 class GrDrawPathBatchBase;
25 class GrDrawingManager; 25 class GrDrawingManager;
26 class GrDrawTarget; 26 class GrDrawTarget;
27 class GrPaint; 27 class GrPaint;
28 class GrPathProcessor; 28 class GrPathProcessor;
29 class GrPipelineBuilder; 29 class GrPipelineBuilder;
30 class GrRenderTarget; 30 class GrRenderTarget;
31 class GrStrokeInfo; 31 class GrStyle;
32 class GrSurface; 32 class GrSurface;
33 class SkDrawFilter; 33 class SkDrawFilter;
34 struct SkIPoint; 34 struct SkIPoint;
35 struct SkIRect; 35 struct SkIRect;
36 class SkMatrix; 36 class SkMatrix;
37 class SkPaint; 37 class SkPaint;
38 class SkPath; 38 class SkPath;
39 struct SkPoint; 39 struct SkPoint;
40 struct SkRect; 40 struct SkRect;
41 class SkRRect; 41 class SkRRect;
42 struct SkRSXform; 42 struct SkRSXform;
43 class SkTextBlob; 43 class SkTextBlob;
44 44
45 /* 45 /*
46 * A helper object to orchestrate draws 46 * A helper object to orchestrate draws
47 */ 47 */
48 class SK_API GrDrawContext : public SkRefCnt { 48 class SK_API GrDrawContext : public SkRefCnt {
49 public: 49 public:
50 ~GrDrawContext() override; 50 ~GrDrawContext() override;
51 51
52 bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dst Point); 52 bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dst Point);
53 53
54 // TODO: it is odd that we need both the SkPaint in the following 3 methods. 54 // TODO: it is odd that we need both the SkPaint in the following 3 methods.
55 // We should extract the text parameters from SkPaint and pass them separate ly 55 // We should extract the text parameters from SkPaint and pass them separate ly
56 // akin to GrStrokeInfo (GrTextInfo?) 56 // akin to GrStyle (GrTextInfo?)
57 virtual void drawText(const GrClip&, const GrPaint&, const SkPaint&, 57 virtual void drawText(const GrClip&, const GrPaint&, const SkPaint&,
58 const SkMatrix& viewMatrix, const char text[], size_t byteLength, 58 const SkMatrix& viewMatrix, const char text[], size_t byteLength,
59 SkScalar x, SkScalar y, const SkIRect& clipBounds); 59 SkScalar x, SkScalar y, const SkIRect& clipBounds);
60 virtual void drawPosText(const GrClip&, const GrPaint&, const SkPaint&, 60 virtual void drawPosText(const GrClip&, const GrPaint&, const SkPaint&,
61 const SkMatrix& viewMatrix, const char text[], size _t byteLength, 61 const SkMatrix& viewMatrix, const char text[], size _t byteLength,
62 const SkScalar pos[], int scalarsPerPosition, 62 const SkScalar pos[], int scalarsPerPosition,
63 const SkPoint& offset, const SkIRect& clipBounds); 63 const SkPoint& offset, const SkIRect& clipBounds);
64 virtual void drawTextBlob(const GrClip&, const SkPaint&, 64 virtual void drawTextBlob(const GrClip&, const SkPaint&,
65 const SkMatrix& viewMatrix, const SkTextBlob*, 65 const SkMatrix& viewMatrix, const SkTextBlob*,
66 SkScalar x, SkScalar y, 66 SkScalar x, SkScalar y,
(...skipping 16 matching lines...) Expand all
83 83
84 /** 84 /**
85 * Draw everywhere (respecting the clip) with the paint. 85 * Draw everywhere (respecting the clip) with the paint.
86 */ 86 */
87 void drawPaint(const GrClip&, const GrPaint&, const SkMatrix& viewMatrix); 87 void drawPaint(const GrClip&, const GrPaint&, const SkMatrix& viewMatrix);
88 88
89 /** 89 /**
90 * Draw the rect using a paint. 90 * Draw the rect using a paint.
91 * @param paint describes how to color pixels. 91 * @param paint describes how to color pixels.
92 * @param viewMatrix transformation matrix 92 * @param viewMatrix transformation matrix
93 * @param strokeInfo the stroke information (width, join, cap), and. 93 * @param style The style to apply. Null means fill. Currently path effects are not
94 * the dash information (intervals, count, phase). 94 * allowed.
95 * If strokeInfo == NULL, then the rect is filled.
96 * Otherwise, if stroke width == 0, then the stroke
97 * is always a single pixel thick, else the rect is
98 * mitered/beveled stroked based on stroke width.
99 * The rects coords are used to access the paint (through texture matrix) 95 * The rects coords are used to access the paint (through texture matrix)
100 */ 96 */
101 void drawRect(const GrClip&, 97 void drawRect(const GrClip&,
102 const GrPaint& paint, 98 const GrPaint& paint,
103 const SkMatrix& viewMatrix, 99 const SkMatrix& viewMatrix,
104 const SkRect&, 100 const SkRect&,
105 const GrStrokeInfo* strokeInfo = nullptr); 101 const GrStyle* style = nullptr);
106 102
107 /** 103 /**
108 * Maps a rectangle of shader coordinates to a rectangle and fills that rect angle. 104 * Maps a rectangle of shader coordinates to a rectangle and fills that rect angle.
109 * 105 *
110 * @param paint describes how to color pixels. 106 * @param paint describes how to color pixels.
111 * @param viewMatrix transformation matrix which applies to rectToDraw 107 * @param viewMatrix transformation matrix which applies to rectToDraw
112 * @param rectToDraw the rectangle to draw 108 * @param rectToDraw the rectangle to draw
113 * @param localRect the rectangle of shader coordinates applied to rectT oDraw 109 * @param localRect the rectangle of shader coordinates applied to rectT oDraw
114 */ 110 */
115 void fillRectToRect(const GrClip&, 111 void fillRectToRect(const GrClip&,
(...skipping 10 matching lines...) Expand all
126 const SkMatrix& viewMatrix, 122 const SkMatrix& viewMatrix,
127 const SkRect& rect, 123 const SkRect& rect,
128 const SkMatrix& localMatrix); 124 const SkMatrix& localMatrix);
129 125
130 /** 126 /**
131 * Draw a roundrect using a paint. 127 * Draw a roundrect using a paint.
132 * 128 *
133 * @param paint describes how to color pixels. 129 * @param paint describes how to color pixels.
134 * @param viewMatrix transformation matrix 130 * @param viewMatrix transformation matrix
135 * @param rrect the roundrect to draw 131 * @param rrect the roundrect to draw
136 * @param strokeInfo the stroke information (width, join, cap) and 132 * @param style style to apply to the rrect. Currently path effects are not allowed.
137 * the dash information (intervals, count, phase).
138 */ 133 */
139 void drawRRect(const GrClip&, 134 void drawRRect(const GrClip&,
140 const GrPaint&, 135 const GrPaint&,
141 const SkMatrix& viewMatrix, 136 const SkMatrix& viewMatrix,
142 const SkRRect& rrect, 137 const SkRRect& rrect,
143 const GrStrokeInfo&); 138 const GrStyle& style);
144 139
145 /** 140 /**
146 * Shortcut for drawing an SkPath consisting of nested rrects using a paint . 141 * Shortcut for drawing an SkPath consisting of nested rrects using a paint .
147 * Does not support stroking. The result is undefined if outer does not con tain 142 * Does not support stroking. The result is undefined if outer does not con tain
148 * inner. 143 * inner.
149 * 144 *
150 * @param paint describes how to color pixels. 145 * @param paint describes how to color pixels.
151 * @param viewMatrix transformation matrix 146 * @param viewMatrix transformation matrix
152 * @param outer the outer roundrect 147 * @param outer the outer roundrect
153 * @param inner the inner roundrect 148 * @param inner the inner roundrect
154 */ 149 */
155 void drawDRRect(const GrClip&, 150 void drawDRRect(const GrClip&,
156 const GrPaint&, 151 const GrPaint&,
157 const SkMatrix& viewMatrix, 152 const SkMatrix& viewMatrix,
158 const SkRRect& outer, 153 const SkRRect& outer,
159 const SkRRect& inner); 154 const SkRRect& inner);
160 155
161 /** 156 /**
162 * Draws a path. 157 * Draws a path.
163 * 158 *
164 * @param paint describes how to color pixels. 159 * @param paint describes how to color pixels.
165 * @param viewMatrix transformation matrix 160 * @param viewMatrix transformation matrix
166 * @param path the path to draw 161 * @param path the path to draw
167 * @param strokeInfo the stroke information (width, join, cap) and 162 * @param style style to apply to the path.
168 * the dash information (intervals, count, phase).
169 */ 163 */
170 void drawPath(const GrClip&, 164 void drawPath(const GrClip&,
171 const GrPaint&, 165 const GrPaint&,
172 const SkMatrix& viewMatrix, 166 const SkMatrix& viewMatrix,
173 const SkPath&, 167 const SkPath&,
174 const GrStrokeInfo&); 168 const GrStyle& style);
175 169
176 /** 170 /**
177 * Draws vertices with a paint. 171 * Draws vertices with a paint.
178 * 172 *
179 * @param paint describes how to color pixels. 173 * @param paint describes how to color pixels.
180 * @param viewMatrix transformation matrix 174 * @param viewMatrix transformation matrix
181 * @param primitiveType primitives type to draw. 175 * @param primitiveType primitives type to draw.
182 * @param vertexCount number of vertices. 176 * @param vertexCount number of vertices.
183 * @param positions array of vertex positions, required. 177 * @param positions array of vertex positions, required.
184 * @param texCoords optional array of texture coordinates used 178 * @param texCoords optional array of texture coordinates used
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 const SkRSXform xform[], 213 const SkRSXform xform[],
220 const SkRect texRect[], 214 const SkRect texRect[],
221 const SkColor colors[]); 215 const SkColor colors[]);
222 216
223 /** 217 /**
224 * Draws an oval. 218 * Draws an oval.
225 * 219 *
226 * @param paint describes how to color pixels. 220 * @param paint describes how to color pixels.
227 * @param viewMatrix transformation matrix 221 * @param viewMatrix transformation matrix
228 * @param oval the bounding rect of the oval. 222 * @param oval the bounding rect of the oval.
229 * @param strokeInfo the stroke information (width, join, cap) and 223 * @param style style to apply to the oval. Currently path effects a re not allowed.
230 * the dash information (intervals, count, phase).
231 */ 224 */
232 void drawOval(const GrClip&, 225 void drawOval(const GrClip&,
233 const GrPaint& paint, 226 const GrPaint& paint,
234 const SkMatrix& viewMatrix, 227 const SkMatrix& viewMatrix,
235 const SkRect& oval, 228 const SkRect& oval,
236 const GrStrokeInfo& strokeInfo); 229 const GrStyle& style);
237 230
238 /** 231 /**
239 * Draw the image stretched differentially to fit into dst. 232 * Draw the image stretched differentially to fit into dst.
240 * center is a rect within the image, and logically divides the image 233 * center is a rect within the image, and logically divides the image
241 * into 9 sections (3x3). For example, if the middle pixel of a [5x5] 234 * into 9 sections (3x3). For example, if the middle pixel of a [5x5]
242 * image is the "center", then the center-rect should be [2, 2, 3, 3]. 235 * image is the "center", then the center-rect should be [2, 2, 3, 3].
243 * 236 *
244 * If the dst is >= the image size, then... 237 * If the dst is >= the image size, then...
245 * - The 4 corners are not stretched at all. 238 * - The 4 corners are not stretched at all.
246 * - The sides are stretched in only one axis. 239 * - The sides are stretched in only one axis.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 const SkRRect& origInner); 304 const SkRRect& origInner);
312 305
313 GrDrawBatch* getFillRectBatch(const GrPaint& paint, 306 GrDrawBatch* getFillRectBatch(const GrPaint& paint,
314 const SkMatrix& viewMatrix, 307 const SkMatrix& viewMatrix,
315 const SkRect& rect); 308 const SkRect& rect);
316 309
317 void internalDrawPath(const GrClip& clip, 310 void internalDrawPath(const GrClip& clip,
318 const GrPaint& paint, 311 const GrPaint& paint,
319 const SkMatrix& viewMatrix, 312 const SkMatrix& viewMatrix,
320 const SkPath& path, 313 const SkPath& path,
321 const GrStrokeInfo& strokeInfo); 314 const GrStyle& style);
322 315
323 // This entry point allows the GrTextContext-derived classes to add their ba tches to 316 // This entry point allows the GrTextContext-derived classes to add their ba tches to
324 // the drawTarget. 317 // the drawTarget.
325 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch); 318 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch);
326 319
327 GrDrawTarget* getDrawTarget(); 320 GrDrawTarget* getDrawTarget();
328 321
329 GrDrawingManager* fDrawingManager; 322 GrDrawingManager* fDrawingManager;
330 sk_sp<GrRenderTarget> fRenderTarget; 323 sk_sp<GrRenderTarget> fRenderTarget;
331 324
332 // In MDB-mode the drawTarget can be closed by some other drawContext that h as picked 325 // In MDB-mode the drawTarget can be closed by some other drawContext that h as picked
333 // it up. For this reason, the drawTarget should only ever be accessed via ' getDrawTarget'. 326 // it up. For this reason, the drawTarget should only ever be accessed via ' getDrawTarget'.
334 GrDrawTarget* fDrawTarget; 327 GrDrawTarget* fDrawTarget;
335 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext; 328 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext;
336 GrContext* fContext; 329 GrContext* fContext;
337 330
338 SkSurfaceProps fSurfaceProps; 331 SkSurfaceProps fSurfaceProps;
339 GrAuditTrail* fAuditTrail; 332 GrAuditTrail* fAuditTrail;
340 333
341 // In debug builds we guard against improper thread handling 334 // In debug builds we guard against improper thread handling
342 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) 335 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;)
343 }; 336 };
344 337
345 #endif 338 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698