Index: src/core/SkShader.cpp |
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp |
index 1413a6ee7336aecd60762c71c11889def7f7c04d..cb0517bf64073e43389e4b4868a9ffeeaf253237 100644 |
--- a/src/core/SkShader.cpp |
+++ b/src/core/SkShader.cpp |
@@ -361,6 +361,46 @@ void SkColorShader::toString(SkString* str) const { |
/////////////////////////////////////////////////////////////////////////////// |
+static void D32_BlitProc(SkShader::Context::BlitState* state, int x, int y, const SkPixmap& dst, |
+ int count, const SkAlpha aa[]) { |
+ SkXfermode::D32Proc proc = (SkXfermode::D32Proc)state->fStorage[0]; |
+ const SkPM4f* src = (const SkPM4f*)state->fStorage[1]; |
+ proc(state->fXfer, dst.writable_addr32(x, y), src, count, aa); |
+} |
+ |
+static void D64_BlitProc(SkShader::Context::BlitState* state, int x, int y, const SkPixmap& dst, |
+ int count, const SkAlpha aa[]) { |
+ SkXfermode::D64Proc proc = (SkXfermode::D64Proc)state->fStorage[0]; |
+ const SkPM4f* src = (const SkPM4f*)state->fStorage[1]; |
+ proc(state->fXfer, dst.writable_addr64(x, y), src, count, aa); |
+} |
+ |
+SkShader::Context::BlitProc |
+SkColorShader::ColorShaderContext::onChooseBlitProc(const SkImageInfo& info, BlitState* state) { |
+ uint32_t flags = SkXfermode::kSrcIsSingle_D32Flag; |
+ if (fPM4f.a() == 1) { |
+ flags |= SkXfermode::kSrcIsOpaque_D32Flag; |
+ } |
+ switch (info.colorType()) { |
+ case kN32_SkColorType: |
+ if (info.isSRGB()) { |
+ flags |= SkXfermode::kDstIsSRGB_D32Flag; |
+ } |
+ state->fStorage[0] = (void*)SkXfermode::GetD32Proc(state->fXfer, flags); |
+ state->fStorage[1] = &fPM4f; |
+ return D32_BlitProc; |
+ case kRGBA_F16_SkColorType: |
+ flags |= SkXfermode::kDstIsFloat16_D64Flag; |
+ state->fStorage[0] = (void*)SkXfermode::GetD64Proc(state->fXfer, flags); |
+ state->fStorage[1] = &fPM4f; |
+ return D64_BlitProc; |
+ default: |
+ return nullptr; |
+ } |
+} |
+ |
+/////////////////////////////////////////////////////////////////////////////// |
+ |
SkFlattenable* SkEmptyShader::CreateProc(SkReadBuffer&) { |
return SkShader::MakeEmptyShader().release(); |
} |