Bug 1046921 - Remove usage of legacy Skia API, SK_SUPPORT_LEGACY_BITMAP_CONFIG. r=gw280
authorWalter Litwinczyk <wlitwinczyk@mozilla.com>
Fri, 15 Aug 2014 10:02:46 -0700
changeset 223082 19a6cce2810772571e8db1f479a4999a99858c0a
parent 223081 bbafd7462ab4d48934d7d7e3a83823b20e1b7210
child 223083 ff9ae7c8bada325dfd73818e6107136d1086da3a
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw280
bugs1046921
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1046921 - Remove usage of legacy Skia API, SK_SUPPORT_LEGACY_BITMAP_CONFIG. r=gw280
gfx/2d/HelpersSkia.h
gfx/skia/trunk/include/config/SkUserConfig.h
other-licenses/skia-npapi/SkANP.cpp
--- a/gfx/2d/HelpersSkia.h
+++ b/gfx/2d/HelpersSkia.h
@@ -14,51 +14,16 @@
 #include "skia/GrTypes.h"
 #endif
 #include "mozilla/Assertions.h"
 #include <vector>
 
 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)
 {
   switch (format)
   {
     case SurfaceFormat::B8G8R8A8:
       return kBGRA_8888_SkColorType;
     case SurfaceFormat::B8G8R8X8:
--- a/gfx/skia/trunk/include/config/SkUserConfig.h
+++ b/gfx/skia/trunk/include/config/SkUserConfig.h
@@ -201,12 +201,11 @@
 #else
 #  define SK_BARRIERS_PLATFORM_H "skia/SkBarriers_x86.h"
 #endif
 
 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0
 
 #define SK_SUPPORT_LEGACY_GETDEVICE
 #define SK_SUPPORT_LEGACY_GETTOPDEVICE
-#define SK_SUPPORT_LEGACY_BITMAP_CONFIG
 #define SK_IGNORE_ETC1_SUPPORT
 
 #endif
--- a/other-licenses/skia-npapi/SkANP.cpp
+++ b/other-licenses/skia-npapi/SkANP.cpp
@@ -52,52 +52,52 @@ ANPRectF* SkANP::SetRect(ANPRectF* dst, 
     dst->top = SkScalarToFloat(src.fTop);
     dst->right = SkScalarToFloat(src.fRight);
     dst->bottom = SkScalarToFloat(src.fBottom);
     return dst;
 }
 
 SkBitmap* SkANP::SetBitmap(SkBitmap* dst, const ANPBitmap& src) {
     SkColorType colorType = kUnknown_SkColorType;
-    
+
     switch (src.format) {
         case kRGBA_8888_ANPBitmapFormat:
             colorType = kRGBA_8888_SkColorType;
             break;
         case kRGB_565_ANPBitmapFormat:
             colorType = kRGB_565_SkColorType;
             break;
         default:
             break;
     }
-    
+
     SkImageInfo info = SkImageInfo::Make(src.width, src.height, colorType, kPremul_SkAlphaType);
     dst->setInfo(info, src.rowBytes);
     dst->setPixels(src.baseAddr);
     return dst;
 }
 
 bool SkANP::SetBitmap(ANPBitmap* dst, const SkBitmap& src) {
     if (!(dst->baseAddr = src.getPixels())) {
         SkDebugf("SkANP::SetBitmap - getPixels() returned null\n");
         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();
     return true;
 }
 
 void SkANP::InitEvent(ANPEvent* event, ANPEventType et) {
     event->inSize = sizeof(ANPEvent);