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

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

Issue 2174793002: Revert of Redo Tiling (Closed) Base URL: https://skia.googlesource.com/skia.git@reduce-LBP-sample
Patch Set: 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 | « src/core/SkLinearBitmapPipeline.cpp ('k') | src/core/SkLinearBitmapPipeline_sample.h » ('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 2016 Google Inc. 2 * Copyright 2016 Google Inc.
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 SkLinearBitmapPipeline_core_DEFINED 8 #ifndef SkLinearBitmapPipeline_core_DEFINED
9 #define SkLinearBitmapPipeline_core_DEFINED 9 #define SkLinearBitmapPipeline_core_DEFINED
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 while (count >= 4) { 172 while (count >= 4) {
173 stage->pointList4(xs, ys); 173 stage->pointList4(xs, ys);
174 xs = xs + fourDx; 174 xs = xs + fourDx;
175 count -= 4; 175 count -= 4;
176 } 176 }
177 if (count > 0) { 177 if (count > 0) {
178 stage->pointListFew(count, xs, ys); 178 stage->pointListFew(count, xs, ys);
179 } 179 }
180 } 180 }
181
182 inline Sk4f check_pixel(Sk4f& pixel) {
183 SkASSERTF(0.0f <= pixel[0] && pixel[0] <= 1.0f, "pixel[0]: %f", pixel[0]);
184 SkASSERTF(0.0f <= pixel[1] && pixel[1] <= 1.0f, "pixel[1]: %f", pixel[1]);
185 SkASSERTF(0.0f <= pixel[2] && pixel[2] <= 1.0f, "pixel[2]: %f", pixel[2]);
186 SkASSERTF(0.0f <= pixel[3] && pixel[3] <= 1.0f, "pixel[3]: %f", pixel[3]);
187 return pixel;
188 }
189
190 } // namespace 181 } // namespace
191 182
192 class SkLinearBitmapPipeline::PointProcessorInterface { 183 class SkLinearBitmapPipeline::PointProcessorInterface {
193 public: 184 public:
194 virtual ~PointProcessorInterface() { } 185 virtual ~PointProcessorInterface() { }
195 // Take the first n (where 0 < n && n < 4) items from xs and ys and sample t hose points. For 186 // Take the first n (where 0 < n && n < 4) items from xs and ys and sample t hose points. For
196 // nearest neighbor, that means just taking the floor xs and ys. For bilerp, this means 187 // nearest neighbor, that means just taking the floor xs and ys. For bilerp, this means
197 // to expand the bilerp filter around the point and sample using that filter . 188 // to expand the bilerp filter around the point and sample using that filter .
198 virtual void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) = 0; 189 virtual void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) = 0;
199 // Same as pointListFew, but n = 4. 190 // Same as pointListFew, but n = 4.
200 virtual void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) = 0; 191 virtual void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) = 0;
201 // A span is a compact form of sample points that are obtained by mapping po ints from 192 // A span is a compact form of sample points that are obtained by mapping po ints from
202 // destination space to source space. This is used for horizontal lines only , and is mainly 193 // destination space to source space. This is used for horizontal lines only , and is mainly
203 // used to take advantage of memory coherence for horizontal spans. 194 // used to take advantage of memory coherence for horizontal spans.
204 virtual void pointSpan(Span span) = 0; 195 virtual void pointSpan(Span span) = 0;
205 }; 196 };
206 197
207 class SkLinearBitmapPipeline::SampleProcessorInterface 198 class SkLinearBitmapPipeline::SampleProcessorInterface
208 : public SkLinearBitmapPipeline::PointProcessorInterface { 199 : public SkLinearBitmapPipeline::PointProcessorInterface {
209 public: 200 public:
210 // Used for nearest neighbor when scale factor is 1.0. The span can just be repeated with no 201 // Used for nearest neighbor when scale factor is 1.0. The span can just be repeated with no
211 // edge pixel alignment problems. This is for handling a very common case. 202 // edge pixel alignment problems. This is for handling a very common case.
212 virtual void repeatSpan(Span span, int32_t repeatCount) = 0; 203 virtual void repeatSpan(Span span, int32_t repeatCount) = 0;
204
205 // The x's and y's are setup in the following order:
206 // +--------+--------+
207 // | | |
208 // | px00 | px10 |
209 // | 0 | 1 |
210 // +--------+--------+
211 // | | |
212 // | px01 | px11 |
213 // | 2 | 3 |
214 // +--------+--------+
215 // These pixels coordinates are arranged in the following order in xs and ys :
216 // px00 px10 px01 px11
217 virtual void SK_VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) = 0;
218
219 // A span represents sample points that have been mapped from destination sp ace to source
220 // space. Each sample point is then expanded to the four bilerp points by ad d +/- 0.5. The
221 // resulting Y values my be off the tile. When y +/- 0.5 are more than 1 apa rt because of
222 // tiling, the second Y is used to denote the retiled Y value.
223 virtual void bilerpSpan(Span span, SkScalar y) = 0;
213 }; 224 };
214 225
215 class SkLinearBitmapPipeline::DestinationInterface { 226 class SkLinearBitmapPipeline::DestinationInterface {
216 public: 227 public:
217 virtual ~DestinationInterface() { } 228 virtual ~DestinationInterface() { }
218 // Count is normally not needed, but in these early stages of development it is useful to 229 // Count is normally not needed, but in these early stages of development it is useful to
219 // check bounds. 230 // check bounds.
220 // TODO(herb): 4/6/2016 - remove count when code is stable. 231 // TODO(herb): 4/6/2016 - remove count when code is stable.
221 virtual void setDestination(void* dst, int count) = 0; 232 virtual void setDestination(void* dst, int count) = 0;
222 }; 233 };
223 234
224 class SkLinearBitmapPipeline::BlendProcessorInterface 235 class SkLinearBitmapPipeline::BlendProcessorInterface
225 : public SkLinearBitmapPipeline::DestinationInterface { 236 : public SkLinearBitmapPipeline::DestinationInterface {
226 public: 237 public:
227 virtual void SK_VECTORCALL blendPixel(Sk4f pixel0) = 0; 238 virtual void SK_VECTORCALL blendPixel(Sk4f pixel0) = 0;
228 virtual void SK_VECTORCALL blend4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) = 0; 239 virtual void SK_VECTORCALL blend4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) = 0;
229 }; 240 };
230 241
231 class SkLinearBitmapPipeline::PixelAccessorInterface { 242 class SkLinearBitmapPipeline::PixelAccessorInterface {
232 public: 243 public:
233 virtual ~PixelAccessorInterface() { } 244 virtual ~PixelAccessorInterface() { }
234 virtual void SK_VECTORCALL getFewPixels( 245 virtual void SK_VECTORCALL getFewPixels(
235 int n, Sk4i xs, Sk4i ys, Sk4f* px0, Sk4f* px1, Sk4f* px2) const = 0; 246 int n, Sk4s xs, Sk4s ys, Sk4f* px0, Sk4f* px1, Sk4f* px2) const = 0;
236 247
237 virtual void SK_VECTORCALL get4Pixels( 248 virtual void SK_VECTORCALL get4Pixels(
238 Sk4i xs, Sk4i ys, Sk4f* px0, Sk4f* px1, Sk4f* px2, Sk4f* px3) const = 0; 249 Sk4s xs, Sk4s ys, Sk4f* px0, Sk4f* px1, Sk4f* px2, Sk4f* px3) const = 0;
239 250
240 virtual void get4Pixels( 251 virtual void get4Pixels(
241 const void* src, int index, Sk4f* px0, Sk4f* px1, Sk4f* px2, Sk4f* px3) const = 0; 252 const void* src, int index, Sk4f* px0, Sk4f* px1, Sk4f* px2, Sk4f* px3) const = 0;
242 253
243 virtual Sk4f getPixelFromRow(const void* row, int index) const = 0; 254 virtual Sk4f getPixelFromRow(const void* row, int index) const = 0;
244 255
245 virtual Sk4f getPixelAt(int index) const = 0; 256 virtual Sk4f getPixelAt(int index) const = 0;
246 257
247 virtual const void* row(int y) const = 0; 258 virtual const void* row(int y) const = 0;
248 }; 259 };
249 260
250 #endif // SkLinearBitmapPipeline_core_DEFINED 261 #endif // SkLinearBitmapPipeline_core_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkLinearBitmapPipeline.cpp ('k') | src/core/SkLinearBitmapPipeline_sample.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698