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

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

Issue 911053005: optional res-scale parameter to getFillPath (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « include/core/SkStrokeRec.h ('k') | src/core/SkPaint.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 #include "SkDraw.h" 8 #include "SkDraw.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 } 997 }
998 } 998 }
999 999
1000 DRAW_PATH: 1000 DRAW_PATH:
1001 // Now fall back to the default case of using a path. 1001 // Now fall back to the default case of using a path.
1002 SkPath path; 1002 SkPath path;
1003 path.addRRect(rrect); 1003 path.addRRect(rrect);
1004 this->drawPath(path, paint, NULL, true); 1004 this->drawPath(path, paint, NULL, true);
1005 } 1005 }
1006 1006
1007 static SkScalar compute_res_scale_for_stroking(const SkMatrix& matrix) {
1008 if (!matrix.hasPerspective()) {
1009 SkScalar sx = SkPoint::Length(matrix[SkMatrix::kMScaleX], matrix[SkMatri x::kMSkewY]);
1010 SkScalar sy = SkPoint::Length(matrix[SkMatrix::kMSkewX], matrix[SkMatri x::kMScaleY]);
1011 if (SkScalarsAreFinite(sx, sy)) {
1012 return SkTMax(sx, sy);
1013 }
1014 }
1015 return 1;
1016 }
1017
1007 void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint, 1018 void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
1008 const SkMatrix* prePathMatrix, bool pathIsMutable, 1019 const SkMatrix* prePathMatrix, bool pathIsMutable,
1009 bool drawCoverage, SkBlitter* customBlitter) const { 1020 bool drawCoverage, SkBlitter* customBlitter) const {
1010 SkDEBUGCODE(this->validate();) 1021 SkDEBUGCODE(this->validate();)
1011 1022
1012 // nothing to draw 1023 // nothing to draw
1013 if (fRC->isEmpty()) { 1024 if (fRC->isEmpty()) {
1014 return; 1025 return;
1015 } 1026 }
1016 1027
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 } 1076 }
1066 } 1077 }
1067 } 1078 }
1068 1079
1069 if (paint->getPathEffect() || paint->getStyle() != SkPaint::kFill_Style) { 1080 if (paint->getPathEffect() || paint->getStyle() != SkPaint::kFill_Style) {
1070 SkRect cullRect; 1081 SkRect cullRect;
1071 const SkRect* cullRectPtr = NULL; 1082 const SkRect* cullRectPtr = NULL;
1072 if (this->computeConservativeLocalClipBounds(&cullRect)) { 1083 if (this->computeConservativeLocalClipBounds(&cullRect)) {
1073 cullRectPtr = &cullRect; 1084 cullRectPtr = &cullRect;
1074 } 1085 }
1075 doFill = paint->getFillPath(*pathPtr, &tmpPath, cullRectPtr); 1086 doFill = paint->getFillPath(*pathPtr, &tmpPath, cullRectPtr,
1087 compute_res_scale_for_stroking(*fMatrix));
1076 pathPtr = &tmpPath; 1088 pathPtr = &tmpPath;
1077 } 1089 }
1078 1090
1079 if (paint->getRasterizer()) { 1091 if (paint->getRasterizer()) {
1080 SkMask mask; 1092 SkMask mask;
1081 if (paint->getRasterizer()->rasterize(*pathPtr, *matrix, 1093 if (paint->getRasterizer()->rasterize(*pathPtr, *matrix,
1082 &fRC->getBounds(), paint->getMaskFilter(), &mask, 1094 &fRC->getBounds(), paint->getMaskFilter(), &mask,
1083 SkMask::kComputeBoundsAndRenderImage_CreateMode)) { 1095 SkMask::kComputeBoundsAndRenderImage_CreateMode)) {
1084 this->drawDevMask(mask, *paint); 1096 this->drawDevMask(mask, *paint);
1085 SkMask::FreeImage(mask.fImage); 1097 SkMask::FreeImage(mask.fImage);
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2382 mask->fImage = SkMask::AllocImage(size); 2394 mask->fImage = SkMask::AllocImage(size);
2383 memset(mask->fImage, 0, mask->computeImageSize()); 2395 memset(mask->fImage, 0, mask->computeImageSize());
2384 } 2396 }
2385 2397
2386 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2398 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2387 draw_into_mask(*mask, devPath, style); 2399 draw_into_mask(*mask, devPath, style);
2388 } 2400 }
2389 2401
2390 return true; 2402 return true;
2391 } 2403 }
OLDNEW
« no previous file with comments | « include/core/SkStrokeRec.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698