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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkLinearBitmapPipeline.cpp ('k') | src/core/SkLinearBitmapPipeline_sample.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLinearBitmapPipeline_core.h
diff --git a/src/core/SkLinearBitmapPipeline_core.h b/src/core/SkLinearBitmapPipeline_core.h
index c92773bc307a47d468fd67043935e88dcf404360..db3c4d06f4641e7d900620a938a4f1d18869bfe1 100644
--- a/src/core/SkLinearBitmapPipeline_core.h
+++ b/src/core/SkLinearBitmapPipeline_core.h
@@ -188,4 +188,63 @@ void span_fallback(Span span, Stage* stage) {
}
} // namespace
+class SkLinearBitmapPipeline::PointProcessorInterface {
+public:
+ virtual ~PointProcessorInterface() { }
+ // Take the first n (where 0 < n && n < 4) items from xs and ys and sample those points. For
+ // nearest neighbor, that means just taking the floor xs and ys. For bilerp, this means
+ // to expand the bilerp filter around the point and sample using that filter.
+ virtual void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) = 0;
+ // Same as pointListFew, but n = 4.
+ virtual void VECTORCALL pointList4(Sk4s xs, Sk4s ys) = 0;
+ // A span is a compact form of sample points that are obtained by mapping points from
+ // destination space to source space. This is used for horizontal lines only, and is mainly
+ // used to take advantage of memory coherence for horizontal spans.
+ virtual void pointSpan(Span span) = 0;
+};
+
+class SkLinearBitmapPipeline::SampleProcessorInterface
+ : public SkLinearBitmapPipeline::PointProcessorInterface {
+public:
+ // Used for nearest neighbor when scale factor is 1.0. The span can just be repeated with no
+ // edge pixel alignment problems. This is for handling a very common case.
+ virtual void repeatSpan(Span span, int32_t repeatCount) = 0;
+
+ // The x's and y's are setup in the following order:
+ // +--------+--------+
+ // | | |
+ // | px00 | px10 |
+ // | 0 | 1 |
+ // +--------+--------+
+ // | | |
+ // | px01 | px11 |
+ // | 2 | 3 |
+ // +--------+--------+
+ // These pixels coordinates are arranged in the following order in xs and ys:
+ // px00 px10 px01 px11
+ virtual void VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) = 0;
+
+ // A span represents sample points that have been mapped from destination space to source
+ // space. Each sample point is then expanded to the four bilerp points by add +/- 0.5. The
+ // resulting Y values my be off the tile. When y +/- 0.5 are more than 1 apart because of
+ // tiling, the second Y is used to denote the retiled Y value.
+ virtual void bilerpSpan(Span span, SkScalar y) = 0;
+};
+
+class SkLinearBitmapPipeline::DestinationInterface {
+public:
+ virtual ~DestinationInterface() { }
+ // Count is normally not needed, but in these early stages of development it is useful to
+ // check bounds.
+ // TODO(herb): 4/6/2016 - remove count when code is stable.
+ virtual void setDestination(void* dst, int count) = 0;
+};
+
+class SkLinearBitmapPipeline::BlendProcessorInterface
+ : public SkLinearBitmapPipeline::DestinationInterface {
+public:
+ virtual void VECTORCALL blendPixel(Sk4f pixel0) = 0;
+ virtual void VECTORCALL blend4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) = 0;
+};
+
#endif // SkLinearBitmapPipeline_core_DEFINED
« 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