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

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

Issue 1319723005: Fix leak in test create for perlin noise fp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 "SkDither.h" 8 #include "SkDither.h"
9 #include "SkPerlinNoiseShader.h" 9 #include "SkPerlinNoiseShader.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 int numOctaves = d->fRandom->nextRangeU(2, 10); 595 int numOctaves = d->fRandom->nextRangeU(2, 10);
596 bool stitchTiles = d->fRandom->nextBool(); 596 bool stitchTiles = d->fRandom->nextBool();
597 SkScalar seed = SkIntToScalar(d->fRandom->nextU()); 597 SkScalar seed = SkIntToScalar(d->fRandom->nextU());
598 SkISize tileSize = SkISize::Make(d->fRandom->nextRangeU(4, 4096), 598 SkISize tileSize = SkISize::Make(d->fRandom->nextRangeU(4, 4096),
599 d->fRandom->nextRangeU(4, 4096)); 599 d->fRandom->nextRangeU(4, 4096));
600 SkScalar baseFrequencyX = d->fRandom->nextRangeScalar(0.01f, 600 SkScalar baseFrequencyX = d->fRandom->nextRangeScalar(0.01f,
601 0.99f); 601 0.99f);
602 SkScalar baseFrequencyY = d->fRandom->nextRangeScalar(0.01f, 602 SkScalar baseFrequencyY = d->fRandom->nextRangeScalar(0.01f,
603 0.99f); 603 0.99f);
604 604
605 SkShader* shader = d->fRandom->nextBool() ? 605 SkAutoTUnref<SkShader> shader(d->fRandom->nextBool() ?
606 SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, seed, 606 SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, seed,
607 stitchTiles ? &tileSize : nullpt r) : 607 stitchTiles ? &tileSize : nullpt r) :
608 SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, nu mOctaves, seed, 608 SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, nu mOctaves, seed,
609 stitchTiles ? &tileSize : nullptr); 609 stitchTiles ? &tileSize : nullptr)) ;
610 610
611 GrPaint grPaint; 611 GrPaint grPaint;
612 return shader->asFragmentProcessor(d->fContext, 612 return shader->asFragmentProcessor(d->fContext,
613 GrTest::TestMatrix(d->fRandom), nullptr, 613 GrTest::TestMatrix(d->fRandom), nullptr,
614 kNone_SkFilterQuality, 614 kNone_SkFilterQuality,
615 grPaint.getProcessorDataManager()); 615 grPaint.getProcessorDataManager());
616 } 616 }
617 617
618 GrGLPerlinNoise::GrGLPerlinNoise(const GrProcessor& processor) 618 GrGLPerlinNoise::GrGLPerlinNoise(const GrProcessor& processor)
619 : fType(processor.cast<GrPerlinNoiseEffect>().type()) 619 : fType(processor.cast<GrPerlinNoiseEffect>().type())
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 str->append(" seed: "); 996 str->append(" seed: ");
997 str->appendScalar(fSeed); 997 str->appendScalar(fSeed);
998 str->append(" stitch tiles: "); 998 str->append(" stitch tiles: ");
999 str->append(fStitchTiles ? "true " : "false "); 999 str->append(fStitchTiles ? "true " : "false ");
1000 1000
1001 this->INHERITED::toString(str); 1001 this->INHERITED::toString(str);
1002 1002
1003 str->append(")"); 1003 str->append(")");
1004 } 1004 }
1005 #endif 1005 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698