OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
| 10 #include "SkBuffer.h" |
| 11 #include "SkErrorInternals.h" |
| 12 #include "SkMath.h" |
10 #include "SkPath.h" | 13 #include "SkPath.h" |
11 #include "SkBuffer.h" | |
12 #include "SkMath.h" | |
13 #include "SkPathRef.h" | 14 #include "SkPathRef.h" |
14 #include "SkRRect.h" | 15 #include "SkRRect.h" |
15 #include "SkThread.h" | 16 #include "SkThread.h" |
16 | 17 |
17 //////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////// |
18 | 19 |
19 #if SK_DEBUG_PATH_REF | 20 #if SK_DEBUG_PATH_REF |
20 | 21 |
21 SkPath::PathRefDebugRef::PathRefDebugRef(SkPath* owner) : fOwner(owner) {} | 22 SkPath::PathRefDebugRef::PathRefDebugRef(SkPath* owner) : fOwner(owner) {} |
22 | 23 |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 ++verbs; | 1028 ++verbs; |
1028 } | 1029 } |
1029 return true; | 1030 return true; |
1030 } | 1031 } |
1031 | 1032 |
1032 #define CUBIC_ARC_FACTOR ((SK_ScalarSqrt2 - SK_Scalar1) * 4 / 3) | 1033 #define CUBIC_ARC_FACTOR ((SK_ScalarSqrt2 - SK_Scalar1) * 4 / 3) |
1033 | 1034 |
1034 void SkPath::addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, | 1035 void SkPath::addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, |
1035 Direction dir) { | 1036 Direction dir) { |
1036 assert_known_direction(dir); | 1037 assert_known_direction(dir); |
| 1038 |
| 1039 if (rx < 0 || ry < 0) { |
| 1040 SkErrorInternals::SetError( kInvalidArgument_SkError, |
| 1041 "I got %f and %f as radii to SkPath::AddRoun
dRect, " |
| 1042 "but negative radii are not allowed.", |
| 1043 SkScalarToDouble(rx), SkScalarToDouble(ry) )
; |
| 1044 return; |
| 1045 } |
1037 | 1046 |
1038 SkScalar w = rect.width(); | 1047 SkScalar w = rect.width(); |
1039 SkScalar halfW = SkScalarHalf(w); | 1048 SkScalar halfW = SkScalarHalf(w); |
1040 SkScalar h = rect.height(); | 1049 SkScalar h = rect.height(); |
1041 SkScalar halfH = SkScalarHalf(h); | 1050 SkScalar halfH = SkScalarHalf(h); |
1042 | 1051 |
1043 if (halfW <= 0 || halfH <= 0) { | 1052 if (halfW <= 0 || halfH <= 0) { |
1044 return; | 1053 return; |
1045 } | 1054 } |
1046 | 1055 |
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2951 switch (this->getFillType()) { | 2960 switch (this->getFillType()) { |
2952 case SkPath::kEvenOdd_FillType: | 2961 case SkPath::kEvenOdd_FillType: |
2953 case SkPath::kInverseEvenOdd_FillType: | 2962 case SkPath::kInverseEvenOdd_FillType: |
2954 w &= 1; | 2963 w &= 1; |
2955 break; | 2964 break; |
2956 default: | 2965 default: |
2957 break; | 2966 break; |
2958 } | 2967 } |
2959 return SkToBool(w); | 2968 return SkToBool(w); |
2960 } | 2969 } |
OLD | NEW |