Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: src/effects/SkMagnifierImageFilter.cpp

Issue 26937006: Make SkImageFilter::asNewEffect() (and all derived-class overrides) protected. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkLightingImageFilter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkMagnifierImageFilter.cpp
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index e3d6efd4372e5d74a945bc61a6ef36341c6805b3..bef1e8da8121d7a0c40bf617d77b04e72e823005 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -184,6 +184,7 @@ GrEffectRef* GrMagnifierEffect::TestCreate(SkRandom* random,
GrContext* context,
const GrDrawTargetCaps&,
GrTexture** textures) {
+ GrTexture* texture = textures[0];
const int kMaxWidth = 200;
const int kMaxHeight = 200;
const int kMaxInset = 20;
@@ -191,15 +192,16 @@ GrEffectRef* GrMagnifierEffect::TestCreate(SkRandom* random,
uint32_t height = random->nextULessThan(kMaxHeight);
uint32_t x = random->nextULessThan(kMaxWidth - width);
uint32_t y = random->nextULessThan(kMaxHeight - height);
- SkScalar inset = SkIntToScalar(random->nextULessThan(kMaxInset));
-
- SkAutoTUnref<SkMagnifierImageFilter> filter(
- new SkMagnifierImageFilter(
- SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(y),
- SkIntToScalar(width), SkIntToScalar(height)),
- inset));
- GrEffectRef* effect;
- filter->asNewEffect(&effect, textures[0], SkMatrix::I());
+ uint32_t inset = random->nextULessThan(kMaxInset);
+
+ GrEffectRef* effect = GrMagnifierEffect::Create(
+ texture,
+ (float) width / texture->width(),
+ (float) height / texture->height(),
+ texture->width() / (float) x,
+ texture->height() / (float) y,
+ (float) inset / texture->width(),
+ (float) inset / texture->height());
SkASSERT(NULL != effect);
return effect;
}
« no previous file with comments | « src/effects/SkLightingImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698