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

Side by Side Diff: src/gpu/batches/GrTessellatingPathRenderer.cpp

Issue 1928133002: Unify implementations of stroking radius calculations (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: use makeOutset 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
« no previous file with comments | « src/core/SkStrokeRec.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "GrTessellatingPathRenderer.h" 8 #include "GrTessellatingPathRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 const SkRect& pathBounds = path.getBounds(); 251 const SkRect& pathBounds = path.getBounds();
252 fClipBounds = clipBounds; 252 fClipBounds = clipBounds;
253 // Because the clip bounds are used to add a contour for inverse fills, they must also 253 // Because the clip bounds are used to add a contour for inverse fills, they must also
254 // include the path bounds. 254 // include the path bounds.
255 fClipBounds.join(pathBounds); 255 fClipBounds.join(pathBounds);
256 if (path.isInverseFillType()) { 256 if (path.isInverseFillType()) {
257 fBounds = fClipBounds; 257 fBounds = fClipBounds;
258 } else { 258 } else {
259 fBounds = path.getBounds(); 259 fBounds = path.getBounds();
260 } 260 }
261 if (!stroke.isFillStyle()) { 261 SkScalar radius = stroke.getInflationRadius();
262 SkScalar radius = SkScalarHalf(stroke.getWidth()); 262 fBounds.outset(radius, radius);
263 if (stroke.getJoin() == SkPaint::kMiter_Join) {
264 SkScalar scale = stroke.getMiter();
265 if (scale > SK_Scalar1) {
266 radius = SkScalarMul(radius, scale);
267 }
268 }
269 fBounds.outset(radius, radius);
270 }
271 viewMatrix.mapRect(&fBounds); 263 viewMatrix.mapRect(&fBounds);
272 } 264 }
273 265
274 GrColor fColor; 266 GrColor fColor;
275 SkPath fPath; 267 SkPath fPath;
276 GrStrokeInfo fStroke; 268 GrStrokeInfo fStroke;
277 SkMatrix fViewMatrix; 269 SkMatrix fViewMatrix;
278 SkRect fClipBounds; // in source space 270 SkRect fClipBounds; // in source space
279 GrXPOverridesForBatch fPipelineInfo; 271 GrXPOverridesForBatch fPipelineInfo;
280 272
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 bool result = viewMatrix.invert(&vmi); 311 bool result = viewMatrix.invert(&vmi);
320 if (!result) { 312 if (!result) {
321 SkFAIL("Cannot invert matrix\n"); 313 SkFAIL("Cannot invert matrix\n");
322 } 314 }
323 vmi.mapRect(&clipBounds); 315 vmi.mapRect(&clipBounds);
324 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); 316 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random);
325 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl ipBounds); 317 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl ipBounds);
326 } 318 }
327 319
328 #endif 320 #endif
OLDNEW
« no previous file with comments | « src/core/SkStrokeRec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698