| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
| 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkMagnifierImageFilter.h" | 9 #include "SkMagnifierImageFilter.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 uint32_t y = random->nextULessThan(kMaxHeight - height); | 212 uint32_t y = random->nextULessThan(kMaxHeight - height); |
| 213 SkScalar inset = SkIntToScalar(random->nextULessThan(kMaxInset)); | 213 SkScalar inset = SkIntToScalar(random->nextULessThan(kMaxInset)); |
| 214 | 214 |
| 215 SkAutoTUnref<SkMagnifierImageFilter> filter( | 215 SkAutoTUnref<SkMagnifierImageFilter> filter( |
| 216 new SkMagnifierImageFilter( | 216 new SkMagnifierImageFilter( |
| 217 SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(y), | 217 SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(y), |
| 218 SkIntToScalar(width), SkIntToScalar(height)), | 218 SkIntToScalar(width), SkIntToScalar(height)), |
| 219 inset)); | 219 inset)); |
| 220 GrEffectRef* effect; | 220 GrEffectRef* effect; |
| 221 filter->asNewEffect(&effect, textures[0], SkIPoint::Make(0, 0)); | 221 filter->asNewEffect(&effect, textures[0], SkIPoint::Make(0, 0)); |
| 222 GrAssert(NULL != effect); | 222 SkASSERT(NULL != effect); |
| 223 return effect; | 223 return effect; |
| 224 } | 224 } |
| 225 | 225 |
| 226 /////////////////////////////////////////////////////////////////////////////// | 226 /////////////////////////////////////////////////////////////////////////////// |
| 227 | 227 |
| 228 const GrBackendEffectFactory& GrMagnifierEffect::getFactory() const { | 228 const GrBackendEffectFactory& GrMagnifierEffect::getFactory() const { |
| 229 return GrTBackendEffectFactory<GrMagnifierEffect>::getInstance(); | 229 return GrTBackendEffectFactory<GrMagnifierEffect>::getInstance(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 bool GrMagnifierEffect::onIsEqual(const GrEffect& sBase) const { | 232 bool GrMagnifierEffect::onIsEqual(const GrEffect& sBase) const { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 345 |
| 346 int x_val = SkMin32(SkScalarFloorToInt(x_interp), width - 1); | 346 int x_val = SkMin32(SkScalarFloorToInt(x_interp), width - 1); |
| 347 int y_val = SkMin32(SkScalarFloorToInt(y_interp), height - 1); | 347 int y_val = SkMin32(SkScalarFloorToInt(y_interp), height - 1); |
| 348 | 348 |
| 349 *dptr = sptr[y_val * width + x_val]; | 349 *dptr = sptr[y_val * width + x_val]; |
| 350 dptr++; | 350 dptr++; |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 return true; | 353 return true; |
| 354 } | 354 } |
| OLD | NEW |