summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-02-25 12:59:38 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-02-25 14:56:25 +0000
commit4b06c351bd573b81b1b4f4ff3df0fd5d8e68e28c (patch)
tree59df01f2f683cb4b5a13fecb7737b6cc9979baf9
parent923a8604aa631dbfb9c62f8fa9bef71dc8addcef (diff)
give basebmp a cairo compatible 24 bit surface
where each unit is actually 32bit with unused upper 8bit. Change-Id: I5c406cebe406d2db6fda73d744dfd22a99b80ba3
-rw-r--r--basebmp/source/bitmapdevice.cxx9
-rw-r--r--basebmp/source/debug.cxx2
-rw-r--r--include/basebmp/rgbmaskpixelformats.hxx13
-rw-r--r--include/basebmp/scanlineformats.hxx6
4 files changed, 26 insertions, 4 deletions
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx
index 34cf2c882ff8..60ad322fc1cb 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 d8348ffd379b..3e719cd77825 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 696f35aac846..eaee275554c2 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 a5a88aa5d19c..80278792241a 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,