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

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

Issue 261773005: Remove SkShader virtual method validContext (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: correctly call shaderA/B in composeshader Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkShader.cpp ('k') | src/effects/SkTransparentShader.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 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 418
419 U8CPU rgba[4]; 419 U8CPU rgba[4];
420 for (int channel = 3; channel >= 0; --channel) { 420 for (int channel = 3; channel >= 0; --channel) {
421 rgba[channel] = SkScalarFloorToInt(255 * 421 rgba[channel] = SkScalarFloorToInt(255 *
422 calculateTurbulenceValueForPoint(channel, *perlinNoiseShader.fPainti ngData, 422 calculateTurbulenceValueForPoint(channel, *perlinNoiseShader.fPainti ngData,
423 stitchData, newPoint)); 423 stitchData, newPoint));
424 } 424 }
425 return SkPreMultiplyARGB(rgba[3], rgba[0], rgba[1], rgba[2]); 425 return SkPreMultiplyARGB(rgba[3], rgba[0], rgba[1], rgba[2]);
426 } 426 }
427 427
428 SkShader::Context* SkPerlinNoiseShader::createContext(const ContextRec& rec, voi d* storage) const { 428 SkShader::Context* SkPerlinNoiseShader::onCreateContext(const ContextRec& rec,
429 if (!this->validContext(rec)) { 429 void* storage) const {
430 return NULL;
431 }
432
433 return SkNEW_PLACEMENT_ARGS(storage, PerlinNoiseShaderContext, (*this, rec)) ; 430 return SkNEW_PLACEMENT_ARGS(storage, PerlinNoiseShaderContext, (*this, rec)) ;
434 } 431 }
435 432
436 size_t SkPerlinNoiseShader::contextSize() const { 433 size_t SkPerlinNoiseShader::contextSize() const {
437 return sizeof(PerlinNoiseShaderContext); 434 return sizeof(PerlinNoiseShaderContext);
438 } 435 }
439 436
440 SkPerlinNoiseShader::PerlinNoiseShaderContext::PerlinNoiseShaderContext( 437 SkPerlinNoiseShader::PerlinNoiseShaderContext::PerlinNoiseShaderContext(
441 const SkPerlinNoiseShader& shader, const ContextRec& rec) 438 const SkPerlinNoiseShader& shader, const ContextRec& rec)
442 : INHERITED(shader, rec) 439 : INHERITED(shader, rec)
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 str->append(" seed: "); 1360 str->append(" seed: ");
1364 str->appendScalar(fSeed); 1361 str->appendScalar(fSeed);
1365 str->append(" stitch tiles: "); 1362 str->append(" stitch tiles: ");
1366 str->append(fStitchTiles ? "true " : "false "); 1363 str->append(fStitchTiles ? "true " : "false ");
1367 1364
1368 this->INHERITED::toString(str); 1365 this->INHERITED::toString(str);
1369 1366
1370 str->append(")"); 1367 str->append(")");
1371 } 1368 }
1372 #endif 1369 #endif
OLDNEW
« no previous file with comments | « src/core/SkShader.cpp ('k') | src/effects/SkTransparentShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698