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

Side by Side Diff: tools/sk_tool_utils.cpp

Issue 2214033002: Add new GM for occluded blurmask filter draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Appease compilers Created 4 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 | « tools/sk_tool_utils.h ('k') | no next file » | 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 2014 Google Inc. 2 * Copyright 2014 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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "sk_tool_utils_flags.h" 9 #include "sk_tool_utils_flags.h"
10 10
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 if (!radii.isZero()) { 506 if (!radii.isZero()) {
507 SkPoint p = intersection(radii.fX, radii.fY); 507 SkPoint p = intersection(radii.fX, radii.fY);
508 508
509 newL = SkTMax(newL, r.fLeft + radii.fX - p.fX); 509 newL = SkTMax(newL, r.fLeft + radii.fX - p.fX);
510 newB = SkTMin(newB, r.fBottom - radii.fY + p.fY); 510 newB = SkTMin(newB, r.fBottom - radii.fY + p.fY);
511 } 511 }
512 512
513 return SkRect::MakeLTRB(newL, newT, newR, newB); 513 return SkRect::MakeLTRB(newL, newT, newR, newB);
514 } 514 }
515 515
516 // The widest inset rect
517 SkRect compute_widest_occluder(const SkRRect& rr) {
518 const SkRect& r = rr.getBounds();
519
520 const SkVector& ul = rr.radii(SkRRect::kUpperLeft_Corner);
521 const SkVector& ur = rr.radii(SkRRect::kUpperRight_Corner);
522 const SkVector& lr = rr.radii(SkRRect::kLowerRight_Corner);
523 const SkVector& ll = rr.radii(SkRRect::kLowerLeft_Corner);
524
525 SkScalar maxT = SkTMax(ul.fY, ur.fY);
526 SkScalar maxB = SkTMax(ll.fY, lr.fY);
527
528 return SkRect::MakeLTRB(r.fLeft, r.fTop + maxT, r.fRight, r.fBottom - maxB);
529
530 }
531
532 // The tallest inset rect
533 SkRect compute_tallest_occluder(const SkRRect& rr) {
534 const SkRect& r = rr.getBounds();
535
536 const SkVector& ul = rr.radii(SkRRect::kUpperLeft_Corner);
537 const SkVector& ur = rr.radii(SkRRect::kUpperRight_Corner);
538 const SkVector& lr = rr.radii(SkRRect::kLowerRight_Corner);
539 const SkVector& ll = rr.radii(SkRRect::kLowerLeft_Corner);
540
541 SkScalar maxL = SkTMax(ul.fX, ll.fX);
542 SkScalar maxR = SkTMax(ur.fX, lr.fX);
543
544 return SkRect::MakeLTRB(r.fLeft + maxL, r.fTop, r.fRight - maxR, r.fBottom);
545 }
546
547
516 } // namespace sk_tool_utils 548 } // namespace sk_tool_utils
OLDNEW
« no previous file with comments | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698