aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-03-31 10:27:26 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-31 10:27:26 -0700
commitca9206e10fbbee0e8f8d2df76743ffe3a38cef71 (patch)
tree4f084bda4f06bfcd0ae77df97369d3abe5bb1fee /src
parent3e4616ff10fad7ee7dae48f465223b4591ec8ffd (diff)
Revert of Add unit repeat tiler (patchset #4 id:60001 of https://codereview.chromium.org/1837893004/ )
Reason for revert: ASAN bot failures Original issue's description: > Add unit repeat tiler. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1837893004 > > Committed: https://skia.googlesource.com/skia/+/865a289bfec169cb19970c734e9aa855c267f060 TBR=mtklein@google.com,fmalita@chromium.org,herb@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1844713005
Diffstat (limited to 'src')
-rw-r--r--src/core/SkLinearBitmapPipeline.cpp22
-rw-r--r--src/core/SkLinearBitmapPipeline_tile.h73
2 files changed, 3 insertions, 92 deletions
diff --git a/src/core/SkLinearBitmapPipeline.cpp b/src/core/SkLinearBitmapPipeline.cpp
index 59960ebcb7..4e4226a320 100644
--- a/src/core/SkLinearBitmapPipeline.cpp
+++ b/src/core/SkLinearBitmapPipeline.cpp
@@ -238,12 +238,6 @@ public:
processor->breakIntoEdges(span);
}
- void repeatSpan(Span span, int32_t repeatCount) {
- while (repeatCount --> 0) {
- processor->pointSpan(span);
- }
- }
-
BilerpTileStage* processor;
};
@@ -370,21 +364,13 @@ static SkLinearBitmapPipeline::PointProcessorInterface* choose_tiler(
SkShader::TileMode xMode,
SkShader::TileMode yMode,
SkFilterQuality filterQuality,
- SkScalar dx,
- SkLinearBitmapPipeline::TileStage* tileStage)
-{
+ SkLinearBitmapPipeline::TileStage* tileStage) {
switch (xMode) {
case SkShader::kClamp_TileMode:
choose_tiler_ymode<XClampStrategy>(yMode, filterQuality, dimensions, next, tileStage);
break;
case SkShader::kRepeat_TileMode:
- if (dx == 1.0f && filterQuality == kNone_SkFilterQuality) {
- choose_tiler_ymode<XRepeatUnitScaleStrategy>(
- yMode, kNone_SkFilterQuality, dimensions, next, tileStage);
- } else {
- choose_tiler_ymode<XRepeatStrategy>(
- yMode, filterQuality, dimensions, next, tileStage);
- }
+ choose_tiler_ymode<XRepeatStrategy>(yMode, filterQuality, dimensions, next, tileStage);
break;
case SkShader::kMirror_TileMode:
choose_tiler_ymode<XMirrorStrategy>(yMode, filterQuality, dimensions, next, tileStage);
@@ -602,8 +588,6 @@ SkLinearBitmapPipeline::SkLinearBitmapPipeline(
}
}
- SkScalar dx = adjustedInverse.getScaleX();
-
// If it is an index 8 color type, the sampler converts to unpremul for better fidelity.
SkAlphaType alphaType = srcImageInfo.alphaType();
if (srcPixmap.colorType() == kIndex_8_SkColorType) {
@@ -616,7 +600,7 @@ SkLinearBitmapPipeline::SkLinearBitmapPipeline(
auto samplerStage = choose_pixel_sampler(placementStage,
filterQuality, srcPixmap, &fSampleStage);
auto tilerStage = choose_tiler(samplerStage,
- dimensions, xTile, yTile, filterQuality, dx, &fTiler);
+ dimensions, xTile, yTile, filterQuality, &fTiler);
fFirstStage = choose_matrix(tilerStage, adjustedInverse, &fMatrixStage);
}
diff --git a/src/core/SkLinearBitmapPipeline_tile.h b/src/core/SkLinearBitmapPipeline_tile.h
index 19bdedcfba..60cc2a5ef0 100644
--- a/src/core/SkLinearBitmapPipeline_tile.h
+++ b/src/core/SkLinearBitmapPipeline_tile.h
@@ -234,79 +234,6 @@ private:
const Sk4s fXsInvMax;
};
-class XRepeatUnitScaleStrategy {
-public:
- XRepeatUnitScaleStrategy(int32_t max)
- : fXMax{SkScalar(max)}
- , fXsMax{SkScalar(max)}
- , fXsCap{SkScalar(nextafterf(SkScalar(max), 0.0f))}
- , fXsInvMax{1.0f / SkScalar(max)} { }
-
- void tileXPoints(Sk4s* xs) {
- Sk4s divX = *xs * fXsInvMax;
- Sk4s modX = *xs - divX.floor() * fXsMax;
- *xs = Sk4s::Min(fXsCap, modX);
- SkASSERT(0 <= (*xs)[0] && (*xs)[0] < fXMax);
- SkASSERT(0 <= (*xs)[1] && (*xs)[1] < fXMax);
- SkASSERT(0 <= (*xs)[2] && (*xs)[2] < fXMax);
- SkASSERT(0 <= (*xs)[3] && (*xs)[3] < fXMax);
- }
-
- template<typename Next>
- bool maybeProcessSpan(Span originalSpan, Next* next) {
- SkASSERT(!originalSpan.isEmpty());
- SkPoint start; SkScalar length; int count;
- std::tie(start, length, count) = originalSpan;
- // Make x and y in range on the tile.
- SkScalar x = tile_mod(X(start), fXMax);
- SkScalar y = Y(start);
-
- // No need trying to go fast because the steps are larger than a tile or there is one point.
- if (fXMax == 1 || count <= 1) {
- return false;
- }
-
- // x should be on the tile.
- SkASSERT(0.0f <= x && x < fXMax);
- Span span({x, y}, length, count);
-
- if (SkScalarFloorToScalar(x) != 0.0f) {
- Span toDraw = span.breakAt(fXMax, 1.0f);
- next->pointSpan(toDraw);
- span.offset(-fXMax);
- }
-
- // All of the span could have been on the first tile. If so, then no work to do.
- if (span.isEmpty()) return true;
-
- // At this point the span should be aligned to zero.
- SkASSERT(SkScalarFloorToScalar(span.startX()) == 0.0f);
-
- SkScalar div = span.length() / fXMax;
- int32_t repeatCount = SkScalarFloorToInt(div);
- Span repeatableSpan{{0.0f, y}, fXMax - 1.0f, SkScalarFloorToInt(fXMax)};
-
- // Repeat the center section.
- next->repeatSpan(repeatableSpan, repeatCount);
-
- // There may be some of the span left over.
- span.breakAt(SkScalar(repeatCount) * fXMax, 1.0f);
-
- // All on a single tile.
- if (!span.isEmpty()) {
- next->pointSpan(span);
- }
-
- return true;
- }
-
-private:
- const SkScalar fXMax;
- const Sk4s fXsMax;
- const Sk4s fXsCap;
- const Sk4s fXsInvMax;
-};
-
class YRepeatStrategy {
public:
YRepeatStrategy(int32_t max)