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

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

Issue 1003813003: some utils for rect and matrix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 | « src/core/SkDraw.cpp ('k') | src/core/SkRasterizer.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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
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 #include "SkRRect.h" 8 #include "SkRRect.h"
9 #include "SkMatrix.h" 9 #include "SkMatrix.h"
10 10
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 446 }
447 447
448 SkDEBUGCODE(dst->validate();) 448 SkDEBUGCODE(dst->validate();)
449 449
450 return true; 450 return true;
451 } 451 }
452 452
453 /////////////////////////////////////////////////////////////////////////////// 453 ///////////////////////////////////////////////////////////////////////////////
454 454
455 void SkRRect::inset(SkScalar dx, SkScalar dy, SkRRect* dst) const { 455 void SkRRect::inset(SkScalar dx, SkScalar dy, SkRRect* dst) const {
456 SkRect r = fRect; 456 const SkRect r = fRect.makeInset(dx, dy);
457 457
458 r.inset(dx, dy);
459 if (r.isEmpty()) { 458 if (r.isEmpty()) {
460 dst->setEmpty(); 459 dst->setEmpty();
461 return; 460 return;
462 } 461 }
463 462
464 SkVector radii[4]; 463 SkVector radii[4];
465 memcpy(radii, fRadii, sizeof(radii)); 464 memcpy(radii, fRadii, sizeof(radii));
466 for (int i = 0; i < 4; ++i) { 465 for (int i = 0; i < 4; ++i) {
467 if (radii[i].fX) { 466 if (radii[i].fX) {
468 radii[i].fX -= dx; 467 radii[i].fX -= dx;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 589 }
591 590
592 for (int i = 0; i < 4; ++i) { 591 for (int i = 0; i < 4; ++i) {
593 validate_radius_check_predicates(fRadii[i].fX, fRect.fLeft, fRect.fRight ); 592 validate_radius_check_predicates(fRadii[i].fX, fRect.fLeft, fRect.fRight );
594 validate_radius_check_predicates(fRadii[i].fY, fRect.fTop, fRect.fBottom ); 593 validate_radius_check_predicates(fRadii[i].fY, fRect.fTop, fRect.fBottom );
595 } 594 }
596 } 595 }
597 #endif // SK_DEBUG 596 #endif // SK_DEBUG
598 597
599 /////////////////////////////////////////////////////////////////////////////// 598 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkRasterizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698