Chromium Code Reviews

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

Issue 21877006: Add blend optimization helpers and use to convert rect draws to clears. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tot Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
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 #ifndef SkRect_DEFINED 10 #ifndef SkRect_DEFINED
(...skipping 448 matching lines...)
459 SkScalar centerY() const { return SkScalarHalf(fTop + fBottom); } 459 SkScalar centerY() const { return SkScalarHalf(fTop + fBottom); }
460 460
461 friend bool operator==(const SkRect& a, const SkRect& b) { 461 friend bool operator==(const SkRect& a, const SkRect& b) {
462 return SkScalarsEqual((SkScalar*)&a, (SkScalar*)&b, 4); 462 return SkScalarsEqual((SkScalar*)&a, (SkScalar*)&b, 4);
463 } 463 }
464 464
465 friend bool operator!=(const SkRect& a, const SkRect& b) { 465 friend bool operator!=(const SkRect& a, const SkRect& b) {
466 return !SkScalarsEqual((SkScalar*)&a, (SkScalar*)&b, 4); 466 return !SkScalarsEqual((SkScalar*)&a, (SkScalar*)&b, 4);
467 } 467 }
468 468
469 /** return the 4 points that enclose the rectangle 469 /** return the 4 points that enclose the rectangle (top-left, top-right, bot tom-right,
470 */ 470 bottom-left)
471 */
471 void toQuad(SkPoint quad[4]) const; 472 void toQuad(SkPoint quad[4]) const;
reed1 2013/08/05 14:56:02 TODO: I wonder if this guy should take a CW, CCW p
472 473
473 /** Set this rectangle to the empty rectangle (0,0,0,0) 474 /** Set this rectangle to the empty rectangle (0,0,0,0)
474 */ 475 */
475 void setEmpty() { memset(this, 0, sizeof(*this)); } 476 void setEmpty() { memset(this, 0, sizeof(*this)); }
476 477
477 void set(const SkIRect& src) { 478 void set(const SkIRect& src) {
478 fLeft = SkIntToScalar(src.fLeft); 479 fLeft = SkIntToScalar(src.fLeft);
479 fTop = SkIntToScalar(src.fTop); 480 fTop = SkIntToScalar(src.fTop);
480 fRight = SkIntToScalar(src.fRight); 481 fRight = SkIntToScalar(src.fRight);
481 fBottom = SkIntToScalar(src.fBottom); 482 fBottom = SkIntToScalar(src.fBottom);
(...skipping 299 matching lines...)
781 */ 782 */
782 void sort(); 783 void sort();
783 784
784 /** 785 /**
785 * cast-safe way to treat the rect as an array of (4) SkScalars. 786 * cast-safe way to treat the rect as an array of (4) SkScalars.
786 */ 787 */
787 const SkScalar* asScalars() const { return &fLeft; } 788 const SkScalar* asScalars() const { return &fLeft; }
788 }; 789 };
789 790
790 #endif 791 #endif
OLDNEW

Powered by Google App Engine