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

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

Issue 2146413002: Add SkRasterPipeline blitter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Do not leak the blitter. Created 4 years, 5 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
« no previous file with comments | « include/core/SkColorFilter.h ('k') | src/core/SkBlitter.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 #ifndef SkXfermode_DEFINED 8 #ifndef SkXfermode_DEFINED
9 #define SkXfermode_DEFINED 9 #define SkXfermode_DEFINED
10 10
11 #include "SkFlattenable.h" 11 #include "SkFlattenable.h"
12 #include "SkColor.h" 12 #include "SkColor.h"
13 13
14 class GrFragmentProcessor; 14 class GrFragmentProcessor;
15 class GrTexture; 15 class GrTexture;
16 class GrXPFactory; 16 class GrXPFactory;
17 class SkRasterPipeline;
17 class SkString; 18 class SkString;
18 19
19 struct SkPM4f; 20 struct SkPM4f;
20 typedef SkPM4f (*SkXfermodeProc4f)(const SkPM4f& src, const SkPM4f& dst); 21 typedef SkPM4f (*SkXfermodeProc4f)(const SkPM4f& src, const SkPM4f& dst);
21 22
22 /** \class SkXfermode 23 /** \class SkXfermode
23 * 24 *
24 * SkXfermode is the base class for objects that are called to implement custom 25 * SkXfermode is the base class for objects that are called to implement custom
25 * "transfer-modes" in the drawing pipeline. The static function Create(Modes) 26 * "transfer-modes" in the drawing pipeline. The static function Create(Modes)
26 * can be called to return an instance of any of the predefined subclasses as 27 * can be called to return an instance of any of the predefined subclasses as
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 #endif 158 #endif
158 159
159 /** Return a function pointer to a routine that applies the specified 160 /** Return a function pointer to a routine that applies the specified
160 porter-duff transfer mode. 161 porter-duff transfer mode.
161 */ 162 */
162 static SkXfermodeProc GetProc(Mode mode); 163 static SkXfermodeProc GetProc(Mode mode);
163 static SkXfermodeProc4f GetProc4f(Mode); 164 static SkXfermodeProc4f GetProc4f(Mode);
164 165
165 virtual SkXfermodeProc4f getProc4f() const; 166 virtual SkXfermodeProc4f getProc4f() const;
166 167
168 bool appendStages(SkRasterPipeline*) const;
169
167 /** 170 /**
168 * If the specified mode can be represented by a pair of Coeff, then return 171 * If the specified mode can be represented by a pair of Coeff, then return
169 * true and set (if not NULL) the corresponding coeffs. If the mode is 172 * true and set (if not NULL) the corresponding coeffs. If the mode is
170 * not representable as a pair of Coeffs, return false and ignore the 173 * not representable as a pair of Coeffs, return false and ignore the
171 * src and dst parameters. 174 * src and dst parameters.
172 */ 175 */
173 static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst); 176 static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst);
174 177
175 /** 178 /**
176 * Returns whether or not the xfer mode can support treating coverage as alp ha 179 * Returns whether or not the xfer mode can support treating coverage as alp ha
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 * the xfermode is NULL, and if so, treats it as kSrcOver_Mode. 212 * the xfermode is NULL, and if so, treats it as kSrcOver_Mode.
210 */ 213 */
211 static bool IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType); 214 static bool IsOpaque(const SkXfermode* xfer, SrcColorOpacity opacityType);
212 static bool IsOpaque(const sk_sp<SkXfermode>& xfer, SrcColorOpacity opacityT ype) { 215 static bool IsOpaque(const sk_sp<SkXfermode>& xfer, SrcColorOpacity opacityT ype) {
213 return IsOpaque(xfer.get(), opacityType); 216 return IsOpaque(xfer.get(), opacityType);
214 } 217 }
215 218
216 #if SK_SUPPORT_GPU 219 #if SK_SUPPORT_GPU
217 /** Used by the SkXfermodeImageFilter to blend two colors via a GrFragmentPr ocessor. 220 /** Used by the SkXfermodeImageFilter to blend two colors via a GrFragmentPr ocessor.
218 The input to the returned FP is the src color. The dst color is 221 The input to the returned FP is the src color. The dst color is
219 provided by the dst param which becomes a child FP of the returned FP. 222 provided by the dst param which becomes a child FP of the returned FP.
220 It is legal for the function to return a null output. This indicates tha t 223 It is legal for the function to return a null output. This indicates tha t
221 the output of the blend is simply the src color. 224 the output of the blend is simply the src color.
222 */ 225 */
223 virtual sk_sp<GrFragmentProcessor> makeFragmentProcessorForImageFilter( 226 virtual sk_sp<GrFragmentProcessor> makeFragmentProcessorForImageFilter(
224 sk_sp<GrFragmentProc essor> dst) const; 227 sk_sp<GrFragmentProc essor> dst) const;
225 228
226 /** A subclass must implement this factory function to work with the GPU bac kend. 229 /** A subclass must implement this factory function to work with the GPU bac kend.
227 The xfermode will return a factory for which the caller will get a ref. It is up 230 The xfermode will return a factory for which the caller will get a ref. It is up
228 to the caller to install it. XferProcessors cannot use a background text ure. 231 to the caller to install it. XferProcessors cannot use a background text ure.
229 */ 232 */
230 virtual sk_sp<GrXPFactory> asXPFactory() const; 233 virtual sk_sp<GrXPFactory> asXPFactory() const;
231 #endif 234 #endif
232 235
233 SK_TO_STRING_PUREVIRT() 236 SK_TO_STRING_PUREVIRT()
234 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() 237 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
235 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) 238 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode)
236 239
237 enum D32Flags { 240 enum D32Flags {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 implementation of this method just returns dst. If performance is 277 implementation of this method just returns dst. If performance is
275 important, your subclass should override xfer32/xfer16/xferA8 directly. 278 important, your subclass should override xfer32/xfer16/xferA8 directly.
276 279
277 This method will not be called directly by the client, so it need not 280 This method will not be called directly by the client, so it need not
278 be implemented if your subclass has overridden xfer32/xfer16/xferA8 281 be implemented if your subclass has overridden xfer32/xfer16/xferA8
279 */ 282 */
280 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; 283 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const;
281 284
282 virtual D32Proc onGetD32Proc(uint32_t flags) const; 285 virtual D32Proc onGetD32Proc(uint32_t flags) const;
283 virtual F16Proc onGetF16Proc(uint32_t flags) const; 286 virtual F16Proc onGetF16Proc(uint32_t flags) const;
287 virtual bool onAppendStages(SkRasterPipeline*) const;
284 288
285 private: 289 private:
286 enum { 290 enum {
287 kModeCount = kLastMode + 1 291 kModeCount = kLastMode + 1
288 }; 292 };
289 293
290 typedef SkFlattenable INHERITED; 294 typedef SkFlattenable INHERITED;
291 }; 295 };
292 296
293 #endif 297 #endif
OLDNEW
« no previous file with comments | « include/core/SkColorFilter.h ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698