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

Side by Side Diff: src/core/SkCoreBlitters.h

Issue 249643002: Revert of Extract most of the mutable state of SkShader into a separate Context object. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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 | « src/core/SkComposeShader.cpp ('k') | src/core/SkDraw.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 SkCoreBlitters_DEFINED 8 #ifndef SkCoreBlitters_DEFINED
9 #define SkCoreBlitters_DEFINED 9 #define SkCoreBlitters_DEFINED
10 10
11 #include "SkBitmapProcShader.h" 11 #include "SkBitmapProcShader.h"
12 #include "SkBlitter.h" 12 #include "SkBlitter.h"
13 #include "SkBlitRow.h" 13 #include "SkBlitRow.h"
14 #include "SkShader.h" 14 #include "SkShader.h"
15 #include "SkSmallAllocator.h" 15 #include "SkSmallAllocator.h"
16 16
17 class SkRasterBlitter : public SkBlitter { 17 class SkRasterBlitter : public SkBlitter {
18 public: 18 public:
19 SkRasterBlitter(const SkBitmap& device) : fDevice(device) {} 19 SkRasterBlitter(const SkBitmap& device) : fDevice(device) {}
20 20
21 protected: 21 protected:
22 const SkBitmap& fDevice; 22 const SkBitmap& fDevice;
23 23
24 private: 24 private:
25 typedef SkBlitter INHERITED; 25 typedef SkBlitter INHERITED;
26 }; 26 };
27 27
28 class SkShaderBlitter : public SkRasterBlitter { 28 class SkShaderBlitter : public SkRasterBlitter {
29 public: 29 public:
30 /** 30 SkShaderBlitter(const SkBitmap& device, const SkPaint& paint);
31 * The storage for shaderContext is owned by the caller, but the object it self is not.
32 * The blitter only ensures that the storage always holds a live object, b ut it may
33 * exchange that object.
34 */
35 SkShaderBlitter(const SkBitmap& device, const SkPaint& paint,
36 SkShader::Context* shaderContext);
37 virtual ~SkShaderBlitter(); 31 virtual ~SkShaderBlitter();
38 32
39 /**
40 * Create a new shader context and uses it instead of the old one if succe ssful.
41 * Will create the context at the same location as the old one (this is sa fe
42 * because the shader itself is unchanged).
43 */
44 virtual bool resetShaderContext(const SkBitmap& device, const SkPaint& paint ,
45 const SkMatrix& matrix) SK_OVERRIDE;
46
47 virtual SkShader::Context* getShaderContext() const SK_OVERRIDE { return fSh aderContext; }
48
49 protected: 33 protected:
50 uint32_t fShaderFlags; 34 uint32_t fShaderFlags;
51 const SkShader* fShader; 35 SkShader* fShader;
52 SkShader::Context* fShaderContext;
53 36
54 private: 37 private:
55 // illegal 38 // illegal
56 SkShaderBlitter& operator=(const SkShaderBlitter&); 39 SkShaderBlitter& operator=(const SkShaderBlitter&);
57 40
58 typedef SkRasterBlitter INHERITED; 41 typedef SkRasterBlitter INHERITED;
59 }; 42 };
60 43
61 /////////////////////////////////////////////////////////////////////////////// 44 ///////////////////////////////////////////////////////////////////////////////
62 45
(...skipping 22 matching lines...) Expand all
85 unsigned fSrcA; 68 unsigned fSrcA;
86 69
87 // illegal 70 // illegal
88 SkA8_Blitter& operator=(const SkA8_Blitter&); 71 SkA8_Blitter& operator=(const SkA8_Blitter&);
89 72
90 typedef SkRasterBlitter INHERITED; 73 typedef SkRasterBlitter INHERITED;
91 }; 74 };
92 75
93 class SkA8_Shader_Blitter : public SkShaderBlitter { 76 class SkA8_Shader_Blitter : public SkShaderBlitter {
94 public: 77 public:
95 SkA8_Shader_Blitter(const SkBitmap& device, const SkPaint& paint, 78 SkA8_Shader_Blitter(const SkBitmap& device, const SkPaint& paint);
96 SkShader::Context* shaderContext);
97 virtual ~SkA8_Shader_Blitter(); 79 virtual ~SkA8_Shader_Blitter();
98 virtual void blitH(int x, int y, int width); 80 virtual void blitH(int x, int y, int width);
99 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_ t runs[]); 81 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_ t runs[]);
100 virtual void blitMask(const SkMask&, const SkIRect&); 82 virtual void blitMask(const SkMask&, const SkIRect&);
101 83
102 private: 84 private:
103 SkXfermode* fXfermode; 85 SkXfermode* fXfermode;
104 SkPMColor* fBuffer; 86 SkPMColor* fBuffer;
105 uint8_t* fAAExpand; 87 uint8_t* fAAExpand;
106 88
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 SkARGB32_Black_Blitter(const SkBitmap& device, const SkPaint& paint) 134 SkARGB32_Black_Blitter(const SkBitmap& device, const SkPaint& paint)
153 : INHERITED(device, paint) {} 135 : INHERITED(device, paint) {}
154 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_ t runs[]); 136 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_ t runs[]);
155 137
156 private: 138 private:
157 typedef SkARGB32_Opaque_Blitter INHERITED; 139 typedef SkARGB32_Opaque_Blitter INHERITED;
158 }; 140 };
159 141
160 class SkARGB32_Shader_Blitter : public SkShaderBlitter { 142 class SkARGB32_Shader_Blitter : public SkShaderBlitter {
161 public: 143 public:
162 SkARGB32_Shader_Blitter(const SkBitmap& device, const SkPaint& paint, 144 SkARGB32_Shader_Blitter(const SkBitmap& device, const SkPaint& paint);
163 SkShader::Context* shaderContext);
164 virtual ~SkARGB32_Shader_Blitter(); 145 virtual ~SkARGB32_Shader_Blitter();
165 virtual void blitH(int x, int y, int width) SK_OVERRIDE; 146 virtual void blitH(int x, int y, int width) SK_OVERRIDE;
166 virtual void blitV(int x, int y, int height, SkAlpha alpha) SK_OVERRIDE; 147 virtual void blitV(int x, int y, int height, SkAlpha alpha) SK_OVERRIDE;
167 virtual void blitRect(int x, int y, int width, int height) SK_OVERRIDE; 148 virtual void blitRect(int x, int y, int width, int height) SK_OVERRIDE;
168 virtual void blitAntiH(int x, int y, const SkAlpha[], const int16_t[]) SK_OV ERRIDE; 149 virtual void blitAntiH(int x, int y, const SkAlpha[], const int16_t[]) SK_OV ERRIDE;
169 virtual void blitMask(const SkMask&, const SkIRect&) SK_OVERRIDE; 150 virtual void blitMask(const SkMask&, const SkIRect&) SK_OVERRIDE;
170 151
171 private: 152 private:
172 SkXfermode* fXfermode; 153 SkXfermode* fXfermode;
173 SkPMColor* fBuffer; 154 SkPMColor* fBuffer;
(...skipping 17 matching lines...) Expand all
191 172
192 1. If there is an xfermode, there will also be a shader 173 1. If there is an xfermode, there will also be a shader
193 2. If there is a colorfilter, there will be a shader that itself handles 174 2. If there is a colorfilter, there will be a shader that itself handles
194 calling the filter, so the blitter can always ignore the colorfilter obj 175 calling the filter, so the blitter can always ignore the colorfilter obj
195 176
196 These pre-conditions must be handled by the caller, in our case 177 These pre-conditions must be handled by the caller, in our case
197 SkBlitter::Choose(...) 178 SkBlitter::Choose(...)
198 */ 179 */
199 180
200 SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device, const SkPaint& paint, 181 SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device, const SkPaint& paint,
201 SkShader::Context* shaderContext,
202 SkTBlitterAllocator* allocator); 182 SkTBlitterAllocator* allocator);
203 183
204 #endif 184 #endif
OLDNEW
« no previous file with comments | « src/core/SkComposeShader.cpp ('k') | src/core/SkDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698