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

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

Issue 2055513003: Simplify code by breaking general sampler into Nearest and Bilerp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: sync Created 4 years, 6 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 stage->pointList4(xs, ys); 181 stage->pointList4(xs, ys);
182 xs = xs + fourDx; 182 xs = xs + fourDx;
183 count -= 4; 183 count -= 4;
184 } 184 }
185 if (count > 0) { 185 if (count > 0) {
186 stage->pointListFew(count, xs, ys); 186 stage->pointListFew(count, xs, ys);
187 } 187 }
188 } 188 }
189 } // namespace 189 } // namespace
190 190
191 class SkLinearBitmapPipeline::PointProcessorInterface {
192 public:
193 virtual ~PointProcessorInterface() { }
194 // Take the first n (where 0 < n && n < 4) items from xs and ys and sample t hose points. For
195 // nearest neighbor, that means just taking the floor xs and ys. For bilerp, this means
196 // to expand the bilerp filter around the point and sample using that filter .
197 virtual void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) = 0;
198 // Same as pointListFew, but n = 4.
199 virtual void VECTORCALL pointList4(Sk4s xs, Sk4s ys) = 0;
200 // A span is a compact form of sample points that are obtained by mapping po ints from
201 // destination space to source space. This is used for horizontal lines only , and is mainly
202 // used to take advantage of memory coherence for horizontal spans.
203 virtual void pointSpan(Span span) = 0;
204 };
205
206 class SkLinearBitmapPipeline::SampleProcessorInterface
207 : public SkLinearBitmapPipeline::PointProcessorInterface {
208 public:
209 // Used for nearest neighbor when scale factor is 1.0. The span can just be repeated with no
210 // edge pixel alignment problems. This is for handling a very common case.
211 virtual void repeatSpan(Span span, int32_t repeatCount) = 0;
212
213 // The x's and y's are setup in the following order:
214 // +--------+--------+
215 // | | |
216 // | px00 | px10 |
217 // | 0 | 1 |
218 // +--------+--------+
219 // | | |
220 // | px01 | px11 |
221 // | 2 | 3 |
222 // +--------+--------+
223 // These pixels coordinates are arranged in the following order in xs and ys :
224 // px00 px10 px01 px11
225 virtual void VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) = 0;
226
227 // A span represents sample points that have been mapped from destination sp ace to source
228 // space. Each sample point is then expanded to the four bilerp points by ad d +/- 0.5. The
229 // resulting Y values my be off the tile. When y +/- 0.5 are more than 1 apa rt because of
230 // tiling, the second Y is used to denote the retiled Y value.
231 virtual void bilerpSpan(Span span, SkScalar y) = 0;
232 };
233
234 class SkLinearBitmapPipeline::DestinationInterface {
235 public:
236 virtual ~DestinationInterface() { }
237 // Count is normally not needed, but in these early stages of development it is useful to
238 // check bounds.
239 // TODO(herb): 4/6/2016 - remove count when code is stable.
240 virtual void setDestination(void* dst, int count) = 0;
241 };
242
243 class SkLinearBitmapPipeline::BlendProcessorInterface
244 : public SkLinearBitmapPipeline::DestinationInterface {
245 public:
246 virtual void VECTORCALL blendPixel(Sk4f pixel0) = 0;
247 virtual void VECTORCALL blend4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) = 0 ;
248 };
249
191 #endif // SkLinearBitmapPipeline_core_DEFINED 250 #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