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

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

Issue 13699004: first draft of error checking / reporting API (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove unnecessary include, delete Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkErrorInternals.h ('k') | tests/ErrorTest.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 /* 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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkErrorInternals.h ('k') | tests/ErrorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698