blob: 60ef280d5ec37f8038fdec42b8820b5c3530bda5 [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * Copyright 2006 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00003 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00004 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00006 */
7
8#ifndef SkShader_DEFINED
9#define SkShader_DEFINED
10
11#include "SkBitmap.h"
12#include "SkFlattenable.h"
13#include "SkMask.h"
14#include "SkMatrix.h"
15#include "SkPaint.h"
bsalomon4beef912014-07-28 13:43:02 -070016#include "../gpu/GrColor.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000017
reed3061af42016-01-07 15:47:29 -080018class SkColorFilter;
reed@android.com8a1c16f2008-12-17 15:59:43 +000019class SkPath;
commit-bot@chromium.orgc5d9bb02014-04-08 15:19:34 +000020class SkPicture;
commit-bot@chromium.org79590552014-05-13 18:14:45 +000021class SkXfermode;
rileya@google.com03c1c352012-07-20 20:02:43 +000022class GrContext;
joshualittb0a8a372014-09-23 09:50:21 -070023class GrFragmentProcessor;
reed@android.com8a1c16f2008-12-17 15:59:43 +000024
25/** \class SkShader
reed@google.comad917992011-04-11 19:01:12 +000026 *
reed@google.com880dc472012-05-11 14:47:03 +000027 * Shaders specify the source color(s) for what is being drawn. If a paint
28 * has no shader, then the paint's color is used. If the paint has a
29 * shader, then the shader's color(s) are use instead, but they are
30 * modulated by the paint's alpha. This makes it easy to create a shader
31 * once (e.g. bitmap tiling or gradient) and then change its transparency
32 * w/o having to modify the original shader... only the paint's alpha needs
33 * to be modified.
reed@google.comad917992011-04-11 19:01:12 +000034 */
ctguil@chromium.org7ffb1b22011-03-15 21:27:08 +000035class SK_API SkShader : public SkFlattenable {
reed@android.com8a1c16f2008-12-17 15:59:43 +000036public:
commit-bot@chromium.org9c9005a2014-04-28 14:55:39 +000037 SkShader(const SkMatrix* localMatrix = NULL);
reed@android.com8a1c16f2008-12-17 15:59:43 +000038 virtual ~SkShader();
39
reed@google.comad917992011-04-11 19:01:12 +000040 /**
commit-bot@chromium.orgd12de022014-05-09 15:42:07 +000041 * Returns the local matrix.
scroggoc870d492014-07-11 10:42:12 -070042 *
43 * FIXME: This can be incorrect for a Shader with its own local matrix
44 * that is also wrapped via CreateLocalMatrixShader.
commit-bot@chromium.orgd12de022014-05-09 15:42:07 +000045 */
46 const SkMatrix& getLocalMatrix() const { return fLocalMatrix; }
47
reed@android.com8a1c16f2008-12-17 15:59:43 +000048 enum TileMode {
reed@google.com0beaba52012-03-16 14:38:06 +000049 /** replicate the edge color if the shader draws outside of its
50 * original bounds
51 */
52 kClamp_TileMode,
53
54 /** repeat the shader's image horizontally and vertically */
55 kRepeat_TileMode,
56
57 /** repeat the shader's image horizontally and vertically, alternating
58 * mirror images so that adjacent images always seam
59 */
60 kMirror_TileMode,
61
62#if 0
63 /** only draw within the original domain, return 0 everywhere else */
64 kDecal_TileMode,
65#endif
reed19c25f12015-03-15 14:01:21 -070066 };
reed@android.com8a1c16f2008-12-17 15:59:43 +000067
reed19c25f12015-03-15 14:01:21 -070068 enum {
69 kTileModeCount = kMirror_TileMode + 1
reed@android.com8a1c16f2008-12-17 15:59:43 +000070 };
71
72 // override these in your subclass
73
74 enum Flags {
75 //!< set if all of the colors will be opaque
reed4e5a7582016-01-05 05:10:33 -080076 kOpaqueAlpha_Flag = 1 << 0,
reed@android.com5119bdb2009-06-12 21:27:03 +000077
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000078 /** set if the spans only vary in X (const in Y).
reed@android.com5119bdb2009-06-12 21:27:03 +000079 e.g. an Nx1 bitmap that is being tiled in Y, or a linear-gradient
reed@android.com3c9b2a42009-08-27 19:28:37 +000080 that varies from left-to-right. This flag specifies this for
81 shadeSpan().
reed@android.com5119bdb2009-06-12 21:27:03 +000082 */
reed4e5a7582016-01-05 05:10:33 -080083 kConstInY32_Flag = 1 << 1,
reed@android.com8a1c16f2008-12-17 15:59:43 +000084 };
85
reed@google.comad917992011-04-11 19:01:12 +000086 /**
junov@chromium.orgb6e16192011-12-09 15:48:03 +000087 * Returns true if the shader is guaranteed to produce only opaque
88 * colors, subject to the SkPaint using the shader to apply an opaque
89 * alpha value. Subclasses should override this to allow some
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000090 * optimizations.
junov@chromium.orgb6e16192011-12-09 15:48:03 +000091 */
92 virtual bool isOpaque() const { return false; }
93
commit-bot@chromium.orge901b6d2014-05-01 19:31:31 +000094 /**
95 * ContextRec acts as a parameter bundle for creating Contexts.
96 */
97 struct ContextRec {
reed56263c72015-06-05 11:31:26 -070098 ContextRec(const SkPaint& paint, const SkMatrix& matrix, const SkMatrix* localM)
99 : fPaint(&paint)
commit-bot@chromium.org80116dc2014-05-06 17:16:03 +0000100 , fMatrix(&matrix)
reed56263c72015-06-05 11:31:26 -0700101 , fLocalMatrix(localM) {}
commit-bot@chromium.orge901b6d2014-05-01 19:31:31 +0000102
commit-bot@chromium.org80116dc2014-05-06 17:16:03 +0000103 const SkPaint* fPaint; // the current paint associated with the draw
104 const SkMatrix* fMatrix; // the current matrix in the canvas
105 const SkMatrix* fLocalMatrix; // optional local matrix
commit-bot@chromium.orge901b6d2014-05-01 19:31:31 +0000106 };
107
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000108 class Context : public ::SkNoncopyable {
109 public:
commit-bot@chromium.orge901b6d2014-05-01 19:31:31 +0000110 Context(const SkShader& shader, const ContextRec&);
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000111
112 virtual ~Context();
113
114 /**
115 * Called sometimes before drawing with this shader. Return the type of
116 * alpha your shader will return. The default implementation returns 0.
117 * Your subclass should override if it can (even sometimes) report a
118 * non-zero value, since that will enable various blitters to perform
119 * faster.
120 */
121 virtual uint32_t getFlags() const { return 0; }
122
123 /**
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000124 * Called for each span of the object being drawn. Your subclass should
125 * set the appropriate colors (with premultiplied alpha) that correspond
126 * to the specified device coordinates.
127 */
128 virtual void shadeSpan(int x, int y, SkPMColor[], int count) = 0;
129
herbc7a784c2015-12-18 09:52:15 -0800130 /**
131 * The const void* ctx is only const because all the implementations are const.
132 * This can be changed to non-const if a new shade proc needs to change the ctx.
133 */
134 typedef void (*ShadeProc)(const void* ctx, int x, int y, SkPMColor[], int count);
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000135 virtual ShadeProc asAShadeProc(void** ctx);
136
137 /**
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000138 * Similar to shadeSpan, but only returns the alpha-channel for a span.
139 * The default implementation calls shadeSpan() and then extracts the alpha
140 * values from the returned colors.
141 */
142 virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count);
143
reedcc0e3112014-09-10 10:20:24 -0700144 // Notification from blitter::blitMask in case we need to see the non-alpha channels
145 virtual void set3DMask(const SkMask*) {}
146
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000147 protected:
148 // Reference to shader, so we don't have to dupe information.
149 const SkShader& fShader;
150
151 enum MatrixClass {
152 kLinear_MatrixClass, // no perspective
153 kFixedStepInX_MatrixClass, // fast perspective, need to call fixedStepInX() each
154 // scanline
155 kPerspective_MatrixClass // slow perspective, need to mappoints each pixel
156 };
157 static MatrixClass ComputeMatrixClass(const SkMatrix&);
158
commit-bot@chromium.org80116dc2014-05-06 17:16:03 +0000159 uint8_t getPaintAlpha() const { return fPaintAlpha; }
160 const SkMatrix& getTotalInverse() const { return fTotalInverse; }
161 MatrixClass getInverseClass() const { return (MatrixClass)fTotalInverseClass; }
162 const SkMatrix& getCTM() const { return fCTM; }
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000163 private:
commit-bot@chromium.org80116dc2014-05-06 17:16:03 +0000164 SkMatrix fCTM;
165 SkMatrix fTotalInverse;
166 uint8_t fPaintAlpha;
167 uint8_t fTotalInverseClass;
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000168
169 typedef SkNoncopyable INHERITED;
170 };
reed@google.com7c2f27d2011-03-07 19:29:00 +0000171
reed@google.comad917992011-04-11 19:01:12 +0000172 /**
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000173 * Create the actual object that does the shading.
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000174 * Size of storage must be >= contextSize.
reed@google.coma641f3f2012-12-13 22:16:30 +0000175 */
commit-bot@chromium.orgce56d962014-05-05 18:39:18 +0000176 Context* createContext(const ContextRec&, void* storage) const;
reed@google.coma641f3f2012-12-13 22:16:30 +0000177
178 /**
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000179 * Return the size of a Context returned by createContext.
commit-bot@chromium.orgf3e50592014-04-30 23:29:02 +0000180 *
181 * Override this if your subclass overrides createContext, to return the correct size of
182 * your subclass' context.
reed@google.comad917992011-04-11 19:01:12 +0000183 */
commit-bot@chromium.orgf3e50592014-04-30 23:29:02 +0000184 virtual size_t contextSize() const;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000185
reed@google.comad917992011-04-11 19:01:12 +0000186 /**
reed0f0af232015-09-08 11:02:04 -0700187 * Returns true if this shader is just a bitmap, and if not null, returns the bitmap,
188 * localMatrix, and tilemodes. If this is not a bitmap, returns false and ignores the
189 * out-parameters.
reed@android.comf2b98d62010-12-20 18:26:13 +0000190 */
reed0f0af232015-09-08 11:02:04 -0700191 bool isABitmap(SkBitmap* outTexture, SkMatrix* outMatrix, TileMode xy[2]) const {
192 return this->onIsABitmap(outTexture, outMatrix, xy);
scroggoff390c92015-09-08 06:24:08 -0700193 }
reed0f0af232015-09-08 11:02:04 -0700194
reedf5822822015-08-19 11:46:38 -0700195 bool isABitmap() const {
196 return this->isABitmap(nullptr, nullptr, nullptr);
197 }
198
vandebo@chromium.orgd3ae7792011-02-24 00:21:06 +0000199 /**
200 * If the shader subclass can be represented as a gradient, asAGradient
201 * returns the matching GradientType enum (or kNone_GradientType if it
202 * cannot). Also, if info is not null, asAGradient populates info with
203 * the relevant (see below) parameters for the gradient. fColorCount
204 * is both an input and output parameter. On input, it indicates how
205 * many entries in fColors and fColorOffsets can be used, if they are
206 * non-NULL. After asAGradient has run, fColorCount indicates how
207 * many color-offset pairs there are in the gradient. If there is
208 * insufficient space to store all of the color-offset pairs, fColors
209 * and fColorOffsets will not be altered. fColorOffsets specifies
210 * where on the range of 0 to 1 to transition to the given color.
211 * The meaning of fPoint and fRadius is dependant on the type of gradient.
212 *
213 * None:
214 * info is ignored.
215 * Color:
216 * fColorOffsets[0] is meaningless.
217 * Linear:
218 * fPoint[0] and fPoint[1] are the end-points of the gradient
219 * Radial:
220 * fPoint[0] and fRadius[0] are the center and radius
reed71a6cbf2015-05-04 08:32:51 -0700221 * Conical:
vandebo@chromium.orgd3ae7792011-02-24 00:21:06 +0000222 * fPoint[0] and fRadius[0] are the center and radius of the 1st circle
223 * fPoint[1] and fRadius[1] are the center and radius of the 2nd circle
224 * Sweep:
225 * fPoint[0] is the center of the sweep.
226 */
227
228 enum GradientType {
229 kNone_GradientType,
230 kColor_GradientType,
231 kLinear_GradientType,
232 kRadial_GradientType,
vandebo@chromium.orgd3ae7792011-02-24 00:21:06 +0000233 kSweep_GradientType,
reed@google.com83226972012-06-07 20:26:47 +0000234 kConical_GradientType,
235 kLast_GradientType = kConical_GradientType
vandebo@chromium.orgd3ae7792011-02-24 00:21:06 +0000236 };
237
238 struct GradientInfo {
239 int fColorCount; //!< In-out parameter, specifies passed size
240 // of fColors/fColorOffsets on input, and
241 // actual number of colors/offsets on
242 // output.
243 SkColor* fColors; //!< The colors in the gradient.
244 SkScalar* fColorOffsets; //!< The unit offset for color transitions.
245 SkPoint fPoint[2]; //!< Type specific, see above.
246 SkScalar fRadius[2]; //!< Type specific, see above.
247 TileMode fTileMode; //!< The tile mode used.
reed@google.com3d3a8602013-05-24 14:58:44 +0000248 uint32_t fGradientFlags; //!< see SkGradientShader::Flags
vandebo@chromium.orgd3ae7792011-02-24 00:21:06 +0000249 };
250
251 virtual GradientType asAGradient(GradientInfo* info) const;
252
rileya@google.com03c1c352012-07-20 20:02:43 +0000253 /**
commit-bot@chromium.org79590552014-05-13 18:14:45 +0000254 * If the shader subclass is composed of two shaders, return true, and if rec is not NULL,
255 * fill it out with info about the shader.
commit-bot@chromium.org30558792014-05-14 14:28:34 +0000256 *
257 * These are bare pointers; the ownership and reference count are unchanged.
commit-bot@chromium.org79590552014-05-13 18:14:45 +0000258 */
259
260 struct ComposeRec {
261 const SkShader* fShaderA;
262 const SkShader* fShaderB;
263 const SkXfermode* fMode;
264 };
265
djsollenc87dd2c2014-11-14 11:11:46 -0800266 virtual bool asACompose(ComposeRec*) const { return false; }
commit-bot@chromium.org79590552014-05-13 18:14:45 +0000267
268
269 /**
bsalomonc21b09e2015-08-28 18:46:56 -0700270 * Returns a GrFragmentProcessor that implements the shader for the GPU backend. NULL is
271 * returned if there is no GPU implementation.
bsalomon83d081a2014-07-08 09:56:10 -0700272 *
bsalomonc21b09e2015-08-28 18:46:56 -0700273 * The GPU device does not call SkShader::createContext(), instead we pass the view matrix,
274 * local matrix, and filter quality directly.
bsalomon83d081a2014-07-08 09:56:10 -0700275 *
bsalomonc21b09e2015-08-28 18:46:56 -0700276 * The GrContext may be used by the to create textures that are required by the returned
277 * processor.
bsalomonf1b7a1d2015-09-28 06:26:28 -0700278 *
279 * The returned GrFragmentProcessor should expect an unpremultiplied input color and
280 * produce a premultiplied output.
rileya@google.com03c1c352012-07-20 20:02:43 +0000281 */
bsalomonc21b09e2015-08-28 18:46:56 -0700282 virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*,
283 const SkMatrix& viewMatrix,
284 const SkMatrix* localMatrix,
bsalomon4a339522015-10-06 08:40:50 -0700285 SkFilterQuality) const;
rileya@google.com03c1c352012-07-20 20:02:43 +0000286
reed8367b8c2014-08-22 08:30:20 -0700287 /**
288 * If the shader can represent its "average" luminance in a single color, return true and
289 * if color is not NULL, return that color. If it cannot, return false and ignore the color
290 * parameter.
291 *
292 * Note: if this returns true, the returned color will always be opaque, as only the RGB
293 * components are used to compute luminance.
294 */
295 bool asLuminanceColor(SkColor*) const;
296
commit-bot@chromium.org79590552014-05-13 18:14:45 +0000297#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
298 /**
299 * If the shader is a custom shader which has data the caller might want, call this function
300 * to get that data.
301 */
scroggo01c412e2014-11-24 09:05:35 -0800302 virtual bool asACustomShader(void** /* customData */) const { return false; }
commit-bot@chromium.org79590552014-05-13 18:14:45 +0000303#endif
304
reed@android.com8a1c16f2008-12-17 15:59:43 +0000305 //////////////////////////////////////////////////////////////////////////
reedf880e452015-12-30 13:39:41 -0800306 // Methods to create combinations or variants of shaders
reed@android.com8a1c16f2008-12-17 15:59:43 +0000307
commit-bot@chromium.orgce56d962014-05-05 18:39:18 +0000308 /**
reedf880e452015-12-30 13:39:41 -0800309 * Return a shader that will apply the specified localMatrix to this shader.
310 * The specified matrix will be applied before any matrix associated with this shader.
311 */
312 SkShader* newWithLocalMatrix(const SkMatrix&) const;
reed3061af42016-01-07 15:47:29 -0800313
314 /**
315 * Create a new shader that produces the same colors as invoking this shader and then applying
316 * the colorfilter.
317 */
318 SkShader* newWithColorFilter(SkColorFilter*) const;
reedf880e452015-12-30 13:39:41 -0800319
320 //////////////////////////////////////////////////////////////////////////
321 // Factory methods for stock shaders
322
323 /**
commit-bot@chromium.orgce56d962014-05-05 18:39:18 +0000324 * Call this to create a new "empty" shader, that will not draw anything.
325 */
326 static SkShader* CreateEmptyShader();
327
reed8367b8c2014-08-22 08:30:20 -0700328 /**
329 * Call this to create a new shader that just draws the specified color. This should always
330 * draw the same as a paint with this color (and no shader).
331 */
332 static SkShader* CreateColorShader(SkColor);
333
reed@android.com8a1c16f2008-12-17 15:59:43 +0000334 /** Call this to create a new shader that will draw with the specified bitmap.
reed@google.com99c114e2012-05-03 20:14:26 +0000335 *
336 * If the bitmap cannot be used (e.g. has no pixels, or its dimensions
337 * exceed implementation limits (currently at 64K - 1)) then SkEmptyShader
338 * may be returned.
339 *
commit-bot@chromium.org91246b92013-12-05 15:43:19 +0000340 * If the src is kA8_Config then that mask will be colorized using the color on
341 * the paint.
342 *
reed@google.com99c114e2012-05-03 20:14:26 +0000343 * @param src The bitmap to use inside the shader
344 * @param tmx The tiling mode to use when sampling the bitmap in the x-direction.
345 * @param tmy The tiling mode to use when sampling the bitmap in the y-direction.
346 * @return Returns a new shader object. Note: this function never returns null.
reed@android.com8a1c16f2008-12-17 15:59:43 +0000347 */
348 static SkShader* CreateBitmapShader(const SkBitmap& src,
commit-bot@chromium.org9c9005a2014-04-28 14:55:39 +0000349 TileMode tmx, TileMode tmy,
350 const SkMatrix* localMatrix = NULL);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000351
halcanarya5f46e12015-09-08 07:12:25 -0700352 // NOTE: You can create an SkImage Shader with SkImage::newShader().
353
commit-bot@chromium.orgc5d9bb02014-04-08 15:19:34 +0000354 /** Call this to create a new shader that will draw with the specified picture.
355 *
356 * @param src The picture to use inside the shader (if not NULL, its ref count
commit-bot@chromium.org855e88e2014-04-21 19:33:12 +0000357 * is incremented). The SkPicture must not be changed after
358 * successfully creating a picture shader.
commit-bot@chromium.orgc5d9bb02014-04-08 15:19:34 +0000359 * @param tmx The tiling mode to use when sampling the bitmap in the x-direction.
360 * @param tmy The tiling mode to use when sampling the bitmap in the y-direction.
fmalitab5f78262014-08-06 13:07:15 -0700361 * @param tile The tile rectangle in picture coordinates: this represents the subset
362 * (or superset) of the picture used when building a tile. It is not
363 * affected by localMatrix and does not imply scaling (only translation
364 * and cropping). If null, the tile rect is considered equal to the picture
365 * bounds.
commit-bot@chromium.orgc5d9bb02014-04-08 15:19:34 +0000366 * @return Returns a new shader object. Note: this function never returns null.
367 */
fmalita2be0fd82014-12-08 09:04:05 -0800368 static SkShader* CreatePictureShader(const SkPicture* src,
fmalitab5f78262014-08-06 13:07:15 -0700369 TileMode tmx, TileMode tmy,
370 const SkMatrix* localMatrix,
371 const SkRect* tile);
commit-bot@chromium.orgc5d9bb02014-04-08 15:19:34 +0000372
commit-bot@chromium.org8fae2132014-05-07 22:26:37 +0000373 /**
commit-bot@chromium.org8fae2132014-05-07 22:26:37 +0000374 * If this shader can be represented by another shader + a localMatrix, return that shader
375 * and, if not NULL, the localMatrix. If not, return NULL and ignore the localMatrix parameter.
376 *
377 * Note: the returned shader (if not NULL) will have been ref'd, and it is the responsibility
378 * of the caller to balance that with unref() when they are done.
379 */
380 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const;
381
robertphillips0a482f42015-01-26 07:00:04 -0800382 SK_TO_STRING_VIRT()
commit-bot@chromium.orgc0b7e102013-10-23 17:06:21 +0000383 SK_DEFINE_FLATTENABLE_TYPE(SkShader)
384
reed@android.com8a1c16f2008-12-17 15:59:43 +0000385protected:
mtklein36352bf2015-03-25 18:17:31 -0700386 void flatten(SkWriteBuffer&) const override;
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000387
commit-bot@chromium.orgce56d962014-05-05 18:39:18 +0000388 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const;
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +0000389
commit-bot@chromium.orgce56d962014-05-05 18:39:18 +0000390 /**
391 * Your subclass must also override contextSize() if it overrides onCreateContext().
392 * Base class impl returns NULL.
393 */
394 virtual Context* onCreateContext(const ContextRec&, void* storage) const;
395
reed8367b8c2014-08-22 08:30:20 -0700396 virtual bool onAsLuminanceColor(SkColor*) const {
397 return false;
398 }
reed0f0af232015-09-08 11:02:04 -0700399
400 virtual bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode[2]) const {
401 return false;
402 }
403
commit-bot@chromium.orgce56d962014-05-05 18:39:18 +0000404private:
scroggoef0fd612014-07-11 11:33:52 -0700405 // This is essentially const, but not officially so it can be modified in
406 // constructors.
commit-bot@chromium.orgce56d962014-05-05 18:39:18 +0000407 SkMatrix fLocalMatrix;
scroggoc870d492014-07-11 10:42:12 -0700408
409 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer constructor.
410 friend class SkLocalMatrixShader;
reed7a4d8472015-09-15 13:33:58 -0700411 friend class SkBitmapProcShader; // for computeTotalInverse()
scroggoc870d492014-07-11 10:42:12 -0700412
reed@android.com8a1c16f2008-12-17 15:59:43 +0000413 typedef SkFlattenable INHERITED;
414};
415
416#endif