Bug 1046921 - Remove usage of legacy Skia API, SK_SUPPORT_LEGACY_BITMAP_CONFIG. r=gw280

This commit is contained in:
Walter Litwinczyk 2014-08-15 10:02:46 -07:00
parent 3fa4499a41
commit 9b66615f0b
3 changed files with 7 additions and 43 deletions

View File

@ -19,41 +19,6 @@
namespace mozilla {
namespace gfx {
static inline SkBitmap::Config
GfxFormatToSkiaConfig(SurfaceFormat format)
{
switch (format)
{
case SurfaceFormat::B8G8R8A8:
return SkBitmap::kARGB_8888_Config;
case SurfaceFormat::B8G8R8X8:
// We probably need to do something here.
return SkBitmap::kARGB_8888_Config;
case SurfaceFormat::R5G6B5:
return SkBitmap::kRGB_565_Config;
case SurfaceFormat::A8:
return SkBitmap::kA8_Config;
default:
return SkBitmap::kARGB_8888_Config;
}
}
static inline SurfaceFormat
SkiaConfigToGfxFormat(SkBitmap::Config config)
{
switch (config)
{
case SkBitmap::kARGB_8888_Config:
return SurfaceFormat::B8G8R8A8;
case SkBitmap::kRGB_565_Config:
return SurfaceFormat::R5G6B5;
case SkBitmap::kA8_Config:
return SurfaceFormat::A8;
default:
return SurfaceFormat::B8G8R8A8;
}
}
static inline SkColorType
GfxFormatToSkiaColorType(SurfaceFormat format)
{

View File

@ -206,7 +206,6 @@
#define SK_SUPPORT_LEGACY_GETDEVICE
#define SK_SUPPORT_LEGACY_GETTOPDEVICE
#define SK_SUPPORT_LEGACY_BITMAP_CONFIG
#define SK_IGNORE_ETC1_SUPPORT
#endif

View File

@ -57,7 +57,7 @@ ANPRectF* SkANP::SetRect(ANPRectF* dst, const SkRect& src) {
SkBitmap* SkANP::SetBitmap(SkBitmap* dst, const ANPBitmap& src) {
SkColorType colorType = kUnknown_SkColorType;
switch (src.format) {
case kRGBA_8888_ANPBitmapFormat:
colorType = kRGBA_8888_SkColorType;
@ -68,7 +68,7 @@ SkBitmap* SkANP::SetBitmap(SkBitmap* dst, const ANPBitmap& src) {
default:
break;
}
SkImageInfo info = SkImageInfo::Make(src.width, src.height, colorType, kPremul_SkAlphaType);
dst->setInfo(info, src.rowBytes);
dst->setPixels(src.baseAddr);
@ -81,18 +81,18 @@ bool SkANP::SetBitmap(ANPBitmap* dst, const SkBitmap& src) {
return false;
}
switch (src.config()) {
case SkBitmap::kARGB_8888_Config:
switch (src.colorType()) {
case SkColorType::kRGBA_8888_SkColorType:
dst->format = kRGBA_8888_ANPBitmapFormat;
break;
case SkBitmap::kRGB_565_Config:
case SkColorType::kRGB_565_SkColorType:
dst->format = kRGB_565_ANPBitmapFormat;
break;
default:
SkDebugf("SkANP::SetBitmap - unsupported src.config %d\n", src.config());
SkDebugf("SkANP::SetBitmap - unsupported src.colorType %d\n", src.colorType());
return false;
}
dst->width = src.width();
dst->height = src.height();
dst->rowBytes = src.rowBytes();