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

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: update dox, keep contextSize() defaulting to 0 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') | src/core/SkShader.cpp » ('J')
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 * Your subclass must also override contextSize() if it overrides createCon text().
211 *
212 * Base class implementation returns NULL.
210 */ 213 */
211 virtual Context* createContext(const SkBitmap& device, 214 virtual Context* createContext(const SkBitmap& device,
212 const SkPaint& paint, 215 const SkPaint& paint,
213 const SkMatrix& matrix, 216 const SkMatrix& matrix,
214 void* storage) const = 0; 217 void* storage) const;
215 218
216 /** 219 /**
217 * Return the size of a Context returned by createContext. 220 * Return the size of a Context returned by createContext.
221 *
222 * Override this if your subclass overrides createContext, to return the co rrect size of
223 * your subclass' context.
218 */ 224 */
219 virtual size_t contextSize() const = 0; 225 virtual size_t contextSize() const;
220 226
221 /** 227 /**
222 * Helper to check the flags to know if it is legal to call shadeSpan16() 228 * Helper to check the flags to know if it is legal to call shadeSpan16()
223 */ 229 */
224 static bool CanCallShadeSpan16(uint32_t flags) { 230 static bool CanCallShadeSpan16(uint32_t flags) {
225 return (flags & kHasSpan16_Flag) != 0; 231 return (flags & kHasSpan16_Flag) != 0;
226 } 232 }
227 233
228 /** 234 /**
229 Gives method bitmap should be read to implement a shader. 235 Gives method bitmap should be read to implement a shader.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 402
397 private: 403 private:
398 SkMatrix fLocalMatrix; 404 SkMatrix fLocalMatrix;
399 405
400 bool computeTotalInverse(const SkMatrix& matrix, SkMatrix* totalInverse) con st; 406 bool computeTotalInverse(const SkMatrix& matrix, SkMatrix* totalInverse) con st;
401 407
402 typedef SkFlattenable INHERITED; 408 typedef SkFlattenable INHERITED;
403 }; 409 };
404 410
405 #endif 411 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkShader.cpp » ('j') | src/core/SkShader.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698