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

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

Issue 26371002: Change SkImageFilter's cropRect from SkIRect to a CropRect struct (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Alternate version, using a single fFlags member. Created 7 years, 2 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/SkImageFilter.h ('k') | include/effects/SkBlurImageFilter.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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 */ 364 */
365 struct SK_API SkRect { 365 struct SK_API SkRect {
366 SkScalar fLeft, fTop, fRight, fBottom; 366 SkScalar fLeft, fTop, fRight, fBottom;
367 367
368 static SkRect SK_WARN_UNUSED_RESULT MakeEmpty() { 368 static SkRect SK_WARN_UNUSED_RESULT MakeEmpty() {
369 SkRect r; 369 SkRect r;
370 r.setEmpty(); 370 r.setEmpty();
371 return r; 371 return r;
372 } 372 }
373 373
374 static SkRect SK_WARN_UNUSED_RESULT MakeLargest() {
375 SkRect r;
376 r.setLargest();
377 return r;
378 }
379
374 static SkRect SK_WARN_UNUSED_RESULT MakeWH(SkScalar w, SkScalar h) { 380 static SkRect SK_WARN_UNUSED_RESULT MakeWH(SkScalar w, SkScalar h) {
375 SkRect r; 381 SkRect r;
376 r.set(0, 0, w, h); 382 r.set(0, 0, w, h);
377 return r; 383 return r;
378 } 384 }
379 385
380 static SkRect SK_WARN_UNUSED_RESULT MakeSize(const SkSize& size) { 386 static SkRect SK_WARN_UNUSED_RESULT MakeSize(const SkSize& size) {
381 SkRect r; 387 SkRect r;
382 r.set(0, 0, size.width(), size.height()); 388 r.set(0, 0, size.width(), size.height());
383 return r; 389 return r;
(...skipping 28 matching lines...) Expand all
412 SkIntToScalar(irect.fRight), 418 SkIntToScalar(irect.fRight),
413 SkIntToScalar(irect.fBottom)); 419 SkIntToScalar(irect.fBottom));
414 return r; 420 return r;
415 } 421 }
416 422
417 /** 423 /**
418 * Return true if the rectangle's width or height are <= 0 424 * Return true if the rectangle's width or height are <= 0
419 */ 425 */
420 bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; } 426 bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; }
421 427
428 bool isLargest() const { return SK_ScalarMin == fLeft &&
429 SK_ScalarMin == fTop &&
430 SK_ScalarMax == fRight &&
431 SK_ScalarMax == fBottom; }
432
422 /** 433 /**
423 * Returns true iff all values in the rect are finite. If any are 434 * Returns true iff all values in the rect are finite. If any are
424 * infinite or NaN (or SK_FixedNaN when SkScalar is fixed) then this 435 * infinite or NaN (or SK_FixedNaN when SkScalar is fixed) then this
425 * returns false. 436 * returns false.
426 */ 437 */
427 bool isFinite() const { 438 bool isFinite() const {
428 #ifdef SK_SCALAR_IS_FLOAT 439 #ifdef SK_SCALAR_IS_FLOAT
429 float accum = 0; 440 float accum = 0;
430 accum *= fLeft; 441 accum *= fLeft;
431 accum *= fTop; 442 accum *= fTop;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 */ 808 */
798 void sort(); 809 void sort();
799 810
800 /** 811 /**
801 * cast-safe way to treat the rect as an array of (4) SkScalars. 812 * cast-safe way to treat the rect as an array of (4) SkScalars.
802 */ 813 */
803 const SkScalar* asScalars() const { return &fLeft; } 814 const SkScalar* asScalars() const { return &fLeft; }
804 }; 815 };
805 816
806 #endif 817 #endif
OLDNEW
« no previous file with comments | « include/core/SkImageFilter.h ('k') | include/effects/SkBlurImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698