OLD | NEW |
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 "SkPictureShader.h" | 8 #include "SkPictureShader.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 SkASSERT(fPicture && !fPicture->cullRect().isEmpty()); | 145 SkASSERT(fPicture && !fPicture->cullRect().isEmpty()); |
146 | 146 |
147 SkMatrix m; | 147 SkMatrix m; |
148 m.setConcat(matrix, this->getLocalMatrix()); | 148 m.setConcat(matrix, this->getLocalMatrix()); |
149 if (localM) { | 149 if (localM) { |
150 m.preConcat(*localM); | 150 m.preConcat(*localM); |
151 } | 151 } |
152 | 152 |
153 // Use a rotation-invariant scale | 153 // Use a rotation-invariant scale |
154 SkPoint scale; | 154 SkPoint scale; |
155 // | |
156 // TODO: replace this with decomposeScale() -- but beware LayoutTest rebasel
ines! | |
157 // | |
158 if (!SkDecomposeUpper2x2(m, NULL, &scale, NULL)) { | 155 if (!SkDecomposeUpper2x2(m, NULL, &scale, NULL)) { |
159 // Decomposition failed, use an approximation. | 156 // Decomposition failed, use an approximation. |
160 scale.set(SkScalarSqrt(m.getScaleX() * m.getScaleX() + m.getSkewX() * m.
getSkewX()), | 157 scale.set(SkScalarSqrt(m.getScaleX() * m.getScaleX() + m.getSkewX() * m.
getSkewX()), |
161 SkScalarSqrt(m.getScaleY() * m.getScaleY() + m.getSkewY() * m.
getSkewY())); | 158 SkScalarSqrt(m.getScaleY() * m.getScaleY() + m.getSkewY() * m.
getSkewY())); |
162 } | 159 } |
163 SkSize scaledSize = SkSize::Make(SkScalarAbs(scale.x() * fTile.width()), | 160 SkSize scaledSize = SkSize::Make(SkScalarAbs(scale.x() * fTile.width()), |
164 SkScalarAbs(scale.y() * fTile.height())); | 161 SkScalarAbs(scale.y() * fTile.height())); |
165 | 162 |
166 // Clamp the tile size to about 4M pixels | 163 // Clamp the tile size to about 4M pixels |
167 static const SkScalar kMaxTileArea = 2048 * 2048; | 164 static const SkScalar kMaxTileArea = 2048 * 2048; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC
olor, fp); | 303 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC
olor, fp); |
307 } | 304 } |
308 #else | 305 #else |
309 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa
trix&, | 306 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa
trix&, |
310 const SkMatrix*, GrColor*, | 307 const SkMatrix*, GrColor*, |
311 GrFragmentProcessor**) const { | 308 GrFragmentProcessor**) const { |
312 SkDEBUGFAIL("Should not call in GPU-less build"); | 309 SkDEBUGFAIL("Should not call in GPU-less build"); |
313 return false; | 310 return false; |
314 } | 311 } |
315 #endif | 312 #endif |
OLD | NEW |