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

Unified Diff: src/core/SkBitmapProcShader.cpp

Issue 1775963002: Bilerp + mirror + perspective (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address 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 | « gyp/core.gypi ('k') | src/core/SkBitmapProcState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()) {
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) {
+ return nullptr;
+ }
return new (storage) LinearPipelineContext(shader, rec, info);
} else {
void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext);
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkBitmapProcState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698