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

Side by Side Diff: include/core/SkShader.h

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
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 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 #ifndef SkShader_DEFINED 8 #ifndef SkShader_DEFINED
9 #define SkShader_DEFINED 9 #define SkShader_DEFINED
10 10
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 }; 185 };
186 186
187 /** 187 /**
188 * Create the actual object that does the shading. 188 * Create the actual object that does the shading.
189 * Size of storage must be >= contextSize. 189 * Size of storage must be >= contextSize.
190 */ 190 */
191 Context* createContext(const ContextRec&, void* storage) const; 191 Context* createContext(const ContextRec&, void* storage) const;
192 192
193 /** 193 /**
194 * Return the size of a Context returned by createContext. 194 * Return the size of a Context returned by createContext.
195 *
196 * Override this if your subclass overrides createContext, to return the co rrect size of
197 * your subclass' context.
198 */ 195 */
199 virtual size_t contextSize(const ContextRec&) const; 196 size_t contextSize(const ContextRec&) const;
200 197
201 /** 198 /**
202 * Returns true if this shader is just a bitmap, and if not null, returns t he bitmap, 199 * Returns true if this shader is just a bitmap, and if not null, returns t he bitmap,
203 * localMatrix, and tilemodes. If this is not a bitmap, returns false and i gnores the 200 * localMatrix, and tilemodes. If this is not a bitmap, returns false and i gnores the
204 * out-parameters. 201 * out-parameters.
205 */ 202 */
206 bool isABitmap(SkBitmap* outTexture, SkMatrix* outMatrix, TileMode xy[2]) co nst { 203 bool isABitmap(SkBitmap* outTexture, SkMatrix* outMatrix, TileMode xy[2]) co nst {
207 return this->onIsABitmap(outTexture, outMatrix, xy); 204 return this->onIsABitmap(outTexture, outMatrix, xy);
208 } 205 }
209 206
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 void flatten(SkWriteBuffer&) const override; 410 void flatten(SkWriteBuffer&) const override;
414 411
415 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; 412 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const;
416 413
417 /** 414 /**
418 * Your subclass must also override contextSize() if it overrides onCreateC ontext(). 415 * Your subclass must also override contextSize() if it overrides onCreateC ontext().
419 * Base class impl returns NULL. 416 * Base class impl returns NULL.
420 */ 417 */
421 virtual Context* onCreateContext(const ContextRec&, void* storage) const; 418 virtual Context* onCreateContext(const ContextRec&, void* storage) const;
422 419
420 /**
421 * Override this if your subclass overrides createContext, to return the co rrect size of
422 * your subclass' context.
423 */
424 virtual size_t onContextSize(const ContextRec&) const;
425
423 virtual bool onAsLuminanceColor(SkColor*) const { 426 virtual bool onAsLuminanceColor(SkColor*) const {
424 return false; 427 return false;
425 } 428 }
426 429
427 virtual bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode[2]) const { 430 virtual bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode[2]) const {
428 return false; 431 return false;
429 } 432 }
430 433
431 private: 434 private:
432 // This is essentially const, but not officially so it can be modified in 435 // This is essentially const, but not officially so it can be modified in
433 // constructors. 436 // constructors.
434 SkMatrix fLocalMatrix; 437 SkMatrix fLocalMatrix;
435 438
436 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con structor. 439 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con structor.
437 friend class SkLocalMatrixShader; 440 friend class SkLocalMatrixShader;
438 friend class SkBitmapProcShader; // for computeTotalInverse() 441 friend class SkBitmapProcShader; // for computeTotalInverse()
439 442
440 typedef SkFlattenable INHERITED; 443 typedef SkFlattenable INHERITED;
441 }; 444 };
442 445
443 #endif 446 #endif
OLDNEW
« no previous file with comments | « experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp ('k') | include/effects/SkPerlinNoiseShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698