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 "SkTileImageFilter.h" | 8 #include "SkTileImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 SkIRect* dst) const { | 86 SkIRect* dst) const { |
87 SkRect srcRect; | 87 SkRect srcRect; |
88 ctm.mapRect(&srcRect, fSrcRect); | 88 ctm.mapRect(&srcRect, fSrcRect); |
89 SkIRect srcIRect; | 89 SkIRect srcIRect; |
90 srcRect.roundOut(&srcIRect); | 90 srcRect.roundOut(&srcIRect); |
91 srcIRect.join(src); | 91 srcIRect.join(src); |
92 *dst = srcIRect; | 92 *dst = srcIRect; |
93 return true; | 93 return true; |
94 } | 94 } |
95 | 95 |
| 96 void SkTileImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const
{ |
| 97 // This is a workaround for skia:3194. |
| 98 *dst = src; |
| 99 dst->join(fDstRect); |
| 100 } |
| 101 |
96 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) { | 102 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) { |
97 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 103 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
98 SkRect src, dst; | 104 SkRect src, dst; |
99 buffer.readRect(&src); | 105 buffer.readRect(&src); |
100 buffer.readRect(&dst); | 106 buffer.readRect(&dst); |
101 return Create(src, dst, common.getInput(0)); | 107 return Create(src, dst, common.getInput(0)); |
102 } | 108 } |
103 | 109 |
104 void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const { | 110 void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const { |
105 this->INHERITED::flatten(buffer); | 111 this->INHERITED::flatten(buffer); |
106 buffer.writeRect(fSrcRect); | 112 buffer.writeRect(fSrcRect); |
107 buffer.writeRect(fDstRect); | 113 buffer.writeRect(fDstRect); |
108 } | 114 } |
109 | 115 |
110 #ifndef SK_IGNORE_TO_STRING | 116 #ifndef SK_IGNORE_TO_STRING |
111 void SkTileImageFilter::toString(SkString* str) const { | 117 void SkTileImageFilter::toString(SkString* str) const { |
112 str->appendf("SkTileImageFilter: ("); | 118 str->appendf("SkTileImageFilter: ("); |
113 str->appendf("src: %.2f %.2f %.2f %.2f", | 119 str->appendf("src: %.2f %.2f %.2f %.2f", |
114 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); | 120 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); |
115 str->appendf(" dst: %.2f %.2f %.2f %.2f", | 121 str->appendf(" dst: %.2f %.2f %.2f %.2f", |
116 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); | 122 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); |
117 if (this->getInput(0)) { | 123 if (this->getInput(0)) { |
118 str->appendf("input: ("); | 124 str->appendf("input: ("); |
119 this->getInput(0)->toString(str); | 125 this->getInput(0)->toString(str); |
120 str->appendf(")"); | 126 str->appendf(")"); |
121 } | 127 } |
122 str->append(")"); | 128 str->append(")"); |
123 } | 129 } |
124 #endif | 130 #endif |
OLD | NEW |