diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-18 10:02:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-18 11:44:00 +0100 |
commit | 1e9255303db01786f403253a1487cee0af56525d (patch) | |
tree | 346f00391833e538b00dd015aa8db5d8a57c1a64 /vcl | |
parent | fea7b531a4c9e8326a644cccc26325b16585675a (diff) |
make internals of ::Color private
was made public in
commit d487d6e082bc7ce652217578ffd37397a59cc3ca
rework Color to have R,G,B,A public variables
but it's best to keep them private since we're changing the internal
representation - and there is surprisingly little that depends
on accessing the internals anyhow.
Change-Id: I234d80fb33105f7bf5b865fb7c8194d893b09878
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109508
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/metaact.cxx | 44 | ||||
-rw-r--r-- | vcl/source/gdi/wall.cxx | 6 |
2 files changed, 32 insertions, 18 deletions
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 11100101f2eb..5ae914e44091 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -271,6 +271,18 @@ rtl::Reference<MetaAction> MetaAction::ReadMetaAction( SvStream& rIStm, ImplMeta return pAction; } +void MetaAction::ReadColor(SvStream& rIStm, ::Color& rColor) +{ + sal_uInt32 nTmp; + rIStm.ReadUInt32(nTmp); + rColor = ::Color(ColorTransparency, nTmp); +} + +void MetaAction::WriteColor(SvStream& rIStm, ::Color aColor) +{ + rIStm.WriteUInt32(static_cast<sal_uInt32>(aColor)); +} + MetaPixelAction::MetaPixelAction() : MetaAction(MetaActionType::PIXEL) {} @@ -310,7 +322,7 @@ void MetaPixelAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) VersionCompatWrite aCompat(rOStm, 1); TypeSerializer aSerializer(rOStm); aSerializer.writePoint(maPt); - rOStm.WriteUInt32(maColor.mValue); + WriteColor(rOStm, maColor); } void MetaPixelAction::Read( SvStream& rIStm, ImplMetaReadData* ) @@ -318,7 +330,7 @@ void MetaPixelAction::Read( SvStream& rIStm, ImplMetaReadData* ) VersionCompatRead aCompat(rIStm); TypeSerializer aSerializer(rIStm); aSerializer.readPoint(maPt); - rIStm.ReadUInt32(maColor.mValue); + ReadColor(rIStm, maColor); } MetaPointAction::MetaPointAction() : @@ -1981,7 +1993,7 @@ void MetaMaskScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); WriteDIB(maBmp, rOStm, false, true); - rOStm.WriteUInt32(maColor.mValue); + WriteColor(rOStm, maColor); TypeSerializer aSerializer(rOStm); aSerializer.writePoint(maDstPt); aSerializer.writeSize(maDstSz); @@ -1994,7 +2006,7 @@ void MetaMaskScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* ) { VersionCompatRead aCompat(rIStm); ReadDIB(maBmp, rIStm, true); - rIStm.ReadUInt32(maColor.mValue); + ReadColor(rIStm, maColor); TypeSerializer aSerializer(rIStm); aSerializer.readPoint(maDstPt); aSerializer.readSize(maDstSz); @@ -2437,14 +2449,14 @@ void MetaLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); - rOStm.WriteUInt32(maColor.mValue); + WriteColor(rOStm, maColor); rOStm.WriteBool( mbSet ); } void MetaLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { VersionCompatRead aCompat(rIStm); - rIStm.ReadUInt32(maColor.mValue); + ReadColor(rIStm, maColor); rIStm.ReadCharAsBool( mbSet ); } @@ -2479,14 +2491,14 @@ void MetaFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); - rOStm.WriteUInt32(maColor.mValue); + WriteColor(rOStm, maColor); rOStm.WriteBool( mbSet ); } void MetaFillColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { VersionCompatRead aCompat(rIStm); - rIStm.ReadUInt32(maColor.mValue); + ReadColor(rIStm, maColor); rIStm.ReadCharAsBool( mbSet ); } @@ -2516,13 +2528,13 @@ void MetaTextColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); - rOStm.WriteUInt32(maColor.mValue); + WriteColor(rOStm, maColor); } void MetaTextColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { VersionCompatRead aCompat(rIStm); - rIStm.ReadUInt32(maColor.mValue); + ReadColor(rIStm, maColor); } MetaTextFillColorAction::MetaTextFillColorAction() : @@ -2556,14 +2568,14 @@ void MetaTextFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); - rOStm.WriteUInt32(maColor.mValue); + WriteColor(rOStm, maColor); rOStm.WriteBool( mbSet ); } void MetaTextFillColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { VersionCompatRead aCompat(rIStm); - rIStm.ReadUInt32(maColor.mValue); + ReadColor(rIStm, maColor); rIStm.ReadCharAsBool( mbSet ); } @@ -2598,14 +2610,14 @@ void MetaTextLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); - rOStm.WriteUInt32(maColor.mValue); + WriteColor(rOStm, maColor); rOStm.WriteBool( mbSet ); } void MetaTextLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { VersionCompatRead aCompat(rIStm); - rIStm.ReadUInt32(maColor.mValue); + ReadColor(rIStm, maColor); rIStm.ReadCharAsBool( mbSet ); } @@ -2640,14 +2652,14 @@ void MetaOverlineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); - rOStm.WriteUInt32(maColor.mValue); + WriteColor(rOStm, maColor); rOStm.WriteBool( mbSet ); } void MetaOverlineColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) { VersionCompatRead aCompat(rIStm); - rIStm.ReadUInt32(maColor.mValue); + ReadColor(rIStm, maColor); rIStm.ReadCharAsBool( mbSet ); } diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx index c6e07afa37ca..db2d0804d747 100644 --- a/vcl/source/gdi/wall.cxx +++ b/vcl/source/gdi/wall.cxx @@ -96,7 +96,9 @@ SvStream& ReadImplWallpaper( SvStream& rIStm, ImplWallpaper& rImplWallpaper ) // version 3 (new color format) if( aCompat.GetVersion() >= 3 ) { - rIStm.ReadUInt32(rImplWallpaper.maColor.mValue); + sal_uInt32 nTmp; + rIStm.ReadUInt32(nTmp); + rImplWallpaper.maColor = ::Color(ColorTransparency, nTmp); } } @@ -134,7 +136,7 @@ SvStream& WriteImplWallpaper( SvStream& rOStm, const ImplWallpaper& rImplWallpap WriteDIBBitmapEx(*rImplWallpaper.mpBitmap, rOStm); // version 3 (new color format) - rOStm.WriteUInt32(rImplWallpaper.maColor.mValue); + rOStm.WriteUInt32(static_cast<sal_uInt32>(rImplWallpaper.maColor)); return rOStm; } |