Chromium Code Reviews| Index: src/core/SkBitmapProcShader.cpp |
| diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp |
| index 4813e01d543200f692bf9721d4237b84f24acb85..fb58f542cc7b7c708426ec129ac28e231bbce644 100644 |
| --- a/src/core/SkBitmapProcShader.cpp |
| +++ b/src/core/SkBitmapProcShader.cpp |
| @@ -46,7 +46,7 @@ public: |
| ~BitmapProcInfoContext() override { |
| fInfo->~SkBitmapProcInfo(); |
| } |
| - |
| + |
| uint32_t getFlags() const override { return fFlags; } |
| private: |
| @@ -123,8 +123,10 @@ public: |
| { |
| // Need to ensure that our pipeline is created at a 16byte aligned address |
| fPipeline = (SkLinearBitmapPipeline*)SkAlign16((intptr_t)fStorage); |
| - new (fPipeline) SkLinearBitmapPipeline(info->fInvMatrix, info->fFilterQuality, |
| + float alpha = SkColorGetA(info->fPaintColor) / 255.0f; |
| + new (fPipeline) SkLinearBitmapPipeline(info->fRealInvMatrix, info->fFilterQuality, |
| info->fTileModeX, info->fTileModeY, |
| + alpha, |
| info->fPixmap); |
| // To implement the old shadeSpan entry-point, we need to efficiently convert our native |
| @@ -175,7 +177,8 @@ static bool choose_linear_pipeline(const SkShader::ContextRec& rec, const SkImag |
| // These src attributes are not supported in the new 4f context (yet) |
| // |
| if (srcInfo.bytesPerPixel() < 4 || |
| - kRGBA_F16_SkColorType == srcInfo.colorType()) { |
| + kRGBA_F16_SkColorType == srcInfo.colorType() || |
| + kIndex_8_SkColorType == srcInfo.colorType()) { |
|
f(malita)
2016/03/22 20:55:26
Doesn't srcInfo.bytesPerPixel() < 4 catch kIndex_8
herb_g
2016/03/22 21:10:40
The real problem is that the provider may lie abou
|
| return false; |
| } |
| @@ -211,25 +214,13 @@ SkShader::Context* SkBitmapProcShader::MakeContext(const SkShader& shader, |
| return nullptr; |
| } |
| - // Decide if we can/want to use the new linear pipeine |
| + // Decide if we can/want to use the new linear pipeline |
| bool useLinearPipeline = choose_linear_pipeline(rec, provider.info()); |
| - // New code doesn't support Mirror (YET), so we detect that here. |
| - // |
| - if (SkShader::kMirror_TileMode == tmx || SkShader::kMirror_TileMode == tmy) { |
| - useLinearPipeline = false; |
| - } |
| - |
| - // New code doesn't support Mirror (YET), so we detect that here. |
| - // |
| - if (totalInverse.hasPerspective()) { |
| - useLinearPipeline = false; |
| - } |
| - |
| // |
| // For now, only enable locally since we are hitting some crashers on the test bots |
| // |
| - useLinearPipeline = false; |
| + //useLinearPipeline = false; |
| if (useLinearPipeline) { |
| void* infoStorage = (char*)storage + sizeof(LinearPipelineContext); |
| @@ -238,6 +229,10 @@ SkShader::Context* SkBitmapProcShader::MakeContext(const SkShader& shader, |
| info->~SkBitmapProcInfo(); |
| return nullptr; |
| } |
| + if (info->fPixmap.colorType() != kRGBA_8888_SkColorType |
| + && info->fPixmap.colorType() != kBGRA_8888_SkColorType) { |
|
f(malita)
2016/03/22 20:55:26
Do we really support any swizzle != kN32_SkColorTy
herb_g
2016/03/22 21:10:40
Yes we really do support both at the same time.
|
| + return nullptr; |
| + } |
| return new (storage) LinearPipelineContext(shader, rec, info); |
| } else { |
| void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext); |