aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shaders/SkBitmapProcShader.cpp
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2017-06-23 16:55:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-23 21:21:59 +0000
commit51f6a0f89e55b2c0f102aa7963320a23c586e71d (patch)
tree949b4cf3a2afca6659fb7c31d829beb4cfa1a84d /src/shaders/SkBitmapProcShader.cpp
parent587d082f5044966d9766f43b2632169329986207 (diff)
Remove deadcode for sRGB image shading.
Change-Id: I9d98da67d97b64ab55cf44b9ae447882dccda1ca Reviewed-on: https://skia-review.googlesource.com/20695 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src/shaders/SkBitmapProcShader.cpp')
-rw-r--r--src/shaders/SkBitmapProcShader.cpp94
1 files changed, 5 insertions, 89 deletions
diff --git a/src/shaders/SkBitmapProcShader.cpp b/src/shaders/SkBitmapProcShader.cpp
index 91697e2f1b..1a87491bf4 100644
--- a/src/shaders/SkBitmapProcShader.cpp
+++ b/src/shaders/SkBitmapProcShader.cpp
@@ -100,79 +100,6 @@ private:
};
///////////////////////////////////////////////////////////////////////////////////////////////////
-#include "SkLinearBitmapPipeline.h"
-#include "SkPM4f.h"
-
-class LinearPipelineContext : public BitmapProcInfoContext {
-public:
- LinearPipelineContext(const SkShaderBase& shader, const SkShaderBase::ContextRec& rec,
- SkBitmapProcInfo* info, SkArenaAlloc* alloc)
- : INHERITED(shader, rec, info), fAllocator{alloc}
- {
- // Save things off in case we need to build a blitter pipeline.
- fSrcPixmap = info->fPixmap;
- fAlpha = SkColorGetA(info->fPaintColor) / 255.0f;
- fFilterQuality = info->fFilterQuality;
- fMatrixTypeMask = info->fRealInvMatrix.getType();
-
- fShaderPipeline = alloc->make<SkLinearBitmapPipeline>(
- info->fRealInvMatrix, info->fFilterQuality,
- info->fTileModeX, info->fTileModeY,
- info->fPaintColor,
- info->fPixmap,
- fAllocator);
- }
-
- void shadeSpan4f(int x, int y, SkPM4f dstC[], int count) override {
- fShaderPipeline->shadeSpan4f(x, y, dstC, count);
- }
-
- void shadeSpan(int x, int y, SkPMColor dstC[], int count) override {
- const int N = 128;
- SkPM4f tmp[N];
-
- while (count > 0) {
- const int n = SkTMin(count, N);
- fShaderPipeline->shadeSpan4f(x, y, tmp, n);
- // now convert to SkPMColor
- for (int i = 0; i < n; ++i) {
- dstC[i] = Sk4f_toL32(tmp[i].to4f_pmorder());
- }
- dstC += n;
- x += n;
- count -= n;
- }
- }
-
-private:
- // Store the allocator from the context creation incase we are asked to build a blitter.
- SkArenaAlloc* fAllocator;
- SkLinearBitmapPipeline* fShaderPipeline;
- SkPixmap fSrcPixmap;
- float fAlpha;
- SkMatrix::TypeMask fMatrixTypeMask;
- SkFilterQuality fFilterQuality;
-
- typedef BitmapProcInfoContext INHERITED;
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-static bool choose_linear_pipeline(const SkShaderBase::ContextRec& rec, const SkImageInfo& srcInfo) {
- // If we get here, we can reasonably use either context, respect the caller's preference
- //
- bool needsPremul = srcInfo.alphaType() == kUnpremul_SkAlphaType;
- bool needsSwizzle = srcInfo.bytesPerPixel() == 4 && srcInfo.colorType() != kN32_SkColorType;
- return SkShaderBase::ContextRec::kPM4f_DstType == rec.fPreferredDstType
- || needsPremul || needsSwizzle;
-}
-
-size_t SkBitmapProcLegacyShader::ContextSize(const ContextRec& rec, const SkImageInfo& srcInfo) {
- size_t size0 = sizeof(BitmapProcShaderContext) + sizeof(SkBitmapProcState);
- size_t size1 = sizeof(LinearPipelineContext) + sizeof(SkBitmapProcInfo);
- size_t s = SkTMax(size0, size1);
- return s;
-}
SkShaderBase::Context* SkBitmapProcLegacyShader::MakeContext(
const SkShaderBase& shader, TileMode tmx, TileMode tmy,
@@ -184,21 +111,10 @@ SkShaderBase::Context* SkBitmapProcLegacyShader::MakeContext(
return nullptr;
}
- // Decide if we can/want to use the new linear pipeline
- bool useLinearPipeline = choose_linear_pipeline(rec, provider.info());
-
- if (useLinearPipeline) {
- SkBitmapProcInfo* info = alloc->make<SkBitmapProcInfo>(provider, tmx, tmy);
- if (!info->init(totalInverse, *rec.fPaint)) {
- return nullptr;
- }
-
- return alloc->make<LinearPipelineContext>(shader, rec, info, alloc);
- } else {
- SkBitmapProcState* state = alloc->make<SkBitmapProcState>(provider, tmx, tmy);
- if (!state->setup(totalInverse, *rec.fPaint)) {
- return nullptr;
- }
- return alloc->make<BitmapProcShaderContext>(shader, rec, state);
+ SkBitmapProcState* state = alloc->make<SkBitmapProcState>(provider, tmx, tmy);
+ if (!state->setup(totalInverse, *rec.fPaint)) {
+ return nullptr;
}
+ return alloc->make<BitmapProcShaderContext>(shader, rec, state);
+
}