[Libreoffice-commits] core.git: include/tools rsc/source vcl/source
Noel Grandin
noelgrandin at gmail.com
Thu May 26 07:25:57 UTC 2016
include/tools/rc.h | 10 +++++++---
rsc/source/parser/rscicpx.cxx | 6 ++----
vcl/source/image/Image.cxx | 19 ++++---------------
3 files changed, 13 insertions(+), 22 deletions(-)
New commits:
commit 702eb3d389f7525674f0743a46c987bc981394f3
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Wed May 25 17:56:19 2016 +0200
convert RSC_IMAGE to scoped enum
and drop unused RSC_IMAGE_IMAGEBITMAP
Change-Id: I6c38e5e8e17d288ab525bbef368ebbc7e860e154
Reviewed-on: https://gerrit.libreoffice.org/25458
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/tools/rc.h b/include/tools/rc.h
index 6bfafde..cd09254 100644
--- a/include/tools/rc.h
+++ b/include/tools/rc.h
@@ -154,9 +154,13 @@ namespace o3tl {
}
// For "Image":
-#define RSC_IMAGE_IMAGEBITMAP 0x01
-#define RSC_IMAGE_MASKBITMAP 0x02
-#define RSC_IMAGE_MASKCOLOR 0x04
+enum class RscImageFlags {
+ ImageBitmap = 0x01,
+ MaskColor = 0x04
+};
+namespace o3tl {
+ template<> struct typed_flags<RscImageFlags> : is_typed_flags<RscImageFlags, 0x05> {};
+}
// For "ImageList":
enum class RscImageListFlags {
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index 1ec99f2..4e0b2fc 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -152,12 +152,10 @@ RscTop * RscTypCont::InitClassImage( RscTop * pSuper, RscTop * pClassBitmap,
// initialize variables
nId = aNmTb.Put( "ImageBitmap", VARNAME );
- pClassImage->SetVariable( nId, pClassBitmap, nullptr, 0, RSC_IMAGE_IMAGEBITMAP );
- nId = aNmTb.Put( "MaskBitmap", VARNAME );
- pClassImage->SetVariable( nId, pClassBitmap, nullptr, 0, RSC_IMAGE_MASKBITMAP );
+ pClassImage->SetVariable( nId, pClassBitmap, nullptr, 0, (sal_uInt32)RscImageFlags::ImageBitmap );
nId = aNmTb.Put( "MaskColor", VARNAME );
pClassImage->SetVariable( nId, pClassColor, nullptr,
- VAR_SVDYNAMIC, RSC_IMAGE_MASKCOLOR );
+ VAR_SVDYNAMIC, (sal_uInt32)RscImageFlags::MaskColor );
return pClassImage;
}
diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx
index 607fed2..417c3fe 100644
--- a/vcl/source/image/Image.cxx
+++ b/vcl/source/image/Image.cxx
@@ -56,27 +56,16 @@ Image::Image( const ResId& rResId ) :
{
pResMgr->Increment( sizeof( RSHEADER_TYPE ) );
- BitmapEx aBmpEx;
- sal_uLong nObjMask = pResMgr->ReadLong();
+ BitmapEx aBmpEx;
+ RscImageFlags nObjMask = (RscImageFlags)pResMgr->ReadLong();
- if( nObjMask & RSC_IMAGE_IMAGEBITMAP )
+ if( nObjMask & RscImageFlags::ImageBitmap )
{
aBmpEx = BitmapEx( ResId( static_cast<RSHEADER_TYPE*>(pResMgr->GetClass()), *pResMgr ) );
pResMgr->Increment( ResMgr::GetObjSize( static_cast<RSHEADER_TYPE*>(pResMgr->GetClass()) ) );
}
- if( nObjMask & RSC_IMAGE_MASKBITMAP )
- {
- if( !aBmpEx.IsEmpty() && aBmpEx.GetTransparentType() == TRANSPARENT_NONE )
- {
- const Bitmap aMaskBitmap( ResId( static_cast<RSHEADER_TYPE*>(pResMgr->GetClass()), *pResMgr ) );
- aBmpEx = BitmapEx( aBmpEx.GetBitmap(), aMaskBitmap );
- }
-
- pResMgr->Increment( ResMgr::GetObjSize( static_cast<RSHEADER_TYPE*>(pResMgr->GetClass()) ) );
- }
-
- if( nObjMask & RSC_IMAGE_MASKCOLOR )
+ if( nObjMask & RscImageFlags::MaskColor )
{
if( !aBmpEx.IsEmpty() && aBmpEx.GetTransparentType() == TRANSPARENT_NONE )
{
More information about the Libreoffice-commits
mailing list