OLD | NEW |
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 enum Flags { | 74 enum Flags { |
75 //!< set if all of the colors will be opaque | 75 //!< set if all of the colors will be opaque |
76 kOpaqueAlpha_Flag = 1 << 0, | 76 kOpaqueAlpha_Flag = 1 << 0, |
77 | 77 |
78 /** set if the spans only vary in X (const in Y). | 78 /** set if the spans only vary in X (const in Y). |
79 e.g. an Nx1 bitmap that is being tiled in Y, or a linear-gradient | 79 e.g. an Nx1 bitmap that is being tiled in Y, or a linear-gradient |
80 that varies from left-to-right. This flag specifies this for | 80 that varies from left-to-right. This flag specifies this for |
81 shadeSpan(). | 81 shadeSpan(). |
82 */ | 82 */ |
83 kConstInY32_Flag = 1 << 1, | 83 kConstInY32_Flag = 1 << 1, |
| 84 kSupports4f_Flag = 1 << 2, |
84 }; | 85 }; |
85 | 86 |
86 /** | 87 /** |
87 * Returns true if the shader is guaranteed to produce only opaque | 88 * 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 * colors, subject to the SkPaint using the shader to apply an opaque |
89 * alpha value. Subclasses should override this to allow some | 90 * alpha value. Subclasses should override this to allow some |
90 * optimizations. | 91 * optimizations. |
91 */ | 92 */ |
92 virtual bool isOpaque() const { return false; } | 93 virtual bool isOpaque() const { return false; } |
93 | 94 |
(...skipping 26 matching lines...) Expand all Loading... |
120 */ | 121 */ |
121 virtual uint32_t getFlags() const { return 0; } | 122 virtual uint32_t getFlags() const { return 0; } |
122 | 123 |
123 /** | 124 /** |
124 * Called for each span of the object being drawn. Your subclass should | 125 * Called for each span of the object being drawn. Your subclass should |
125 * set the appropriate colors (with premultiplied alpha) that correspon
d | 126 * set the appropriate colors (with premultiplied alpha) that correspon
d |
126 * to the specified device coordinates. | 127 * to the specified device coordinates. |
127 */ | 128 */ |
128 virtual void shadeSpan(int x, int y, SkPMColor[], int count) = 0; | 129 virtual void shadeSpan(int x, int y, SkPMColor[], int count) = 0; |
129 | 130 |
| 131 virtual void shadeSpan4f(int x, int y, SkPM4f[], int count); |
| 132 |
130 /** | 133 /** |
131 * The const void* ctx is only const because all the implementations are
const. | 134 * 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. | 135 * This can be changed to non-const if a new shade proc needs to change
the ctx. |
133 */ | 136 */ |
134 typedef void (*ShadeProc)(const void* ctx, int x, int y, SkPMColor[], in
t count); | 137 typedef void (*ShadeProc)(const void* ctx, int x, int y, SkPMColor[], in
t count); |
135 virtual ShadeProc asAShadeProc(void** ctx); | 138 virtual ShadeProc asAShadeProc(void** ctx); |
136 | 139 |
137 /** | 140 /** |
138 * Similar to shadeSpan, but only returns the alpha-channel for a span. | 141 * Similar to shadeSpan, but only returns the alpha-channel for a span. |
139 * The default implementation calls shadeSpan() and then extracts the a
lpha | 142 * The default implementation calls shadeSpan() and then extracts the a
lpha |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 SkMatrix fLocalMatrix; | 410 SkMatrix fLocalMatrix; |
408 | 411 |
409 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 412 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
410 friend class SkLocalMatrixShader; | 413 friend class SkLocalMatrixShader; |
411 friend class SkBitmapProcShader; // for computeTotalInverse() | 414 friend class SkBitmapProcShader; // for computeTotalInverse() |
412 | 415 |
413 typedef SkFlattenable INHERITED; | 416 typedef SkFlattenable INHERITED; |
414 }; | 417 }; |
415 | 418 |
416 #endif | 419 #endif |
OLD | NEW |