Chromium Code Reviews| Index: src/core/SkLinearBitmapPipeline_sample.h |
| diff --git a/src/core/SkLinearBitmapPipeline_sample.h b/src/core/SkLinearBitmapPipeline_sample.h |
| index cf13fd57be891da154f46730f8c8b61c9bfff522..303a874cd624b9ed71114226c69916464163c2ed 100644 |
| --- a/src/core/SkLinearBitmapPipeline_sample.h |
| +++ b/src/core/SkLinearBitmapPipeline_sample.h |
| @@ -314,10 +314,11 @@ public: |
| Sk4f bilerNonEdgePixel(SkScalar x, SkScalar y) { |
|
mtklein
2016/06/08 20:58:49
you can't spell
herb_g
2016/06/08 21:05:48
Fxied
|
| Sk4f px00, px10, px01, px11; |
| - Sk4f xs = Sk4f{x}; |
| - Sk4f ys = Sk4f{y}; |
| - Sk4f sampleXs = xs + Sk4f{-0.5f, 0.5f, -0.5f, 0.5f}; |
| - Sk4f sampleYs = ys + Sk4f{-0.5f, -0.5f, 0.5f, 0.5f}; |
| + // Offset for filtering is expected in the top left of the kernel. |
|
mtklein
2016/06/08 20:58:49
// bilerp4() expects xs,ys are the top-lefts of th
herb_g
2016/06/08 21:05:48
Done.
|
| + Sk4f xs = Sk4f{x} - 0.5f; |
| + Sk4f ys = Sk4f{y} - 0.5f; |
| + Sk4f sampleXs = xs + Sk4f{0.0f, 1.0f, 0.0f, 1.0f}; |
| + Sk4f sampleYs = ys + Sk4f{0.0f, 0.0f, 1.0f, 1.0f}; |
| fStrategy.get4Pixels(sampleXs, sampleYs, &px00, &px10, &px01, &px11); |
| return bilerp4(xs, ys, px00, px10, px01, px11); |
| } |
| @@ -514,11 +515,9 @@ private: |
| SkScalar length; |
| int count; |
| std::tie(start, length, count) = span; |
| - SkFixed fx = SkScalarToFixed(X(start) |
| - -0.5f); |
| + SkFixed fx = SkScalarToFixed(X(start)-0.5f); |
| SkFixed fdx = SkScalarToFixed(length / (count - 1)); |
| - //start = start + SkPoint{-0.5f, -0.5f}; |
| Sk4f xAdjust; |
| if (fdx >= 0) { |
| @@ -751,7 +750,10 @@ private: |
| std::tie(start, length, count) = span; |
| SkScalar x = X(start); |
| SkScalar y = Y(start); |
| - if (false && y == y1) { |
| + // In this sampler, it is assumed that if span.StartY() and y1 are the same then both |
| + // y-lines are on the same tile. |
| + if (y == y1) { |
| + // Both y-lines are on the same tile. |
| struct BilerpWrapper { |
| void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) { |
| fSampler.bilerpListFew(n, xs, ys); |
| @@ -766,6 +768,7 @@ private: |
| BilerpWrapper wrapper{*this}; |
| span_fallback(span, &wrapper); |
| } else { |
| + // The y-lines are on different tiles. |
| SkScalar dx = length / (count - 1); |
| Sk4f ys = {y - 0.5f, y - 0.5f, y1 + 0.5f, y1 + 0.5f}; |
| while (count > 0) { |