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