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

Side by Side Diff: include/core/SkPath.h

Issue 1306443004: Use static_assert instead of SK_COMPILE_ASSERT. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/SkImageInfo.h ('k') | include/core/SkTypes.h » ('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 #ifndef SkPath_DEFINED 8 #ifndef SkPath_DEFINED
9 #define SkPath_DEFINED 9 #define SkPath_DEFINED
10 10
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 498
499 /** 499 /**
500 * Returns whether or not a fill type is inverted 500 * Returns whether or not a fill type is inverted
501 * 501 *
502 * kWinding_FillType -> false 502 * kWinding_FillType -> false
503 * kEvenOdd_FillType -> false 503 * kEvenOdd_FillType -> false
504 * kInverseWinding_FillType -> true 504 * kInverseWinding_FillType -> true
505 * kInverseEvenOdd_FillType -> true 505 * kInverseEvenOdd_FillType -> true
506 */ 506 */
507 static bool IsInverseFillType(FillType fill) { 507 static bool IsInverseFillType(FillType fill) {
508 SK_COMPILE_ASSERT(0 == kWinding_FillType, fill_type_mismatch); 508 static_assert(0 == kWinding_FillType, "fill_type_mismatch");
509 SK_COMPILE_ASSERT(1 == kEvenOdd_FillType, fill_type_mismatch); 509 static_assert(1 == kEvenOdd_FillType, "fill_type_mismatch");
510 SK_COMPILE_ASSERT(2 == kInverseWinding_FillType, fill_type_mismatch); 510 static_assert(2 == kInverseWinding_FillType, "fill_type_mismatch");
511 SK_COMPILE_ASSERT(3 == kInverseEvenOdd_FillType, fill_type_mismatch); 511 static_assert(3 == kInverseEvenOdd_FillType, "fill_type_mismatch");
512 return (fill & 2) != 0; 512 return (fill & 2) != 0;
513 } 513 }
514 514
515 /** 515 /**
516 * Returns the equivalent non-inverted fill type to the given fill type 516 * Returns the equivalent non-inverted fill type to the given fill type
517 * 517 *
518 * kWinding_FillType -> kWinding_FillType 518 * kWinding_FillType -> kWinding_FillType
519 * kEvenOdd_FillType -> kEvenOdd_FillType 519 * kEvenOdd_FillType -> kEvenOdd_FillType
520 * kInverseWinding_FillType -> kWinding_FillType 520 * kInverseWinding_FillType -> kWinding_FillType
521 * kInverseEvenOdd_FillType -> kEvenOdd_FillType 521 * kInverseEvenOdd_FillType -> kEvenOdd_FillType
522 */ 522 */
523 static FillType ConvertToNonInverseFillType(FillType fill) { 523 static FillType ConvertToNonInverseFillType(FillType fill) {
524 SK_COMPILE_ASSERT(0 == kWinding_FillType, fill_type_mismatch); 524 static_assert(0 == kWinding_FillType, "fill_type_mismatch");
525 SK_COMPILE_ASSERT(1 == kEvenOdd_FillType, fill_type_mismatch); 525 static_assert(1 == kEvenOdd_FillType, "fill_type_mismatch");
526 SK_COMPILE_ASSERT(2 == kInverseWinding_FillType, fill_type_mismatch); 526 static_assert(2 == kInverseWinding_FillType, "fill_type_mismatch");
527 SK_COMPILE_ASSERT(3 == kInverseEvenOdd_FillType, fill_type_mismatch); 527 static_assert(3 == kInverseEvenOdd_FillType, "fill_type_mismatch");
528 return (FillType)(fill & 1); 528 return (FillType)(fill & 1);
529 } 529 }
530 530
531 /** 531 /**
532 * Returns true if the path specifies a rectangle. 532 * Returns true if the path specifies a rectangle.
533 * 533 *
534 * If this returns false, then all output parameters are ignored, and left 534 * If this returns false, then all output parameters are ignored, and left
535 * unchanged. If this returns true, then each of the output parameters 535 * unchanged. If this returns true, then each of the output parameters
536 * are checked for NULL. If they are not, they return their value. 536 * are checked for NULL. If they are not, they return their value.
537 * 537 *
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 void setPt(int index, SkScalar x, SkScalar y); 1002 void setPt(int index, SkScalar x, SkScalar y);
1003 1003
1004 friend class SkAutoPathBoundsUpdate; 1004 friend class SkAutoPathBoundsUpdate;
1005 friend class SkAutoDisableOvalCheck; 1005 friend class SkAutoDisableOvalCheck;
1006 friend class SkAutoDisableDirectionCheck; 1006 friend class SkAutoDisableDirectionCheck;
1007 friend class SkBench_AddPathTest; // perf test reversePathTo 1007 friend class SkBench_AddPathTest; // perf test reversePathTo
1008 friend class PathTest_Private; // unit test reversePathTo 1008 friend class PathTest_Private; // unit test reversePathTo
1009 }; 1009 };
1010 1010
1011 #endif 1011 #endif
OLDNEW
« no previous file with comments | « include/core/SkImageInfo.h ('k') | include/core/SkTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698