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

Side by Side Diff: experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp

Issue 1759653004: enforce 16byte alignment in shader contexts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.h ('k') | include/core/SkShader.h » ('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 "SkPerlinNoiseShader2.h" 9 #include "SkPerlinNoiseShader2.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 rgba[channel] = SkScalarFloorToInt(255 * value); 564 rgba[channel] = SkScalarFloorToInt(255 * value);
565 } 565 }
566 return SkPreMultiplyARGB(rgba[3], rgba[0], rgba[1], rgba[2]); 566 return SkPreMultiplyARGB(rgba[3], rgba[0], rgba[1], rgba[2]);
567 } 567 }
568 568
569 SkShader::Context* SkPerlinNoiseShader2::onCreateContext(const ContextRec& rec, 569 SkShader::Context* SkPerlinNoiseShader2::onCreateContext(const ContextRec& rec,
570 void* storage) const { 570 void* storage) const {
571 return new (storage) PerlinNoiseShaderContext(*this, rec); 571 return new (storage) PerlinNoiseShaderContext(*this, rec);
572 } 572 }
573 573
574 size_t SkPerlinNoiseShader2::contextSize(const ContextRec&) const { 574 size_t SkPerlinNoiseShader2::onContextSize(const ContextRec&) const {
575 return sizeof(PerlinNoiseShaderContext); 575 return SkAlign16(sizeof(PerlinNoiseShaderContext));
576 } 576 }
577 577
578 SkPerlinNoiseShader2::PerlinNoiseShaderContext::PerlinNoiseShaderContext( 578 SkPerlinNoiseShader2::PerlinNoiseShaderContext::PerlinNoiseShaderContext(
579 const SkPerlinNoiseShader2& shader, const ContextRec& rec) 579 const SkPerlinNoiseShader2& shader, const ContextRec& rec)
580 : INHERITED(shader, rec) 580 : INHERITED(shader, rec)
581 { 581 {
582 SkMatrix newMatrix = *rec.fMatrix; 582 SkMatrix newMatrix = *rec.fMatrix;
583 newMatrix.preConcat(shader.getLocalMatrix()); 583 newMatrix.preConcat(shader.getLocalMatrix());
584 if (rec.fLocalMatrix) { 584 if (rec.fLocalMatrix) {
585 newMatrix.preConcat(*rec.fLocalMatrix); 585 newMatrix.preConcat(*rec.fLocalMatrix);
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 str->append(" seed: "); 1393 str->append(" seed: ");
1394 str->appendScalar(fSeed); 1394 str->appendScalar(fSeed);
1395 str->append(" stitch tiles: "); 1395 str->append(" stitch tiles: ");
1396 str->append(fStitchTiles ? "true " : "false "); 1396 str->append(fStitchTiles ? "true " : "false ");
1397 1397
1398 this->INHERITED::toString(str); 1398 this->INHERITED::toString(str);
1399 1399
1400 str->append(")"); 1400 str->append(")");
1401 } 1401 }
1402 #endif 1402 #endif
OLDNEW
« no previous file with comments | « experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.h ('k') | include/core/SkShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698