diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-01-20 16:36:10 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-01-20 16:39:28 +0000 |
commit | d3b94aae205597fdd369989d76a60420ae9b8ab1 (patch) | |
tree | 0f945e20d0b668af1dc50e3aef2e069379a6b451 /vcl | |
parent | 55ff58a4084acbdd031ae1d79f0b740e91b15fd0 (diff) |
every ImplImage has a BitmapEx
Change-Id: I02561cfdff57eab7684d68c98ba2b3d83847c9c5
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/image.h | 10 | ||||
-rw-r--r-- | vcl/source/image/Image.cxx | 26 | ||||
-rw-r--r-- | vcl/source/image/ImplImage.cxx | 8 |
3 files changed, 16 insertions, 28 deletions
diff --git a/vcl/inc/image.h b/vcl/inc/image.h index 72a7f3233775..873fc98432dd 100644 --- a/vcl/inc/image.h +++ b/vcl/inc/image.h @@ -28,16 +28,10 @@ struct ImplImage { BitmapChecksum maBitmapChecksum; - - std::unique_ptr<BitmapEx> mpBitmapEx; + BitmapEx maBitmapEx; BitmapEx maDisabledBitmapEx; - ImplImage(); - ~ImplImage(); - -private: - ImplImage(const ImplImage&) = delete; - void operator=(const ImplImage&) = delete; + ImplImage(const BitmapEx& rBitmapEx); }; #endif // INCLUDED_VCL_INC_IMAGE_H diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx index bc663fbbc525..d873d3eeeb86 100644 --- a/vcl/source/image/Image.cxx +++ b/vcl/source/image/Image.cxx @@ -82,8 +82,7 @@ void Image::ImplInit(const BitmapEx& rBitmapEx) { if (!rBitmapEx.IsEmpty()) { - mpImplData.reset(new ImplImage); - mpImplData->mpBitmapEx.reset(new BitmapEx(rBitmapEx)); + mpImplData.reset(new ImplImage(rBitmapEx)); } } @@ -91,9 +90,9 @@ Size Image::GetSizePixel() const { Size aRet; - if (mpImplData && mpImplData->mpBitmapEx) + if (mpImplData) { - aRet = mpImplData->mpBitmapEx->GetSizePixel(); + aRet = mpImplData->maBitmapEx.GetSizePixel(); } return aRet; @@ -103,9 +102,9 @@ BitmapEx Image::GetBitmapEx() const { BitmapEx aRet; - if (mpImplData && mpImplData->mpBitmapEx) + if (mpImplData) { - aRet = BitmapEx(*mpImplData->mpBitmapEx); + aRet = mpImplData->maBitmapEx; } return aRet; @@ -127,29 +126,28 @@ bool Image::operator==(const Image& rImage) const else if (!rImage.mpImplData || !mpImplData) bRet = false; else - bRet = *rImage.mpImplData->mpBitmapEx == *mpImplData->mpBitmapEx; + bRet = rImage.mpImplData->maBitmapEx == mpImplData->maBitmapEx; return bRet; } void Image::Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize) { - if (!mpImplData || !mpImplData->mpBitmapEx || - (!pOutDev->IsDeviceOutputNecessary() && pOutDev->GetConnectMetaFile() == nullptr)) + if (!mpImplData || (!pOutDev->IsDeviceOutputNecessary() && pOutDev->GetConnectMetaFile() == nullptr)) return; const Point aSrcPos(0, 0); - Size aBitmapSizePixel = mpImplData->mpBitmapEx->GetSizePixel(); + Size aBitmapSizePixel = mpImplData->maBitmapEx.GetSizePixel(); Size aOutSize = pSize ? *pSize : pOutDev->PixelToLogic(aBitmapSizePixel); if (nStyle & DrawImageFlags::Disable) { - BitmapChecksum aChecksum = mpImplData->mpBitmapEx->GetChecksum(); + BitmapChecksum aChecksum = mpImplData->maBitmapEx.GetChecksum(); if (mpImplData->maBitmapChecksum != aChecksum) { mpImplData->maBitmapChecksum = aChecksum; - mpImplData->maDisabledBitmapEx = BitmapProcessor::createDisabledImage(*mpImplData->mpBitmapEx); + mpImplData->maDisabledBitmapEx = BitmapProcessor::createDisabledImage(mpImplData->maBitmapEx); } pOutDev->DrawBitmapEx(rPos, aOutSize, aSrcPos, aBitmapSizePixel, mpImplData->maDisabledBitmapEx); } @@ -158,7 +156,7 @@ void Image::Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle if (nStyle & (DrawImageFlags::ColorTransform | DrawImageFlags::Highlight | DrawImageFlags::Deactive | DrawImageFlags::SemiTransparent)) { - BitmapEx aTempBitmapEx(*mpImplData->mpBitmapEx); + BitmapEx aTempBitmapEx(mpImplData->maBitmapEx); if (nStyle & (DrawImageFlags::Highlight | DrawImageFlags::Deactive)) { @@ -190,7 +188,7 @@ void Image::Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle } else { - pOutDev->DrawBitmapEx(rPos, aOutSize, aSrcPos, mpImplData->mpBitmapEx->GetSizePixel(), *mpImplData->mpBitmapEx); + pOutDev->DrawBitmapEx(rPos, aOutSize, aSrcPos, mpImplData->maBitmapEx.GetSizePixel(), mpImplData->maBitmapEx); } } } diff --git a/vcl/source/image/ImplImage.cxx b/vcl/source/image/ImplImage.cxx index ad4312024f92..82a2099e8813 100644 --- a/vcl/source/image/ImplImage.cxx +++ b/vcl/source/image/ImplImage.cxx @@ -29,15 +29,11 @@ #include <image.h> #include <memory> -ImplImage::ImplImage() +ImplImage::ImplImage(const BitmapEx &rBitmapEx) : maBitmapChecksum(0) - , mpBitmapEx() + , maBitmapEx(rBitmapEx) , maDisabledBitmapEx() { } -ImplImage::~ImplImage() -{ -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |