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