OLD | NEW |
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 #define __STDC_LIMIT_MACROS | 7 #define __STDC_LIMIT_MACROS |
8 | 8 |
9 #include "SkDraw.h" | 9 #include "SkDraw.h" |
10 #include "SkBlitter.h" | 10 #include "SkBlitter.h" |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 } | 998 } |
999 } | 999 } |
1000 | 1000 |
1001 DRAW_PATH: | 1001 DRAW_PATH: |
1002 // Now fall back to the default case of using a path. | 1002 // Now fall back to the default case of using a path. |
1003 SkPath path; | 1003 SkPath path; |
1004 path.addRRect(rrect); | 1004 path.addRRect(rrect); |
1005 this->drawPath(path, paint, nullptr, true); | 1005 this->drawPath(path, paint, nullptr, true); |
1006 } | 1006 } |
1007 | 1007 |
1008 static SkScalar compute_res_scale_for_stroking(const SkMatrix& matrix) { | 1008 SkScalar SkDraw::ComputeResScaleForStroking(const SkMatrix& matrix) { |
1009 if (!matrix.hasPerspective()) { | 1009 if (!matrix.hasPerspective()) { |
1010 SkScalar sx = SkPoint::Length(matrix[SkMatrix::kMScaleX], matrix[SkMatri
x::kMSkewY]); | 1010 SkScalar sx = SkPoint::Length(matrix[SkMatrix::kMScaleX], matrix[SkMatri
x::kMSkewY]); |
1011 SkScalar sy = SkPoint::Length(matrix[SkMatrix::kMSkewX], matrix[SkMatri
x::kMScaleY]); | 1011 SkScalar sy = SkPoint::Length(matrix[SkMatrix::kMSkewX], matrix[SkMatri
x::kMScaleY]); |
1012 if (SkScalarsAreFinite(sx, sy)) { | 1012 if (SkScalarsAreFinite(sx, sy)) { |
1013 return SkTMax(sx, sy); | 1013 return SkTMax(sx, sy); |
1014 } | 1014 } |
1015 } | 1015 } |
1016 return 1; | 1016 return 1; |
1017 } | 1017 } |
1018 | 1018 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 } | 1078 } |
1079 } | 1079 } |
1080 | 1080 |
1081 if (paint->getPathEffect() || paint->getStyle() != SkPaint::kFill_Style) { | 1081 if (paint->getPathEffect() || paint->getStyle() != SkPaint::kFill_Style) { |
1082 SkRect cullRect; | 1082 SkRect cullRect; |
1083 const SkRect* cullRectPtr = nullptr; | 1083 const SkRect* cullRectPtr = nullptr; |
1084 if (this->computeConservativeLocalClipBounds(&cullRect)) { | 1084 if (this->computeConservativeLocalClipBounds(&cullRect)) { |
1085 cullRectPtr = &cullRect; | 1085 cullRectPtr = &cullRect; |
1086 } | 1086 } |
1087 doFill = paint->getFillPath(*pathPtr, &tmpPath, cullRectPtr, | 1087 doFill = paint->getFillPath(*pathPtr, &tmpPath, cullRectPtr, |
1088 compute_res_scale_for_stroking(*fMatrix)); | 1088 ComputeResScaleForStroking(*fMatrix)); |
1089 pathPtr = &tmpPath; | 1089 pathPtr = &tmpPath; |
1090 } | 1090 } |
1091 | 1091 |
1092 if (paint->getRasterizer()) { | 1092 if (paint->getRasterizer()) { |
1093 SkMask mask; | 1093 SkMask mask; |
1094 if (paint->getRasterizer()->rasterize(*pathPtr, *matrix, | 1094 if (paint->getRasterizer()->rasterize(*pathPtr, *matrix, |
1095 &fRC->getBounds(), paint->getMaskFilter(), &mask, | 1095 &fRC->getBounds(), paint->getMaskFilter(), &mask, |
1096 SkMask::kComputeBoundsAndRenderImage_CreateMode)) { | 1096 SkMask::kComputeBoundsAndRenderImage_CreateMode)) { |
1097 this->drawDevMask(mask, *paint); | 1097 this->drawDevMask(mask, *paint); |
1098 SkMask::FreeImage(mask.fImage); | 1098 SkMask::FreeImage(mask.fImage); |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2068 mask->fImage = SkMask::AllocImage(size); | 2068 mask->fImage = SkMask::AllocImage(size); |
2069 memset(mask->fImage, 0, mask->computeImageSize()); | 2069 memset(mask->fImage, 0, mask->computeImageSize()); |
2070 } | 2070 } |
2071 | 2071 |
2072 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2072 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
2073 draw_into_mask(*mask, devPath, style); | 2073 draw_into_mask(*mask, devPath, style); |
2074 } | 2074 } |
2075 | 2075 |
2076 return true; | 2076 return true; |
2077 } | 2077 } |
OLD | NEW |