Index: src/core/SkSpriteBlitter4f.cpp |
diff --git a/src/core/SkSpriteBlitter4f.cpp b/src/core/SkSpriteBlitter4f.cpp |
index fc4b4809511f1bec8730afdb84b2a0ddcf326b94..474bf4d0f606bb0681dc6dd748b747f7bce1692a 100644 |
--- a/src/core/SkSpriteBlitter4f.cpp |
+++ b/src/core/SkSpriteBlitter4f.cpp |
@@ -13,12 +13,14 @@ |
class Sprite_4f : public SkSpriteBlitter { |
public: |
Sprite_4f(const SkPixmap& src, const SkPaint& paint) : INHERITED(src) { |
+ fXfer = paint.getXfermode(); |
fLoader = SkLoadSpanProc_Choose(src.info()); |
fFilter = SkFilterSpanProc_Choose(paint); |
fBuffer.reset(src.width()); |
} |
protected: |
+ SkXfermode* fXfer; |
SkLoadSpanProc fLoader; |
SkFilterSpanProc fFilter; |
SkAutoTMalloc<SkPM4f> fBuffer; |
@@ -29,22 +31,14 @@ private: |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
-static SkXfermode::Mode get_mode(const SkXfermode* xfer) { |
- SkXfermode::Mode mode; |
- if (!SkXfermode::AsMode(xfer, &mode)) { |
- mode = SkXfermode::kSrcOver_Mode; |
- } |
- return mode; |
-} |
- |
class Sprite_F16 : public Sprite_4f { |
public: |
Sprite_F16(const SkPixmap& src, const SkPaint& paint) : INHERITED(src, paint) { |
- fState = { paint.getXfermode(), SkXfermode::kDstIsFloat16_U64Flag }; |
+ uint32_t flags = SkXfermode::kDstIsFloat16_D64Flag; |
if (src.isOpaque()) { |
- fState.fFlags |= SkXfermode::kSrcIsOpaque_U64Flag; |
+ flags |= SkXfermode::kSrcIsOpaque_D64Flag; |
} |
- fXfer = SkXfermode::GetU64ProcN(get_mode(fState.fXfer), fState.fFlags); |
+ fWriter = SkXfermode::GetD64Proc(fXfer, flags); |
} |
void blitRect(int x, int y, int width, int height) override { |
@@ -55,14 +49,13 @@ public: |
for (int bottom = y + height; y < bottom; ++y) { |
fLoader(fSource, x - fLeft, y - fTop, fBuffer, width); |
fFilter(*fPaint, fBuffer, width); |
- fXfer(fState, dst, fBuffer, width, nullptr); |
+ fWriter(fXfer, dst, fBuffer, width, nullptr); |
dst = (uint64_t* SK_RESTRICT)((char*)dst + dstRB); |
} |
} |
private: |
- SkXfermode::U64State fState; |
- SkXfermode::U64ProcN fXfer; |
+ SkXfermode::D64Proc fWriter; |
typedef Sprite_4f INHERITED; |
}; |
@@ -90,11 +83,11 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseF16(const SkPixmap& source, const SkPain |
class Sprite_sRGB : public Sprite_4f { |
public: |
Sprite_sRGB(const SkPixmap& src, const SkPaint& paint) : INHERITED(src, paint) { |
- fState = { paint.getXfermode(), SkXfermode::kDstIsSRGB_PM4fFlag }; |
+ uint32_t flags = SkXfermode::kDstIsSRGB_D32Flag; |
if (src.isOpaque()) { |
- fState.fFlags |= SkXfermode::kSrcIsOpaque_PM4fFlag; |
+ flags |= SkXfermode::kSrcIsOpaque_D32Flag; |
} |
- fXfer = SkXfermode::GetPM4fProcN(get_mode(fState.fXfer), fState.fFlags); |
+ fWriter = SkXfermode::GetD32Proc(fXfer, flags); |
} |
void blitRect(int x, int y, int width, int height) override { |
@@ -105,14 +98,13 @@ public: |
for (int bottom = y + height; y < bottom; ++y) { |
fLoader(fSource, x - fLeft, y - fTop, fBuffer, width); |
fFilter(*fPaint, fBuffer, width); |
- fXfer(fState, dst, fBuffer, width, nullptr); |
+ fWriter(fXfer, dst, fBuffer, width, nullptr); |
dst = (uint32_t* SK_RESTRICT)((char*)dst + dstRB); |
} |
} |
protected: |
- SkXfermode::PM4fState fState; |
- SkXfermode::PM4fProcN fXfer; |
+ SkXfermode::D32Proc fWriter; |
private: |
typedef Sprite_4f INHERITED; |