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

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

Issue 1157623003: remove SK_LEGACY_STROKE_CURVES (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: work in progress Created 5 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/SkStroke.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 2012 Google Inc. 2 * Copyright 2012 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 "SkStrokeRec.h" 8 #include "SkStrokeRec.h"
9 #include "SkPaintDefaults.h" 9 #include "SkPaintDefaults.h"
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // hairline+fill == fill 89 // hairline+fill == fill
90 this->setFillStyle(); 90 this->setFillStyle();
91 } else { 91 } else {
92 fWidth = width; 92 fWidth = width;
93 fStrokeAndFill = strokeAndFill; 93 fStrokeAndFill = strokeAndFill;
94 } 94 }
95 } 95 }
96 96
97 #include "SkStroke.h" 97 #include "SkStroke.h"
98 98
99 #if !defined SK_LEGACY_STROKE_CURVES && defined SK_DEBUG 99 #ifdef SK_DEBUG
100 // enables tweaking these values at runtime from SampleApp 100 // enables tweaking these values at runtime from SampleApp
101 bool gDebugStrokerErrorSet = false; 101 bool gDebugStrokerErrorSet = false;
102 SkScalar gDebugStrokerError; 102 SkScalar gDebugStrokerError;
103 #endif 103 #endif
104 104
105 bool SkStrokeRec::applyToPath(SkPath* dst, const SkPath& src) const { 105 bool SkStrokeRec::applyToPath(SkPath* dst, const SkPath& src) const {
106 if (fWidth <= 0) { // hairline or fill 106 if (fWidth <= 0) { // hairline or fill
107 return false; 107 return false;
108 } 108 }
109 109
110 SkStroke stroker; 110 SkStroke stroker;
111 stroker.setCap(fCap); 111 stroker.setCap(fCap);
112 stroker.setJoin(fJoin); 112 stroker.setJoin(fJoin);
113 stroker.setMiterLimit(fMiterLimit); 113 stroker.setMiterLimit(fMiterLimit);
114 stroker.setWidth(fWidth); 114 stroker.setWidth(fWidth);
115 stroker.setDoFill(fStrokeAndFill); 115 stroker.setDoFill(fStrokeAndFill);
116 #if !defined SK_LEGACY_STROKE_CURVES && defined SK_DEBUG 116 #ifdef SK_DEBUG
117 stroker.setResScale(gDebugStrokerErrorSet ? gDebugStrokerError : fResScale); 117 stroker.setResScale(gDebugStrokerErrorSet ? gDebugStrokerError : fResScale);
118 #else 118 #else
119 stroker.setResScale(fResScale); 119 stroker.setResScale(fResScale);
120 #endif 120 #endif
121 stroker.strokePath(src, dst); 121 stroker.strokePath(src, dst);
122 return true; 122 return true;
123 } 123 }
124 124
125 void SkStrokeRec::applyToPaint(SkPaint* paint) const { 125 void SkStrokeRec::applyToPaint(SkPaint* paint) const {
126 if (fWidth < 0) { // fill 126 if (fWidth < 0) { // fill
127 paint->setStyle(SkPaint::kFill_Style); 127 paint->setStyle(SkPaint::kFill_Style);
128 return; 128 return;
129 } 129 }
130 130
131 paint->setStyle(fStrokeAndFill ? SkPaint::kStrokeAndFill_Style : SkPaint::kS troke_Style); 131 paint->setStyle(fStrokeAndFill ? SkPaint::kStrokeAndFill_Style : SkPaint::kS troke_Style);
132 paint->setStrokeWidth(fWidth); 132 paint->setStrokeWidth(fWidth);
133 paint->setStrokeMiter(fMiterLimit); 133 paint->setStrokeMiter(fMiterLimit);
134 paint->setStrokeCap(fCap); 134 paint->setStrokeCap(fCap);
135 paint->setStrokeJoin(fJoin); 135 paint->setStrokeJoin(fJoin);
136 } 136 }
OLDNEW
« no previous file with comments | « src/core/SkStroke.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698