| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 fInset = buffer.readScalar(); | 240 fInset = buffer.readScalar(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 // FIXME: implement single-input semantics | 243 // FIXME: implement single-input semantics |
| 244 SkMagnifierImageFilter::SkMagnifierImageFilter(SkRect srcRect, SkScalar inset) | 244 SkMagnifierImageFilter::SkMagnifierImageFilter(SkRect srcRect, SkScalar inset) |
| 245 : INHERITED(0), fSrcRect(srcRect), fInset(inset) { | 245 : INHERITED(0), fSrcRect(srcRect), fInset(inset) { |
| 246 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0); | 246 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0); |
| 247 } | 247 } |
| 248 | 248 |
| 249 #if SK_SUPPORT_GPU | 249 #if SK_SUPPORT_GPU |
| 250 bool SkMagnifierImageFilter::asNewEffect(GrEffectRef** effect, GrTexture* textur
e, const SkMatrix&) const { | 250 bool SkMagnifierImageFilter::asNewEffect(GrEffectRef** effect, GrTexture* textur
e, const SkMatrix&, const SkIRect&) const { |
| 251 if (effect) { | 251 if (effect) { |
| 252 *effect = GrMagnifierEffect::Create(texture, | 252 *effect = GrMagnifierEffect::Create(texture, |
| 253 fSrcRect.x() / texture->width(), | 253 fSrcRect.x() / texture->width(), |
| 254 fSrcRect.y() / texture->height(), | 254 fSrcRect.y() / texture->height(), |
| 255 texture->width() / fSrcRect.width(), | 255 texture->width() / fSrcRect.width(), |
| 256 texture->height() / fSrcRect.height(
), | 256 texture->height() / fSrcRect.height(
), |
| 257 fInset / texture->width(), | 257 fInset / texture->width(), |
| 258 fInset / texture->height()); | 258 fInset / texture->height()); |
| 259 } | 259 } |
| 260 return true; | 260 return true; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 328 |
| 329 int x_val = SkMin32(SkScalarFloorToInt(x_interp), width - 1); | 329 int x_val = SkMin32(SkScalarFloorToInt(x_interp), width - 1); |
| 330 int y_val = SkMin32(SkScalarFloorToInt(y_interp), height - 1); | 330 int y_val = SkMin32(SkScalarFloorToInt(y_interp), height - 1); |
| 331 | 331 |
| 332 *dptr = sptr[y_val * width + x_val]; | 332 *dptr = sptr[y_val * width + x_val]; |
| 333 dptr++; | 333 dptr++; |
| 334 } | 334 } |
| 335 } | 335 } |
| 336 return true; | 336 return true; |
| 337 } | 337 } |
| OLD | NEW |