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

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

Issue 1955633002: Take SkStrokeRec::InitStyle rather than SkPaint::Style in mask filter and DrawMask (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: fix xps change 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/SkDraw.cpp ('k') | src/core/SkRasterizer.cpp » ('j') | 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 2006 The Android Open Source Project 2 * Copyright 2006 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 8
9 #include "SkMaskFilter.h" 9 #include "SkMaskFilter.h"
10 #include "SkBlitter.h" 10 #include "SkBlitter.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } 207 }
208 208
209 static int countNestedRects(const SkPath& path, SkRect rects[2]) { 209 static int countNestedRects(const SkPath& path, SkRect rects[2]) {
210 if (path.isNestedFillRects(rects)) { 210 if (path.isNestedFillRects(rects)) {
211 return 2; 211 return 2;
212 } 212 }
213 return path.isRect(&rects[0]); 213 return path.isRect(&rects[0]);
214 } 214 }
215 215
216 bool SkMaskFilter::filterRRect(const SkRRect& devRRect, const SkMatrix& matrix, 216 bool SkMaskFilter::filterRRect(const SkRRect& devRRect, const SkMatrix& matrix,
217 const SkRasterClip& clip, SkBlitter* blitter, 217 const SkRasterClip& clip, SkBlitter* blitter) con st {
218 SkPaint::Style style) const {
219 // Attempt to speed up drawing by creating a nine patch. If a nine patch 218 // Attempt to speed up drawing by creating a nine patch. If a nine patch
220 // cannot be used, return false to allow our caller to recover and perform 219 // cannot be used, return false to allow our caller to recover and perform
221 // the drawing another way. 220 // the drawing another way.
222 NinePatch patch; 221 NinePatch patch;
223 patch.fMask.fImage = nullptr; 222 patch.fMask.fImage = nullptr;
224 if (kTrue_FilterReturn != this->filterRRectToNine(devRRect, matrix, 223 if (kTrue_FilterReturn != this->filterRRectToNine(devRRect, matrix,
225 clip.getBounds(), 224 clip.getBounds(),
226 &patch)) { 225 &patch)) {
227 SkASSERT(nullptr == patch.fMask.fImage); 226 SkASSERT(nullptr == patch.fMask.fImage);
228 return false; 227 return false;
229 } 228 }
230 draw_nine(patch.fMask, patch.fOuterRect, patch.fCenter, true, clip, blitter) ; 229 draw_nine(patch.fMask, patch.fOuterRect, patch.fCenter, true, clip, blitter) ;
231 return true; 230 return true;
232 } 231 }
233 232
234 bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix, 233 bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix,
235 const SkRasterClip& clip, SkBlitter* blitter, 234 const SkRasterClip& clip, SkBlitter* blitter,
236 SkPaint::Style style) const { 235 SkStrokeRec::InitStyle style) const {
237 SkRect rects[2]; 236 SkRect rects[2];
238 int rectCount = 0; 237 int rectCount = 0;
239 if (SkPaint::kFill_Style == style) { 238 if (SkStrokeRec::kFill_InitStyle == style) {
240 rectCount = countNestedRects(devPath, rects); 239 rectCount = countNestedRects(devPath, rects);
241 } 240 }
242 if (rectCount > 0) { 241 if (rectCount > 0) {
243 NinePatch patch; 242 NinePatch patch;
244 243
245 switch (this->filterRectsToNine(rects, rectCount, matrix, clip.getBounds (), &patch)) { 244 switch (this->filterRectsToNine(rects, rectCount, matrix, clip.getBounds (), &patch)) {
246 case kFalse_FilterReturn: 245 case kFalse_FilterReturn:
247 SkASSERT(nullptr == patch.fMask.fImage); 246 SkASSERT(nullptr == patch.fMask.fImage);
248 return false; 247 return false;
249 248
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 srcM.fRowBytes = 0; 350 srcM.fRowBytes = 0;
352 srcM.fFormat = SkMask::kA8_Format; 351 srcM.fFormat = SkMask::kA8_Format;
353 352
354 SkIPoint margin; // ignored 353 SkIPoint margin; // ignored
355 if (this->filterMask(&dstM, srcM, SkMatrix::I(), &margin)) { 354 if (this->filterMask(&dstM, srcM, SkMatrix::I(), &margin)) {
356 dst->set(dstM.fBounds); 355 dst->set(dstM.fBounds);
357 } else { 356 } else {
358 dst->set(srcM.fBounds); 357 dst->set(srcM.fBounds);
359 } 358 }
360 } 359 }
OLDNEW
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkRasterizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698