| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 } | 269 } |
| 270 | 270 |
| 271 | 271 |
| 272 SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar i
nset, | 272 SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar i
nset, |
| 273 SkImageFilter* input) | 273 SkImageFilter* input) |
| 274 : INHERITED(1, &input), fSrcRect(srcRect), fInset(inset) { | 274 : INHERITED(1, &input), fSrcRect(srcRect), fInset(inset) { |
| 275 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0); | 275 SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0); |
| 276 } | 276 } |
| 277 | 277 |
| 278 #if SK_SUPPORT_GPU | 278 #if SK_SUPPORT_GPU |
| 279 bool SkMagnifierImageFilter::asFragmentProcessor(GrFragmentProcessor** fp, GrTex
ture* texture, | 279 bool SkMagnifierImageFilter::asFragmentProcessor(GrFragmentProcessor** fp, GrSha
derDataManager*, |
| 280 const SkMatrix&, const SkIRect&
bounds) const { | 280 GrTexture* texture, const SkMat
rix&, |
| 281 const SkIRect&bounds) const { |
| 281 if (fp) { | 282 if (fp) { |
| 282 SkScalar yOffset = texture->origin() == kTopLeft_GrSurfaceOrigin ? fSrcR
ect.y() : | 283 SkScalar yOffset = texture->origin() == kTopLeft_GrSurfaceOrigin ? fSrcR
ect.y() : |
| 283 texture->height() - fSrcRect.height() * texture->height() / bounds.he
ight() | 284 texture->height() - fSrcRect.height() * texture->height() / bounds.he
ight() |
| 284 - fSrcRect.y(); | 285 - fSrcRect.y(); |
| 285 int boundsY = (texture->origin() == kTopLeft_GrSurfaceOrigin) ? bounds.y
() : | 286 int boundsY = (texture->origin() == kTopLeft_GrSurfaceOrigin) ? bounds.y
() : |
| 286 (texture->height() - bounds.height()); | 287 (texture->height() - bounds.height()); |
| 287 SkRect effectBounds = SkRect::MakeXYWH( | 288 SkRect effectBounds = SkRect::MakeXYWH( |
| 288 SkIntToScalar(bounds.x()) / texture->width(), | 289 SkIntToScalar(bounds.x()) / texture->width(), |
| 289 SkIntToScalar(boundsY) / texture->height(), | 290 SkIntToScalar(boundsY) / texture->height(), |
| 290 SkIntToScalar(texture->width()) / bounds.width(), | 291 SkIntToScalar(texture->width()) / bounds.width(), |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 385 |
| 385 #ifndef SK_IGNORE_TO_STRING | 386 #ifndef SK_IGNORE_TO_STRING |
| 386 void SkMagnifierImageFilter::toString(SkString* str) const { | 387 void SkMagnifierImageFilter::toString(SkString* str) const { |
| 387 str->appendf("SkMagnifierImageFilter: ("); | 388 str->appendf("SkMagnifierImageFilter: ("); |
| 388 str->appendf("src: (%f,%f,%f,%f) ", | 389 str->appendf("src: (%f,%f,%f,%f) ", |
| 389 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); | 390 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto
m); |
| 390 str->appendf("inset: %f", fInset); | 391 str->appendf("inset: %f", fInset); |
| 391 str->append(")"); | 392 str->append(")"); |
| 392 } | 393 } |
| 393 #endif | 394 #endif |
| OLD | NEW |