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

Unified Diff: src/core/SkLinearBitmapPipeline.cpp

Issue 1837893004: Add unit repeat tiler (Closed) Base URL: https://skia.googlesource.com/skia.git@enhance-bilerp-interface
Patch Set: Address florin's comments. Created 4 years, 9 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 | src/core/SkLinearBitmapPipeline_tile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLinearBitmapPipeline.cpp
diff --git a/src/core/SkLinearBitmapPipeline.cpp b/src/core/SkLinearBitmapPipeline.cpp
index 4e4226a3206367770dd35682e00e856479b0b7c3..59960ebcb7c62f2fed18fd2d5eb93accd2d5d5ed 100644
--- a/src/core/SkLinearBitmapPipeline.cpp
+++ b/src/core/SkLinearBitmapPipeline.cpp
@@ -238,6 +238,12 @@ public:
processor->breakIntoEdges(span);
}
+ void repeatSpan(Span span, int32_t repeatCount) {
+ while (repeatCount --> 0) {
+ processor->pointSpan(span);
+ }
+ }
+
BilerpTileStage* processor;
};
@@ -364,13 +370,21 @@ static SkLinearBitmapPipeline::PointProcessorInterface* choose_tiler(
SkShader::TileMode xMode,
SkShader::TileMode yMode,
SkFilterQuality filterQuality,
- SkLinearBitmapPipeline::TileStage* tileStage) {
+ SkScalar dx,
+ SkLinearBitmapPipeline::TileStage* tileStage)
+{
switch (xMode) {
case SkShader::kClamp_TileMode:
choose_tiler_ymode<XClampStrategy>(yMode, filterQuality, dimensions, next, tileStage);
break;
case SkShader::kRepeat_TileMode:
- choose_tiler_ymode<XRepeatStrategy>(yMode, filterQuality, dimensions, next, tileStage);
+ 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);
+ }
break;
case SkShader::kMirror_TileMode:
choose_tiler_ymode<XMirrorStrategy>(yMode, filterQuality, dimensions, next, tileStage);
@@ -588,6 +602,8 @@ 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) {
@@ -600,7 +616,7 @@ SkLinearBitmapPipeline::SkLinearBitmapPipeline(
auto samplerStage = choose_pixel_sampler(placementStage,
filterQuality, srcPixmap, &fSampleStage);
auto tilerStage = choose_tiler(samplerStage,
- dimensions, xTile, yTile, filterQuality, &fTiler);
+ dimensions, xTile, yTile, filterQuality, dx, &fTiler);
fFirstStage = choose_matrix(tilerStage, adjustedInverse, &fMatrixStage);
}
« no previous file with comments | « no previous file | src/core/SkLinearBitmapPipeline_tile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698