Bug 839383 - part 3 - inline AssignSurfaceParametersFromFormat into its only caller; r=jrmuizel
authorNathan Froyd <froydnj@mozilla.com>
Tue, 12 Mar 2013 17:02:19 -0400
changeset 127122 b06fa2317215
parent 127121 c2715e049b3c
child 127123 88288ea65ef8
push id117
push usertomi.aarnio@nokia.com
push dateWed, 03 Apr 2013 12:07:07 +0000
reviewersjrmuizel
bugs839383
milestone23.0a1
Bug 839383 - part 3 - inline AssignSurfaceParametersFromFormat into its only caller; r=jrmuizel
gfx/2d/SourceSurfaceCG.cpp
--- a/gfx/2d/SourceSurfaceCG.cpp
+++ b/gfx/2d/SourceSurfaceCG.cpp
@@ -41,64 +41,53 @@ SourceSurfaceCG::GetDataSurface()
     new DataSourceSurfaceCG(mImage);
   return dataSurf;
 }
 
 static void releaseCallback(void *info, const void *data, size_t size) {
   free(info);
 }
 
-static void
-AssignSurfaceParametersFromFormat(SurfaceFormat aFormat,
-                                  CGColorSpaceRef &aColorSpace,
-                                  CGBitmapInfo &aBitinfo,
-                                  int &aBitsPerComponent,
-                                  int &aBitsPerPixel)
-{
-  switch (aFormat) {
-    case FORMAT_B8G8R8A8:
-      aColorSpace = CGColorSpaceCreateDeviceRGB();
-      aBitinfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
-      aBitsPerComponent = 8;
-      aBitsPerPixel = 32;
-      break;
-
-    case FORMAT_B8G8R8X8:
-      aColorSpace = CGColorSpaceCreateDeviceRGB();
-      aBitinfo = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host;
-      aBitsPerComponent = 8;
-      aBitsPerPixel = 32;
-      break;
-
-    case FORMAT_A8:
-      // XXX: why don't we set a colorspace here?
-      aBitsPerComponent = 8;
-      aBitsPerPixel = 8;
-      break;
-
-    default:
-      MOZ_CRASH();
-  }
-}
-
 static CGImageRef
 CreateCGImage(void *aInfo,
               const void *aData,
               const IntSize &aSize,
               int32_t aStride,
               SurfaceFormat aFormat)
 {
   //XXX: we should avoid creating this colorspace everytime
   CGColorSpaceRef colorSpace = nullptr;
   CGBitmapInfo bitinfo = 0;
   int bitsPerComponent = 0;
   int bitsPerPixel = 0;
 
-  AssignSurfaceParametersFromFormat(aFormat, colorSpace, bitinfo,
-                                    bitsPerComponent, bitsPerPixel);
+  switch (aFormat) {
+    case FORMAT_B8G8R8A8:
+      colorSpace = CGColorSpaceCreateDeviceRGB();
+      bitinfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
+      bitsPerComponent = 8;
+      bitsPerPixel = 32;
+      break;
+
+    case FORMAT_B8G8R8X8:
+      colorSpace = CGColorSpaceCreateDeviceRGB();
+      bitinfo = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host;
+      bitsPerComponent = 8;
+      bitsPerPixel = 32;
+      break;
+
+    case FORMAT_A8:
+      // XXX: why don't we set a colorspace here?
+      bitsPerComponent = 8;
+      bitsPerPixel = 8;
+      break;
+
+    default:
+      MOZ_CRASH();
+  }
 
   CGDataProviderRef dataProvider = CGDataProviderCreateWithData(aInfo,
                                                                 aData,
                                                                 aSize.height * aStride,
                                                                 releaseCallback);
 
   CGImageRef image;
   if (aFormat == FORMAT_A8) {