[Libreoffice-commits] core.git: basebmp/source include/basebmp

Caolán McNamara caolanm at redhat.com
Wed Feb 25 06:57:01 PST 2015


 basebmp/source/bitmapdevice.cxx         |    9 ++++++---
 basebmp/source/debug.cxx                |    2 ++
 include/basebmp/rgbmaskpixelformats.hxx |   13 +++++++++++++
 include/basebmp/scanlineformats.hxx     |    6 +++++-
 4 files changed, 26 insertions(+), 4 deletions(-)

New commits:
commit 4b06c351bd573b81b1b4f4ff3df0fd5d8e68e28c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 25 12:59:38 2015 +0000

    give basebmp a cairo compatible 24 bit surface
    
    where each unit is actually 32bit with unused upper 8bit.
    
    Change-Id: I5c406cebe406d2db6fda73d744dfd22a99b80ba3

diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx
index 34cf2c8..60ad322 100644
--- a/basebmp/source/bitmapdevice.cxx
+++ b/basebmp/source/bitmapdevice.cxx
@@ -107,6 +107,7 @@ static const sal_uInt8 bitsPerPixel[] =
     16, // SIXTEEN_BIT_LSB_TC_MASK
     16, // SIXTEEN_BIT_MSB_TC_MASK
     24, // TWENTYFOUR_BIT_TC_MASK
+    32, // TWENTYFOUR_BIT_TC_MASK_BGRU
     32, // THIRTYTWO_BIT_TC_MASK_BGRA
     32, // THIRTYTWO_BIT_TC_MASK_ARGB
     32, // THIRTYTWO_BIT_TC_MASK_ABGR
@@ -2076,15 +2077,17 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector&
                 aBounds, rSize, nScanlineFormat, nScanlineStride,
                 pFirstScanline, pMem, pPal, rDamage );
 
-
-
         // twentyfour bit formats
         case FORMAT_TWENTYFOUR_BIT_TC_MASK:
             return createRenderer<PixelFormatTraits_BGR24,StdMasks>(
                 aBounds, rSize, nScanlineFormat, nScanlineStride,
                 pFirstScanline, pMem, pPal, rDamage );
 
-
+        // hybrid cairo 24bits used out of 32bit format
+        case FORMAT_THIRTYTWO_BIT_TC_MASK_BGRU:
+            return createRenderer<PixelFormatTraits_BGRU32_8888,StdMasks>(
+                aBounds, rSize, nScanlineFormat, nScanlineStride,
+                pFirstScanline, pMem, pPal, rDamage );
 
         // thirtytwo bit formats
 
diff --git a/basebmp/source/debug.cxx b/basebmp/source/debug.cxx
index d8348ff..3e719cd 100644
--- a/basebmp/source/debug.cxx
+++ b/basebmp/source/debug.cxx
@@ -63,6 +63,8 @@ namespace basebmp
             return "SIXTEEN_BIT_MSB_TC_MASK";
         case FORMAT_TWENTYFOUR_BIT_TC_MASK:
             return "TWENTYFOUR_BIT_TC_MASK";
+        case FORMAT_THIRTYTWO_BIT_TC_MASK_BGRU:
+            return "THIRTYTWO_BIT_TC_MASK_BGRU";
         case FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA:
             return "THIRTYTWO_BIT_TC_MASK_BGRA";
         case FORMAT_THIRTYTWO_BIT_TC_MASK_ARGB:
diff --git a/include/basebmp/rgbmaskpixelformats.hxx b/include/basebmp/rgbmaskpixelformats.hxx
index 696f35a..eaee275 100644
--- a/include/basebmp/rgbmaskpixelformats.hxx
+++ b/include/basebmp/rgbmaskpixelformats.hxx
@@ -334,6 +334,19 @@ typedef PixelFormatTraitsTemplate_RGBMask<
 BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_RGBX32_8888::getter_type,
                                   PixelFormatTraits_RGBX32_8888::setter_type);
 
+// The following hybrid 24bits used out of 32bit was added for Cairo needs
+
+typedef PixelFormatTraitsTemplate_RGBMask<
+    sal_uInt32,
+    0x00000000,
+    0x00FF0000,
+    0x0000FF00,
+    0x000000FF,
+    BASEBMP_TRUECOLORMASK_LSB_SWAP >            PixelFormatTraits_BGRU32_8888;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_BGRU32_8888::getter_type,
+                                  PixelFormatTraits_BGRU32_8888::setter_type);
+
+
 } // namespace basebmp
 
 #endif /* INCLUDED_BASEBMP_RGBMASKPIXELFORMATS_HXX */
diff --git a/include/basebmp/scanlineformats.hxx b/include/basebmp/scanlineformats.hxx
index a5a88aa..8027879 100644
--- a/include/basebmp/scanlineformats.hxx
+++ b/include/basebmp/scanlineformats.hxx
@@ -42,8 +42,12 @@ enum Format
     FORMAT_SIXTEEN_BIT_LSB_TC_MASK,
     FORMAT_SIXTEEN_BIT_MSB_TC_MASK,
     FORMAT_TWENTYFOUR_BIT_TC_MASK,
+    // CAIRO_FORMAT_RGB24, each pixel is a 32-bit quantity, with the upper 8
+    // bits unused. Red, Green, and Blue are stored in the remaining 24 bits in
+    // that order (below U is for unused)
+    FORMAT_THIRTYTWO_BIT_TC_MASK_BGRU,
     // The order of the channels code letters indicates the order of the
-    // channel bytes in memory, I think
+    // channel bytes in memory
     FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA,
     FORMAT_THIRTYTWO_BIT_TC_MASK_ARGB,
     FORMAT_THIRTYTWO_BIT_TC_MASK_ABGR,


More information about the Libreoffice-commits mailing list