OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkDrawLooper.h" | 8 #include "SkDrawLooper.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkMatrix.h" | 10 #include "SkMatrix.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 break; | 28 break; |
29 } | 29 } |
30 } | 30 } |
31 return true; | 31 return true; |
32 } | 32 } |
33 | 33 |
34 void SkDrawLooper::computeFastBounds(const SkPaint& paint, const SkRect& src, | 34 void SkDrawLooper::computeFastBounds(const SkPaint& paint, const SkRect& src, |
35 SkRect* dst) { | 35 SkRect* dst) { |
36 SkCanvas canvas; | 36 SkCanvas canvas; |
37 | 37 |
| 38 *dst = src; |
38 this->init(&canvas); | 39 this->init(&canvas); |
39 for (bool firstTime = true;; firstTime = false) { | 40 for (bool firstTime = true;; firstTime = false) { |
40 SkPaint p(paint); | 41 SkPaint p(paint); |
41 if (this->next(&canvas, &p)) { | 42 if (this->next(&canvas, &p)) { |
42 SkRect r(src); | 43 SkRect r(src); |
43 | 44 |
44 p.setLooper(NULL); | 45 p.setLooper(NULL); |
45 p.computeFastBounds(r, &r); | 46 p.computeFastBounds(r, &r); |
46 canvas.getTotalMatrix().mapRect(&r); | 47 canvas.getTotalMatrix().mapRect(&r); |
47 | 48 |
48 if (firstTime) { | 49 if (firstTime) { |
49 *dst = r; | 50 *dst = r; |
50 } else { | 51 } else { |
51 dst->join(r); | 52 dst->join(r); |
52 } | 53 } |
53 } else { | 54 } else { |
54 break; | 55 break; |
55 } | 56 } |
56 } | 57 } |
57 } | 58 } |
OLD | NEW |