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

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

Issue 262703002: add default impl for context methods on shader (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 | « no previous file | src/core/SkShader.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 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 8
9 #ifndef SkShader_DEFINED 9 #ifndef SkShader_DEFINED
10 #define SkShader_DEFINED 10 #define SkShader_DEFINED
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 * Subclasses should be sure to call their INHERITED::validContext() if 200 * Subclasses should be sure to call their INHERITED::validContext() if
201 * they override this method. 201 * they override this method.
202 */ 202 */
203 virtual bool validContext(const SkBitmap& device, const SkPaint& paint, 203 virtual bool validContext(const SkBitmap& device, const SkPaint& paint,
204 const SkMatrix& matrix, SkMatrix* totalInverse = N ULL) const; 204 const SkMatrix& matrix, SkMatrix* totalInverse = N ULL) const;
205 205
206 /** 206 /**
207 * Create the actual object that does the shading. 207 * Create the actual object that does the shading.
208 * Returns NULL if validContext() returns false. 208 * Returns NULL if validContext() returns false.
209 * Size of storage must be >= contextSize. 209 * Size of storage must be >= contextSize.
210 *
211 * Base class implementation returns NULL.
210 */ 212 */
211 virtual Context* createContext(const SkBitmap& device, 213 virtual Context* createContext(const SkBitmap& device,
212 const SkPaint& paint, 214 const SkPaint& paint,
213 const SkMatrix& matrix, 215 const SkMatrix& matrix,
214 void* storage) const = 0; 216 void* storage) const;
215 217
216 /** 218 /**
217 * Return the size of a Context returned by createContext. 219 * Return the size of a Context returned by createContext.
220 *
221 * Base class implementation returns 0.
scroggo 2014/04/30 18:52:02 Due to a requirement in SkSmallAllocator (which co
218 */ 222 */
219 virtual size_t contextSize() const = 0; 223 virtual size_t contextSize() const;
scroggo 2014/04/30 18:52:02 I like pure virtual function, because if someone w
220 224
221 /** 225 /**
222 * Helper to check the flags to know if it is legal to call shadeSpan16() 226 * Helper to check the flags to know if it is legal to call shadeSpan16()
223 */ 227 */
224 static bool CanCallShadeSpan16(uint32_t flags) { 228 static bool CanCallShadeSpan16(uint32_t flags) {
225 return (flags & kHasSpan16_Flag) != 0; 229 return (flags & kHasSpan16_Flag) != 0;
226 } 230 }
227 231
228 /** 232 /**
229 Gives method bitmap should be read to implement a shader. 233 Gives method bitmap should be read to implement a shader.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 400
397 private: 401 private:
398 SkMatrix fLocalMatrix; 402 SkMatrix fLocalMatrix;
399 403
400 bool computeTotalInverse(const SkMatrix& matrix, SkMatrix* totalInverse) con st; 404 bool computeTotalInverse(const SkMatrix& matrix, SkMatrix* totalInverse) con st;
401 405
402 typedef SkFlattenable INHERITED; 406 typedef SkFlattenable INHERITED;
403 }; 407 };
404 408
405 #endif 409 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698