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

Side by Side Diff: src/effects/SkMagnifierImageFilter.cpp

Issue 1213623022: fix up test create functions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « src/effects/SkLightingImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 GrProcessorKeyBuilder* b) const { 200 GrProcessorKeyBuilder* b) const {
201 GrGLMagnifierEffect::GenKey(*this, caps, b); 201 GrGLMagnifierEffect::GenKey(*this, caps, b);
202 } 202 }
203 203
204 GrGLFragmentProcessor* GrMagnifierEffect::createGLInstance() const { 204 GrGLFragmentProcessor* GrMagnifierEffect::createGLInstance() const {
205 return SkNEW_ARGS(GrGLMagnifierEffect, (*this)); 205 return SkNEW_ARGS(GrGLMagnifierEffect, (*this));
206 } 206 }
207 207
208 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMagnifierEffect); 208 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMagnifierEffect);
209 209
210 GrFragmentProcessor* GrMagnifierEffect::TestCreate(SkRandom* random, 210 GrFragmentProcessor* GrMagnifierEffect::TestCreate(GrProcessorTestData* d) {
211 GrContext* context, 211 GrTexture* texture = d->fTextures[0];
212 const GrCaps&,
213 GrTexture** textures) {
214 GrTexture* texture = textures[0];
215 const int kMaxWidth = 200; 212 const int kMaxWidth = 200;
216 const int kMaxHeight = 200; 213 const int kMaxHeight = 200;
217 const int kMaxInset = 20; 214 const int kMaxInset = 20;
218 uint32_t width = random->nextULessThan(kMaxWidth); 215 uint32_t width = d->fRandom->nextULessThan(kMaxWidth);
219 uint32_t height = random->nextULessThan(kMaxHeight); 216 uint32_t height = d->fRandom->nextULessThan(kMaxHeight);
220 uint32_t x = random->nextULessThan(kMaxWidth - width); 217 uint32_t x = d->fRandom->nextULessThan(kMaxWidth - width);
221 uint32_t y = random->nextULessThan(kMaxHeight - height); 218 uint32_t y = d->fRandom->nextULessThan(kMaxHeight - height);
222 uint32_t inset = random->nextULessThan(kMaxInset); 219 uint32_t inset = d->fRandom->nextULessThan(kMaxInset);
223 220
224 GrFragmentProcessor* effect = GrMagnifierEffect::Create( 221 GrFragmentProcessor* effect = GrMagnifierEffect::Create(
225 texture, 222 texture,
226 SkRect::MakeWH(SkIntToScalar(kMaxWidth), SkIntToScalar(kMaxHeight)), 223 SkRect::MakeWH(SkIntToScalar(kMaxWidth), SkIntToScalar(kMaxHeight)),
227 (float) width / texture->width(), 224 (float) width / texture->width(),
228 (float) height / texture->height(), 225 (float) height / texture->height(),
229 texture->width() / (float) x, 226 texture->width() / (float) x,
230 texture->height() / (float) y, 227 texture->height() / (float) y,
231 (float) inset / texture->width(), 228 (float) inset / texture->width(),
232 (float) inset / texture->height()); 229 (float) inset / texture->height());
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 382
386 #ifndef SK_IGNORE_TO_STRING 383 #ifndef SK_IGNORE_TO_STRING
387 void SkMagnifierImageFilter::toString(SkString* str) const { 384 void SkMagnifierImageFilter::toString(SkString* str) const {
388 str->appendf("SkMagnifierImageFilter: ("); 385 str->appendf("SkMagnifierImageFilter: (");
389 str->appendf("src: (%f,%f,%f,%f) ", 386 str->appendf("src: (%f,%f,%f,%f) ",
390 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m); 387 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m);
391 str->appendf("inset: %f", fInset); 388 str->appendf("inset: %f", fInset);
392 str->append(")"); 389 str->append(")");
393 } 390 }
394 #endif 391 #endif
OLDNEW
« no previous file with comments | « src/effects/SkLightingImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698