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

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

Issue 22558003: Add blend optimization helpers and use to convert rect draws to clears. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: suppress warning Created 7 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkMatrix.h ('k') | include/gpu/GrPaint.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 /* 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...) Expand 10 before | Expand all | Expand 10 after
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). TODO: Consider adding param to control whether quad is CW or CCW.
471 */
471 void toQuad(SkPoint quad[4]) const; 472 void toQuad(SkPoint quad[4]) const;
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);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
« no previous file with comments | « include/core/SkMatrix.h ('k') | include/gpu/GrPaint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698