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

Unified Diff: src/core/SkLinearBitmapPipeline.cpp

Issue 1829883002: Add index-8 sampler to the pipeline. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix MSVC again. 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 | « src/core/SkLinearBitmapPipeline.h ('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.cpp
diff --git a/src/core/SkLinearBitmapPipeline.cpp b/src/core/SkLinearBitmapPipeline.cpp
index 3a9a0196f5659d8a50a18fcfd3c74bc93bf99932..9c4c42cf4071fa4f2238b5f2148585a06f1e94fa 100644
--- a/src/core/SkLinearBitmapPipeline.cpp
+++ b/src/core/SkLinearBitmapPipeline.cpp
@@ -458,6 +458,13 @@ static SkLinearBitmapPipeline::BilerpProcessorInterface* choose_pixel_sampler_ba
sampleStage->Initialize<Sampler<Pixel8888LBGR, Placer>>(next, srcPixmap);
}
break;
+ case kIndex_8_SkColorType:
+ if (imageInfo.profileType() == kSRGB_SkColorProfileType) {
+ sampleStage->Initialize<Sampler<PixelIndex8SRGB, Placer>>(next, srcPixmap);
+ } else {
+ sampleStage->Initialize<Sampler<PixelIndex8LRGB, Placer>>(next, srcPixmap);
+ }
+ break;
default:
SkFAIL("Not implemented. Unsupported src");
break;
@@ -557,9 +564,15 @@ SkLinearBitmapPipeline::SkLinearBitmapPipeline(
}
}
+ // 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) {
+ alphaType = kUnpremul_SkAlphaType;
+ }
+
// As the stages are built, the chooser function may skip a stage. For example, with the
// identity matrix, the matrix stage is skipped, and the tilerStage is the first stage.
- auto placementStage = choose_pixel_placer(srcImageInfo.alphaType(), postAlpha, &fPixelStage);
+ auto placementStage = choose_pixel_placer(alphaType, postAlpha, &fPixelStage);
auto samplerStage = choose_pixel_sampler(placementStage,
filterQuality, srcPixmap, &fSampleStage);
auto tilerStage = choose_tiler(samplerStage,
« no previous file with comments | « src/core/SkLinearBitmapPipeline.h ('k') | src/core/SkLinearBitmapPipeline_sample.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698