| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 uint32_t inset = random->nextULessThan(kMaxInset); | 198 uint32_t inset = random->nextULessThan(kMaxInset); |
| 199 | 199 |
| 200 GrEffect* effect = GrMagnifierEffect::Create( | 200 GrEffect* effect = GrMagnifierEffect::Create( |
| 201 texture, | 201 texture, |
| 202 (float) width / texture->width(), | 202 (float) width / texture->width(), |
| 203 (float) height / texture->height(), | 203 (float) height / texture->height(), |
| 204 texture->width() / (float) x, | 204 texture->width() / (float) x, |
| 205 texture->height() / (float) y, | 205 texture->height() / (float) y, |
| 206 (float) inset / texture->width(), | 206 (float) inset / texture->width(), |
| 207 (float) inset / texture->height()); | 207 (float) inset / texture->height()); |
| 208 SkASSERT(NULL != effect); | 208 SkASSERT(effect); |
| 209 return effect; | 209 return effect; |
| 210 } | 210 } |
| 211 | 211 |
| 212 /////////////////////////////////////////////////////////////////////////////// | 212 /////////////////////////////////////////////////////////////////////////////// |
| 213 | 213 |
| 214 const GrBackendEffectFactory& GrMagnifierEffect::getFactory() const { | 214 const GrBackendEffectFactory& GrMagnifierEffect::getFactory() const { |
| 215 return GrTBackendEffectFactory<GrMagnifierEffect>::getInstance(); | 215 return GrTBackendEffectFactory<GrMagnifierEffect>::getInstance(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 bool GrMagnifierEffect::onIsEqual(const GrEffect& sBase) const { | 218 bool GrMagnifierEffect::onIsEqual(const GrEffect& sBase) const { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); | 365 int x_val = SkPin32(SkScalarFloorToInt(x_interp), 0, width - 1); |
| 366 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); | 366 int y_val = SkPin32(SkScalarFloorToInt(y_interp), 0, height - 1); |
| 367 | 367 |
| 368 *dptr = sptr[y_val * width + x_val]; | 368 *dptr = sptr[y_val * width + x_val]; |
| 369 dptr++; | 369 dptr++; |
| 370 } | 370 } |
| 371 } | 371 } |
| 372 return true; | 372 return true; |
| 373 } | 373 } |
| OLD | NEW |