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

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

Issue 932113002: Revive quad approximation stroker (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add macro to suppress uninitialized warning Created 5 years, 10 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // hairline+fill == fill 93 // hairline+fill == fill
94 this->setFillStyle(); 94 this->setFillStyle();
95 } else { 95 } else {
96 fWidth = width; 96 fWidth = width;
97 fStrokeAndFill = strokeAndFill; 97 fStrokeAndFill = strokeAndFill;
98 } 98 }
99 } 99 }
100 100
101 #include "SkStroke.h" 101 #include "SkStroke.h"
102 102
103 #if defined SK_QUAD_STROKE_APPROXIMATION && defined SK_DEBUG
104 // enables tweaking these values at runtime from SampleApp
105 bool gDebugStrokerErrorSet = false;
106 SkScalar gDebugStrokerError;
107 #endif
108
103 bool SkStrokeRec::applyToPath(SkPath* dst, const SkPath& src) const { 109 bool SkStrokeRec::applyToPath(SkPath* dst, const SkPath& src) const {
104 if (fWidth <= 0) { // hairline or fill 110 if (fWidth <= 0) { // hairline or fill
105 return false; 111 return false;
106 } 112 }
107 113
108 SkStroke stroker; 114 SkStroke stroker;
109 stroker.setCap(fCap); 115 stroker.setCap(fCap);
110 stroker.setJoin(fJoin); 116 stroker.setJoin(fJoin);
111 stroker.setMiterLimit(fMiterLimit); 117 stroker.setMiterLimit(fMiterLimit);
112 stroker.setWidth(fWidth); 118 stroker.setWidth(fWidth);
113 stroker.setDoFill(fStrokeAndFill); 119 stroker.setDoFill(fStrokeAndFill);
120 #if defined SK_QUAD_STROKE_APPROXIMATION && defined SK_DEBUG
121 stroker.setResScale(gDebugStrokerErrorSet ? gDebugStrokerError : fResScale);
122 #else
114 stroker.setResScale(fResScale); 123 stroker.setResScale(fResScale);
115 #if QUAD_STROKE_APPROXIMATION
116 stroker.setError(1);
117 #endif 124 #endif
118 stroker.strokePath(src, dst); 125 stroker.strokePath(src, dst);
119 return true; 126 return true;
120 } 127 }
121 128
122 void SkStrokeRec::applyToPaint(SkPaint* paint) const { 129 void SkStrokeRec::applyToPaint(SkPaint* paint) const {
123 if (fWidth < 0) { // fill 130 if (fWidth < 0) { // fill
124 paint->setStyle(SkPaint::kFill_Style); 131 paint->setStyle(SkPaint::kFill_Style);
125 return; 132 return;
126 } 133 }
127 134
128 paint->setStyle(fStrokeAndFill ? SkPaint::kStrokeAndFill_Style : SkPaint::kS troke_Style); 135 paint->setStyle(fStrokeAndFill ? SkPaint::kStrokeAndFill_Style : SkPaint::kS troke_Style);
129 paint->setStrokeWidth(fWidth); 136 paint->setStrokeWidth(fWidth);
130 paint->setStrokeMiter(fMiterLimit); 137 paint->setStrokeMiter(fMiterLimit);
131 paint->setStrokeCap(fCap); 138 paint->setStrokeCap(fCap);
132 paint->setStrokeJoin(fJoin); 139 paint->setStrokeJoin(fJoin);
133 } 140 }
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