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

Unified Diff: src/core/SkLinearBitmapPipeline_sample.h

Issue 2044373003: Use faster case for on tile sampling, and a little clean up (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698