remove S4444 sprite blitters
These can fall through to the SkRasterPipelineSpriteBlitter just fine. Change-Id: I56f4f177475b233fd2d3352df1ecddc47be0d37d Reviewed-on: https://skia-review.googlesource.com/21203 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
4a0f180211
commit
5f46e96757
@ -148,109 +148,6 @@ private:
|
||||
typedef Sprite_D32_XferFilter INHERITED;
|
||||
};
|
||||
|
||||
static void fillbuffer(SkPMColor* SK_RESTRICT dst,
|
||||
const SkPMColor16* SK_RESTRICT src, int count) {
|
||||
SkASSERT(count > 0);
|
||||
|
||||
do {
|
||||
*dst++ = SkPixel4444ToPixel32(*src++);
|
||||
} while (--count != 0);
|
||||
}
|
||||
|
||||
class Sprite_D32_S4444_XferFilter : public Sprite_D32_XferFilter {
|
||||
public:
|
||||
Sprite_D32_S4444_XferFilter(const SkPixmap& source, const SkPaint& paint)
|
||||
: Sprite_D32_XferFilter(source, paint) {}
|
||||
|
||||
void blitRect(int x, int y, int width, int height) override {
|
||||
SkASSERT(width > 0 && height > 0);
|
||||
SkPMColor* SK_RESTRICT dst = fDst.writable_addr32(x, y);
|
||||
const SkPMColor16* SK_RESTRICT src = fSource.addr16(x - fLeft, y - fTop);
|
||||
size_t dstRB = fDst.rowBytes();
|
||||
size_t srcRB = fSource.rowBytes();
|
||||
SkPMColor* SK_RESTRICT buffer = fBuffer;
|
||||
SkColorFilter* colorFilter = fColorFilter;
|
||||
SkXfermode* xfermode = fXfermode;
|
||||
|
||||
do {
|
||||
fillbuffer(buffer, src, width);
|
||||
|
||||
if (colorFilter) {
|
||||
colorFilter->filterSpan(buffer, width, buffer);
|
||||
}
|
||||
if (xfermode) {
|
||||
xfermode->xfer32(dst, buffer, width, nullptr);
|
||||
} else {
|
||||
fProc32(dst, buffer, width, fAlpha);
|
||||
}
|
||||
|
||||
dst = (SkPMColor* SK_RESTRICT)((char*)dst + dstRB);
|
||||
src = (const SkPMColor16* SK_RESTRICT)((const char*)src + srcRB);
|
||||
} while (--height != 0);
|
||||
}
|
||||
|
||||
private:
|
||||
typedef Sprite_D32_XferFilter INHERITED;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void src_row(SkPMColor* SK_RESTRICT dst,
|
||||
const SkPMColor16* SK_RESTRICT src, int count) {
|
||||
do {
|
||||
*dst = SkPixel4444ToPixel32(*src);
|
||||
src += 1;
|
||||
dst += 1;
|
||||
} while (--count != 0);
|
||||
}
|
||||
|
||||
class Sprite_D32_S4444_Opaque : public SkSpriteBlitter {
|
||||
public:
|
||||
Sprite_D32_S4444_Opaque(const SkPixmap& source) : SkSpriteBlitter(source) {}
|
||||
|
||||
void blitRect(int x, int y, int width, int height) override {
|
||||
SkASSERT(width > 0 && height > 0);
|
||||
SkPMColor* SK_RESTRICT dst = fDst.writable_addr32(x, y);
|
||||
const SkPMColor16* SK_RESTRICT src = fSource.addr16(x - fLeft, y - fTop);
|
||||
size_t dstRB = fDst.rowBytes();
|
||||
size_t srcRB = fSource.rowBytes();
|
||||
|
||||
do {
|
||||
src_row(dst, src, width);
|
||||
dst = (SkPMColor* SK_RESTRICT)((char*)dst + dstRB);
|
||||
src = (const SkPMColor16* SK_RESTRICT)((const char*)src + srcRB);
|
||||
} while (--height != 0);
|
||||
}
|
||||
};
|
||||
|
||||
static void srcover_row(SkPMColor* SK_RESTRICT dst,
|
||||
const SkPMColor16* SK_RESTRICT src, int count) {
|
||||
do {
|
||||
*dst = SkPMSrcOver(SkPixel4444ToPixel32(*src), *dst);
|
||||
src += 1;
|
||||
dst += 1;
|
||||
} while (--count != 0);
|
||||
}
|
||||
|
||||
class Sprite_D32_S4444 : public SkSpriteBlitter {
|
||||
public:
|
||||
Sprite_D32_S4444(const SkPixmap& source) : SkSpriteBlitter(source) {}
|
||||
|
||||
void blitRect(int x, int y, int width, int height) override {
|
||||
SkASSERT(width > 0 && height > 0);
|
||||
SkPMColor* SK_RESTRICT dst = fDst.writable_addr32(x, y);
|
||||
const SkPMColor16* SK_RESTRICT src = fSource.addr16(x - fLeft, y - fTop);
|
||||
size_t dstRB = fDst.rowBytes();
|
||||
size_t srcRB = fSource.rowBytes();
|
||||
|
||||
do {
|
||||
srcover_row(dst, src, width);
|
||||
dst = (SkPMColor* SK_RESTRICT)((char*)dst + dstRB);
|
||||
src = (const SkPMColor16* SK_RESTRICT)((const char*)src + srcRB);
|
||||
} while (--height != 0);
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SkSpriteBlitter* SkSpriteBlitter::ChooseL32(const SkPixmap& source, const SkPaint& paint,
|
||||
@ -266,32 +163,16 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseL32(const SkPixmap& source, const SkPain
|
||||
SkColorFilter* filter = paint.getColorFilter();
|
||||
SkSpriteBlitter* blitter = nullptr;
|
||||
|
||||
switch (source.colorType()) {
|
||||
case kARGB_4444_SkColorType:
|
||||
if (alpha != 0xFF) {
|
||||
return nullptr; // we only have opaque sprites
|
||||
if (source.colorType() == kN32_SkColorType) {
|
||||
if (!isSrcOver || filter) {
|
||||
if (255 == alpha) {
|
||||
// this can handle xfermode or filter, but not alpha
|
||||
blitter = allocator->make<Sprite_D32_S32A_XferFilter>(source, paint);
|
||||
}
|
||||
if (!isSrcOver || filter) {
|
||||
blitter = allocator->make<Sprite_D32_S4444_XferFilter>(source, paint);
|
||||
} else if (source.isOpaque()) {
|
||||
blitter = allocator->make<Sprite_D32_S4444_Opaque>(source);
|
||||
} else {
|
||||
blitter = allocator->make<Sprite_D32_S4444>(source);
|
||||
}
|
||||
break;
|
||||
case kN32_SkColorType:
|
||||
if (!isSrcOver || filter) {
|
||||
if (255 == alpha) {
|
||||
// this can handle xfermode or filter, but not alpha
|
||||
blitter = allocator->make<Sprite_D32_S32A_XferFilter>(source, paint);
|
||||
}
|
||||
} else {
|
||||
// this can handle alpha, but not xfermode or filter
|
||||
blitter = allocator->make<Sprite_D32_S32>(source, alpha);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} else {
|
||||
// this can handle alpha, but not xfermode or filter
|
||||
blitter = allocator->make<Sprite_D32_S32>(source, alpha);
|
||||
}
|
||||
}
|
||||
return blitter;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user