OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBitmapCache.h" | 8 #include "SkBitmapCache.h" |
9 #include "SkBitmapController.h" | 9 #include "SkBitmapController.h" |
10 #include "SkBitmapProcState.h" | 10 #include "SkBitmapProcState.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 bool clampClamp = SkShader::kClamp_TileMode == fTileModeX && | 151 bool clampClamp = SkShader::kClamp_TileMode == fTileModeX && |
152 SkShader::kClamp_TileMode == fTileModeY; | 152 SkShader::kClamp_TileMode == fTileModeY; |
153 | 153 |
154 // Most of the scanline procs deal with "unit" texture coordinates, as this | 154 // Most of the scanline procs deal with "unit" texture coordinates, as this |
155 // makes it easy to perform tiling modes (repeat = (x & 0xFFFF)). To generat
e | 155 // makes it easy to perform tiling modes (repeat = (x & 0xFFFF)). To generat
e |
156 // those, we divide the matrix by its dimensions here. | 156 // those, we divide the matrix by its dimensions here. |
157 // | 157 // |
158 // We don't do this if we're either trivial (can ignore the matrix) or clamp
ing | 158 // We don't do this if we're either trivial (can ignore the matrix) or clamp
ing |
159 // in both X and Y since clamping to width,height is just as easy as to 0xFF
FF. | 159 // in both X and Y since clamping to width,height is just as easy as to 0xFF
FF. |
160 | 160 |
161 if (!(clampClamp || trivialMatrix)) { | 161 // Note that we cannot ignore the matrix when allow_ignore_fractional_transl
ate is false. |
| 162 |
| 163 if (!(clampClamp || (trivialMatrix && allow_ignore_fractional_translate))) { |
162 fInvMatrix.postIDiv(fPixmap.width(), fPixmap.height()); | 164 fInvMatrix.postIDiv(fPixmap.width(), fPixmap.height()); |
163 } | 165 } |
164 | 166 |
165 // Now that all possible changes to the matrix have taken place, check | 167 // Now that all possible changes to the matrix have taken place, check |
166 // to see if we're really close to a no-scale matrix. If so, explicitly | 168 // to see if we're really close to a no-scale matrix. If so, explicitly |
167 // set it to be so. Subsequent code may inspect this matrix to choose | 169 // set it to be so. Subsequent code may inspect this matrix to choose |
168 // a faster path in this case. | 170 // a faster path in this case. |
169 | 171 |
170 // This code will only execute if the matrix has some scale component; | 172 // This code will only execute if the matrix has some scale component; |
171 // if it's already pure translate then we won't do this inversion. | 173 // if it's already pure translate then we won't do this inversion. |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 *dst++ = src[index]; | 822 *dst++ = src[index]; |
821 fx += dx; | 823 fx += dx; |
822 } | 824 } |
823 } else { | 825 } else { |
824 for (int i = 0; i < count; ++i) { | 826 for (int i = 0; i < count; ++i) { |
825 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; | 827 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; |
826 fx += dx; | 828 fx += dx; |
827 } | 829 } |
828 } | 830 } |
829 } | 831 } |
OLD | NEW |