diff options
author | 2016-05-12 11:37:00 -0700 | |
---|---|---|
committer | 2016-05-12 11:37:00 -0700 | |
commit | 15332a841d7b65774bc5dbcdfeec3a954a655895 (patch) | |
tree | 1ce97fa54f86341f3570fe4aa25855cee5a8b129 /src/core/SkLinearBitmapPipeline.cpp | |
parent | dd4fcd450016648c1d8f298cea762e9b1308fbb5 (diff) |
Make PixelGetters much smaller, move more common code to PixelAccessor.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1971863002
Review-Url: https://codereview.chromium.org/1971863002
Diffstat (limited to 'src/core/SkLinearBitmapPipeline.cpp')
-rw-r--r-- | src/core/SkLinearBitmapPipeline.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/core/SkLinearBitmapPipeline.cpp b/src/core/SkLinearBitmapPipeline.cpp index 562e3ecf6f..6bb88d1bf6 100644 --- a/src/core/SkLinearBitmapPipeline.cpp +++ b/src/core/SkLinearBitmapPipeline.cpp @@ -468,7 +468,7 @@ static SkLinearBitmapPipeline::PointProcessorInterface* choose_tiler( //////////////////////////////////////////////////////////////////////////////////////////////////// // Source Sampling Stage -template <typename SourceStrategy, typename Next> +template <SkColorType colorType, SkColorProfileType colorProfile, typename Next> class NearestNeighborSampler final : public SkLinearBitmapPipeline::SampleProcessorInterface { public: template <typename... Args> @@ -506,10 +506,10 @@ public: } private: - GeneralSampler<SourceStrategy, Next> fSampler; + GeneralSampler<colorType, colorProfile, Next> fSampler; }; -template <typename SourceStrategy, typename Next> +template <SkColorType colorType, SkColorProfileType colorProfile, typename Next> class BilerpSampler final : public SkLinearBitmapPipeline::SampleProcessorInterface { public: template <typename... Args> @@ -547,7 +547,7 @@ public: } private: - GeneralSampler<SourceStrategy, Next> fSampler; + GeneralSampler<colorType, colorProfile, Next> fSampler; }; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -708,7 +708,7 @@ private: using Blender = SkLinearBitmapPipeline::BlendProcessorInterface; -template<template <typename, typename> class Sampler> +template<template <SkColorType, SkColorProfileType, typename> class Sampler> static SkLinearBitmapPipeline::SampleProcessorInterface* choose_pixel_sampler_base( Blender* next, const SkPixmap& srcPixmap, @@ -717,27 +717,35 @@ static SkLinearBitmapPipeline::SampleProcessorInterface* choose_pixel_sampler_ba switch (imageInfo.colorType()) { case kRGBA_8888_SkColorType: if (imageInfo.profileType() == kSRGB_SkColorProfileType) { - sampleStage->initStage<Sampler<Pixel8888SRGB, Blender>>(next, srcPixmap); + using S = Sampler<kRGBA_8888_SkColorType, kSRGB_SkColorProfileType, Blender>; + sampleStage->initStage<S>(next, srcPixmap); } else { - sampleStage->initStage<Sampler<Pixel8888LRGB, Blender>>(next, srcPixmap); + using S = Sampler<kRGBA_8888_SkColorType, kLinear_SkColorProfileType, Blender>; + sampleStage->initStage<S>(next, srcPixmap); } break; case kBGRA_8888_SkColorType: if (imageInfo.profileType() == kSRGB_SkColorProfileType) { - sampleStage->initStage<Sampler<Pixel8888SBGR, Blender>>(next, srcPixmap); + using S = Sampler<kBGRA_8888_SkColorType, kSRGB_SkColorProfileType, Blender>; + sampleStage->initStage<S>(next, srcPixmap); } else { - sampleStage->initStage<Sampler<Pixel8888LBGR, Blender>>(next, srcPixmap); + using S = Sampler<kBGRA_8888_SkColorType, kLinear_SkColorProfileType, Blender>; + sampleStage->initStage<S>(next, srcPixmap); } break; case kIndex_8_SkColorType: if (imageInfo.profileType() == kSRGB_SkColorProfileType) { - sampleStage->initStage<Sampler<PixelIndex8SRGB, Blender>>(next, srcPixmap); + using S = Sampler<kIndex_8_SkColorType, kSRGB_SkColorProfileType, Blender>; + sampleStage->initStage<S>(next, srcPixmap); } else { - sampleStage->initStage<Sampler<PixelIndex8LRGB, Blender>>(next, srcPixmap); + using S = Sampler<kIndex_8_SkColorType, kLinear_SkColorProfileType, Blender>; + sampleStage->initStage<S>(next, srcPixmap); } break; - case kRGBA_F16_SkColorType: - sampleStage->initStage<Sampler<PixelHalfLinear, Blender>>(next, srcPixmap); + case kRGBA_F16_SkColorType: { + using S = Sampler<kRGBA_F16_SkColorType, kLinear_SkColorProfileType, Blender>; + sampleStage->initStage<S>(next, srcPixmap); + } break; default: SkFAIL("Not implemented. Unsupported src"); |