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

Side by Side Diff: src/core/SkStroke.cpp

Issue 2207753003: Don't leave fResScale uninitialized when constructing an SkStroke. (Closed) Base URL: https://skia.googlesource.com/skia.git/@master
Patch Set: Created 4 years, 4 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 | « no previous file | 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 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkStrokerPriv.h" 8 #include "SkStrokerPriv.h"
9 #include "SkGeometry.h" 9 #include "SkGeometry.h"
10 #include "SkPathPriv.h" 10 #include "SkPathPriv.h"
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 } 1260 }
1261 1261
1262 /////////////////////////////////////////////////////////////////////////////// 1262 ///////////////////////////////////////////////////////////////////////////////
1263 /////////////////////////////////////////////////////////////////////////////// 1263 ///////////////////////////////////////////////////////////////////////////////
1264 1264
1265 #include "SkPaintDefaults.h" 1265 #include "SkPaintDefaults.h"
1266 1266
1267 SkStroke::SkStroke() { 1267 SkStroke::SkStroke() {
1268 fWidth = SK_Scalar1; 1268 fWidth = SK_Scalar1;
1269 fMiterLimit = SkPaintDefaults_MiterLimit; 1269 fMiterLimit = SkPaintDefaults_MiterLimit;
1270 fResScale = 1;
1270 fCap = SkPaint::kDefault_Cap; 1271 fCap = SkPaint::kDefault_Cap;
1271 fJoin = SkPaint::kDefault_Join; 1272 fJoin = SkPaint::kDefault_Join;
1272 fDoFill = false; 1273 fDoFill = false;
1273 } 1274 }
1274 1275
1275 SkStroke::SkStroke(const SkPaint& p) { 1276 SkStroke::SkStroke(const SkPaint& p) {
1276 fWidth = p.getStrokeWidth(); 1277 fWidth = p.getStrokeWidth();
1277 fMiterLimit = p.getStrokeMiter(); 1278 fMiterLimit = p.getStrokeMiter();
1279 fResScale = 1;
1278 fCap = (uint8_t)p.getStrokeCap(); 1280 fCap = (uint8_t)p.getStrokeCap();
1279 fJoin = (uint8_t)p.getStrokeJoin(); 1281 fJoin = (uint8_t)p.getStrokeJoin();
1280 fDoFill = SkToU8(p.getStyle() == SkPaint::kStrokeAndFill_Style); 1282 fDoFill = SkToU8(p.getStyle() == SkPaint::kStrokeAndFill_Style);
1281 } 1283 }
1282 1284
1283 SkStroke::SkStroke(const SkPaint& p, SkScalar width) { 1285 SkStroke::SkStroke(const SkPaint& p, SkScalar width) {
1284 fWidth = width; 1286 fWidth = width;
1285 fMiterLimit = p.getStrokeMiter(); 1287 fMiterLimit = p.getStrokeMiter();
1288 fResScale = 1;
1286 fCap = (uint8_t)p.getStrokeCap(); 1289 fCap = (uint8_t)p.getStrokeCap();
1287 fJoin = (uint8_t)p.getStrokeJoin(); 1290 fJoin = (uint8_t)p.getStrokeJoin();
1288 fDoFill = SkToU8(p.getStyle() == SkPaint::kStrokeAndFill_Style); 1291 fDoFill = SkToU8(p.getStyle() == SkPaint::kStrokeAndFill_Style);
1289 } 1292 }
1290 1293
1291 void SkStroke::setWidth(SkScalar width) { 1294 void SkStroke::setWidth(SkScalar width) {
1292 SkASSERT(width >= 0); 1295 SkASSERT(width >= 0);
1293 fWidth = width; 1296 fWidth = width;
1294 } 1297 }
1295 1298
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 default: 1527 default:
1525 break; 1528 break;
1526 } 1529 }
1527 1530
1528 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { 1531 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) {
1529 r = rect; 1532 r = rect;
1530 r.inset(radius, radius); 1533 r.inset(radius, radius);
1531 dst->addRect(r, reverse_direction(dir)); 1534 dst->addRect(r, reverse_direction(dir));
1532 } 1535 }
1533 } 1536 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698