Kaydet (Commit) 25d60232 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

vcl: move and split up "Image" related sources to "image" folder

This commit moves all sources related to Image class into its own
"vcl/source/image" folder. Sources containing more classes were
split up into its own source file.

Change-Id: Ie6edcdb0a7caf936bccdc210c31f78bb15667945
üst 6480b4d1
...@@ -283,14 +283,10 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ ...@@ -283,14 +283,10 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/gdi/graph \ vcl/source/gdi/graph \
vcl/source/gdi/graphictools \ vcl/source/gdi/graphictools \
vcl/source/gdi/hatch \ vcl/source/gdi/hatch \
vcl/source/gdi/image \
vcl/source/gdi/imagerepository \
vcl/source/gdi/impanmvw \ vcl/source/gdi/impanmvw \
vcl/source/gdi/impbmp \ vcl/source/gdi/impbmp \
vcl/source/gdi/impfont \ vcl/source/gdi/impfont \
vcl/source/gdi/impgraph \ vcl/source/gdi/impgraph \
vcl/source/gdi/impimage \
vcl/source/gdi/impimagetree \
vcl/source/gdi/impvect \ vcl/source/gdi/impvect \
vcl/source/gdi/jobset \ vcl/source/gdi/jobset \
vcl/source/gdi/lineinfo \ vcl/source/gdi/lineinfo \
...@@ -329,6 +325,15 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ ...@@ -329,6 +325,15 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/bitmap/BitmapTools \ vcl/source/bitmap/BitmapTools \
vcl/source/bitmap/checksum \ vcl/source/bitmap/checksum \
vcl/source/bitmap/CommandImageResolver \ vcl/source/bitmap/CommandImageResolver \
vcl/source/image/Image \
vcl/source/image/ImageArrayData \
vcl/source/image/ImageList \
vcl/source/image/ImageRepository \
vcl/source/image/ImplImage \
vcl/source/image/ImplImageBmp \
vcl/source/image/ImplImageData \
vcl/source/image/ImplImageList \
vcl/source/image/ImplImageTree \
vcl/source/helper/canvasbitmap \ vcl/source/helper/canvasbitmap \
vcl/source/helper/canvastools \ vcl/source/helper/canvastools \
vcl/source/helper/commandinfoprovider \ vcl/source/helper/commandinfoprovider \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <osl/file.hxx>
#include <tools/debug.hxx>
#include <tools/stream.hxx>
#include <tools/rc.h>
#include <tools/rc.hxx>
#include <tools/resmgr.hxx>
#include <vcl/settings.hxx>
#include <vcl/outdev.hxx>
#include <vcl/graph.hxx>
#include <vcl/graphicfilter.hxx>
#include <vcl/svapp.hxx>
#include <vcl/image.hxx>
#include <vcl/imagerepository.hxx>
#include <vcl/implimagetree.hxx>
#include <image.h>
#if OSL_DEBUG_LEVEL > 0
#include <rtl/strbuf.hxx>
#endif
using namespace ::com::sun::star;
Image::Image() :
mpImplData( nullptr )
{
}
Image::Image( const ResId& rResId ) :
mpImplData( nullptr )
{
rResId.SetRT( RSC_IMAGE );
ResMgr* pResMgr = rResId.GetResMgr();
if( pResMgr && pResMgr->GetResource( rResId ) )
{
pResMgr->Increment( sizeof( RSHEADER_TYPE ) );
BitmapEx aBmpEx;
sal_uLong nObjMask = pResMgr->ReadLong();
if( nObjMask & RSC_IMAGE_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( !aBmpEx.IsEmpty() && aBmpEx.GetTransparentType() == TRANSPARENT_NONE )
{
const Color aMaskColor( ResId( static_cast<RSHEADER_TYPE*>(pResMgr->GetClass()), *pResMgr ) );
aBmpEx = BitmapEx( aBmpEx.GetBitmap(), aMaskColor );
}
pResMgr->Increment( ResMgr::GetObjSize( static_cast<RSHEADER_TYPE*>(pResMgr->GetClass()) ) );
}
if( ! aBmpEx.IsEmpty() )
ImplInit( aBmpEx );
}
}
Image::Image( const Image& rImage ) :
mpImplData( rImage.mpImplData )
{
if( mpImplData )
++mpImplData->mnRefCount;
}
Image::Image( const BitmapEx& rBitmapEx ) :
mpImplData( nullptr )
{
ImplInit( rBitmapEx );
}
Image::Image( const Bitmap& rBitmap ) :
mpImplData( nullptr )
{
ImplInit( rBitmap );
}
Image::Image( const Bitmap& rBitmap, const Bitmap& rMaskBitmap ) :
mpImplData( nullptr )
{
const BitmapEx aBmpEx( rBitmap, rMaskBitmap );
ImplInit( aBmpEx );
}
Image::Image( const Bitmap& rBitmap, const Color& rColor ) :
mpImplData( nullptr )
{
const BitmapEx aBmpEx( rBitmap, rColor );
ImplInit( aBmpEx );
}
Image::Image( const uno::Reference< graphic::XGraphic >& rxGraphic ) :
mpImplData( nullptr )
{
const Graphic aGraphic( rxGraphic );
ImplInit( aGraphic.GetBitmapEx() );
}
Image::Image( const OUString &rFileUrl ) :
mpImplData( nullptr )
{
OUString aTmp;
osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp );
Graphic aGraphic;
const OUString aFilterName( IMP_PNG );
if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) )
{
ImplInit( aGraphic.GetBitmapEx() );
}
}
Image::~Image()
{
if( mpImplData && ( 0 == --mpImplData->mnRefCount ) )
delete mpImplData;
}
void Image::ImplInit( const BitmapEx& rBmpEx )
{
if( !rBmpEx.IsEmpty() )
{
mpImplData = new ImplImage;
if( rBmpEx.GetTransparentType() == TRANSPARENT_NONE )
{
mpImplData->meType = IMAGETYPE_BITMAP;
mpImplData->mpData = new Bitmap( rBmpEx.GetBitmap() );
}
else
{
mpImplData->meType = IMAGETYPE_IMAGE;
mpImplData->mpData = new ImplImageData( rBmpEx );
}
}
}
Size Image::GetSizePixel() const
{
Size aRet;
if( mpImplData )
{
switch( mpImplData->meType )
{
case IMAGETYPE_BITMAP:
aRet = static_cast< Bitmap* >( mpImplData->mpData )->GetSizePixel();
break;
case IMAGETYPE_IMAGE:
aRet = static_cast< ImplImageData* >( mpImplData->mpData )->maBmpEx.GetSizePixel();
break;
}
}
return aRet;
}
BitmapEx Image::GetBitmapEx() const
{
BitmapEx aRet;
if( mpImplData )
{
switch( mpImplData->meType )
{
case IMAGETYPE_BITMAP:
aRet = *static_cast< Bitmap* >( mpImplData->mpData );
break;
case IMAGETYPE_IMAGE:
aRet = static_cast< ImplImageData* >( mpImplData->mpData )->maBmpEx;
break;
}
}
return aRet;
}
uno::Reference< graphic::XGraphic > Image::GetXGraphic() const
{
const Graphic aGraphic( GetBitmapEx() );
return aGraphic.GetXGraphic();
}
Image& Image::operator=( const Image& rImage )
{
if( rImage.mpImplData )
++rImage.mpImplData->mnRefCount;
if( mpImplData && ( 0 == --mpImplData->mnRefCount ) )
delete mpImplData;
mpImplData = rImage.mpImplData;
return *this;
}
bool Image::operator==( const Image& rImage ) const
{
bool bRet = false;
if( rImage.mpImplData == mpImplData )
bRet = true;
else if( !rImage.mpImplData || !mpImplData )
bRet = false;
else if( rImage.mpImplData->mpData == mpImplData->mpData )
bRet = true;
else if( rImage.mpImplData->meType == mpImplData->meType )
{
switch( mpImplData->meType )
{
case IMAGETYPE_BITMAP:
bRet = ( *static_cast< Bitmap* >( rImage.mpImplData->mpData ) == *static_cast< Bitmap* >( mpImplData->mpData ) );
break;
case IMAGETYPE_IMAGE:
bRet = static_cast< ImplImageData* >( rImage.mpImplData->mpData )->IsEqual( *static_cast< ImplImageData* >( mpImplData->mpData ) );
break;
default:
bRet = false;
break;
}
}
return bRet;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <vcl/outdev.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/alpha.hxx>
#include <vcl/window.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/virdev.hxx>
#include <vcl/image.hxx>
#include <vcl/settings.hxx>
#include <image.h>
#include <memory>
ImageAryData::ImageAryData( const ImageAryData& rData ) :
maName( rData.maName ),
mnId( rData.mnId ),
maBitmapEx( rData.maBitmapEx )
{
}
ImageAryData::ImageAryData( const OUString &aName,
sal_uInt16 nId, const BitmapEx &aBitmap )
: maName( aName ), mnId( nId ), maBitmapEx( aBitmap )
{
}
ImageAryData::~ImageAryData()
{
}
ImageAryData& ImageAryData::operator=( const ImageAryData& rData )
{
maName = rData.maName;
mnId = rData.mnId;
maBitmapEx = rData.maBitmapEx;
return *this;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -39,241 +39,6 @@ ...@@ -39,241 +39,6 @@
using namespace ::com::sun::star; using namespace ::com::sun::star;
Image::Image() :
mpImplData( nullptr )
{
}
Image::Image( const ResId& rResId ) :
mpImplData( nullptr )
{
rResId.SetRT( RSC_IMAGE );
ResMgr* pResMgr = rResId.GetResMgr();
if( pResMgr && pResMgr->GetResource( rResId ) )
{
pResMgr->Increment( sizeof( RSHEADER_TYPE ) );
BitmapEx aBmpEx;
sal_uLong nObjMask = pResMgr->ReadLong();
if( nObjMask & RSC_IMAGE_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( !aBmpEx.IsEmpty() && aBmpEx.GetTransparentType() == TRANSPARENT_NONE )
{
const Color aMaskColor( ResId( static_cast<RSHEADER_TYPE*>(pResMgr->GetClass()), *pResMgr ) );
aBmpEx = BitmapEx( aBmpEx.GetBitmap(), aMaskColor );
}
pResMgr->Increment( ResMgr::GetObjSize( static_cast<RSHEADER_TYPE*>(pResMgr->GetClass()) ) );
}
if( ! aBmpEx.IsEmpty() )
ImplInit( aBmpEx );
}
}
Image::Image( const Image& rImage ) :
mpImplData( rImage.mpImplData )
{
if( mpImplData )
++mpImplData->mnRefCount;
}
Image::Image( const BitmapEx& rBitmapEx ) :
mpImplData( nullptr )
{
ImplInit( rBitmapEx );
}
Image::Image( const Bitmap& rBitmap ) :
mpImplData( nullptr )
{
ImplInit( rBitmap );
}
Image::Image( const Bitmap& rBitmap, const Bitmap& rMaskBitmap ) :
mpImplData( nullptr )
{
const BitmapEx aBmpEx( rBitmap, rMaskBitmap );
ImplInit( aBmpEx );
}
Image::Image( const Bitmap& rBitmap, const Color& rColor ) :
mpImplData( nullptr )
{
const BitmapEx aBmpEx( rBitmap, rColor );
ImplInit( aBmpEx );
}
Image::Image( const uno::Reference< graphic::XGraphic >& rxGraphic ) :
mpImplData( nullptr )
{
const Graphic aGraphic( rxGraphic );
ImplInit( aGraphic.GetBitmapEx() );
}
Image::Image( const OUString &rFileUrl ) :
mpImplData( nullptr )
{
OUString aTmp;
osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp );
Graphic aGraphic;
const OUString aFilterName( IMP_PNG );
if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) )
{
ImplInit( aGraphic.GetBitmapEx() );
}
}
Image::~Image()
{
if( mpImplData && ( 0 == --mpImplData->mnRefCount ) )
delete mpImplData;
}
void Image::ImplInit( const BitmapEx& rBmpEx )
{
if( !rBmpEx.IsEmpty() )
{
mpImplData = new ImplImage;
if( rBmpEx.GetTransparentType() == TRANSPARENT_NONE )
{
mpImplData->meType = IMAGETYPE_BITMAP;
mpImplData->mpData = new Bitmap( rBmpEx.GetBitmap() );
}
else
{
mpImplData->meType = IMAGETYPE_IMAGE;
mpImplData->mpData = new ImplImageData( rBmpEx );
}
}
}
Size Image::GetSizePixel() const
{
Size aRet;
if( mpImplData )
{
switch( mpImplData->meType )
{
case IMAGETYPE_BITMAP:
aRet = static_cast< Bitmap* >( mpImplData->mpData )->GetSizePixel();
break;
case IMAGETYPE_IMAGE:
aRet = static_cast< ImplImageData* >( mpImplData->mpData )->maBmpEx.GetSizePixel();
break;
}
}
return aRet;
}
BitmapEx Image::GetBitmapEx() const
{
BitmapEx aRet;
if( mpImplData )
{
switch( mpImplData->meType )
{
case IMAGETYPE_BITMAP:
aRet = *static_cast< Bitmap* >( mpImplData->mpData );
break;
case IMAGETYPE_IMAGE:
aRet = static_cast< ImplImageData* >( mpImplData->mpData )->maBmpEx;
break;
}
}
return aRet;
}
uno::Reference< graphic::XGraphic > Image::GetXGraphic() const
{
const Graphic aGraphic( GetBitmapEx() );
return aGraphic.GetXGraphic();
}
Image& Image::operator=( const Image& rImage )
{
if( rImage.mpImplData )
++rImage.mpImplData->mnRefCount;
if( mpImplData && ( 0 == --mpImplData->mnRefCount ) )
delete mpImplData;
mpImplData = rImage.mpImplData;
return *this;
}
bool Image::operator==( const Image& rImage ) const
{
bool bRet = false;
if( rImage.mpImplData == mpImplData )
bRet = true;
else if( !rImage.mpImplData || !mpImplData )
bRet = false;
else if( rImage.mpImplData->mpData == mpImplData->mpData )
bRet = true;
else if( rImage.mpImplData->meType == mpImplData->meType )
{
switch( mpImplData->meType )
{
case IMAGETYPE_BITMAP:
bRet = ( *static_cast< Bitmap* >( rImage.mpImplData->mpData ) == *static_cast< Bitmap* >( mpImplData->mpData ) );
break;
case IMAGETYPE_IMAGE:
bRet = static_cast< ImplImageData* >( rImage.mpImplData->mpData )->IsEqual( *static_cast< ImplImageData* >( mpImplData->mpData ) );
break;
default:
bRet = false;
break;
}
}
return bRet;
}
ImageList::ImageList( sal_uInt16 nInit, sal_uInt16 nGrow ) : ImageList::ImageList( sal_uInt16 nInit, sal_uInt16 nGrow ) :
mpImplData( nullptr ), mpImplData( nullptr ),
mnInitSize( nInit ), mnInitSize( nInit ),
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <vcl/outdev.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/alpha.hxx>
#include <vcl/window.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/virdev.hxx>
#include <vcl/image.hxx>
#include <vcl/settings.hxx>
#include <image.h>
#include <memory>
ImplImage::ImplImage()
: mnRefCount(1)
, mpData(nullptr)
, meType(IMAGETYPE_BITMAP)
{
}
ImplImage::~ImplImage()
{
switch( meType )
{
case IMAGETYPE_BITMAP:
delete static_cast< Bitmap* >( mpData );
break;
case IMAGETYPE_IMAGE:
delete static_cast< ImplImageData* >( mpData );
break;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -32,112 +32,6 @@ ...@@ -32,112 +32,6 @@
#define IMPSYSIMAGEITEM_MASK ( 0x01 ) #define IMPSYSIMAGEITEM_MASK ( 0x01 )
#define IMPSYSIMAGEITEM_ALPHA ( 0x02 ) #define IMPSYSIMAGEITEM_ALPHA ( 0x02 )
ImageAryData::ImageAryData( const ImageAryData& rData ) :
maName( rData.maName ),
mnId( rData.mnId ),
maBitmapEx( rData.maBitmapEx )
{
}
ImageAryData::ImageAryData( const OUString &aName,
sal_uInt16 nId, const BitmapEx &aBitmap )
: maName( aName ), mnId( nId ), maBitmapEx( aBitmap )
{
}
ImageAryData::~ImageAryData()
{
}
ImageAryData& ImageAryData::operator=( const ImageAryData& rData )
{
maName = rData.maName;
mnId = rData.mnId;
maBitmapEx = rData.maBitmapEx;
return *this;
}
ImplImageList::ImplImageList()
: mnRefCount(1)
{
}
ImplImageList::ImplImageList( const ImplImageList &aSrc )
: maPrefix(aSrc.maPrefix)
, maImageSize(aSrc.maImageSize)
, mnRefCount(1)
{
maImages.reserve( aSrc.maImages.size() );
for ( ImageAryDataVec::const_iterator aIt = aSrc.maImages.begin(), aEnd = aSrc.maImages.end(); aIt != aEnd; ++aIt )
{
ImageAryData* pAryData = new ImageAryData( **aIt );
maImages.push_back( pAryData );
if( !pAryData->maName.isEmpty() )
maNameHash [ pAryData->maName ] = pAryData;
}
}
ImplImageList::~ImplImageList()
{
for ( ImageAryDataVec::iterator aIt = maImages.begin(), aEnd = maImages.end(); aIt != aEnd; ++aIt )
delete *aIt;
}
void ImplImageList::AddImage( const OUString &aName,
sal_uInt16 nId, const BitmapEx &aBitmapEx )
{
ImageAryData *pImg = new ImageAryData( aName, nId, aBitmapEx );
maImages.push_back( pImg );
if( !aName.isEmpty() )
maNameHash [ aName ] = pImg;
}
void ImplImageList::RemoveImage( sal_uInt16 nPos )
{
ImageAryData *pImg = maImages[ nPos ];
if( !pImg->maName.isEmpty() )
maNameHash.erase( pImg->maName );
maImages.erase( maImages.begin() + nPos );
}
ImplImageData::ImplImageData( const BitmapEx& rBmpEx ) :
mpImageBitmap( nullptr ),
maBmpEx( rBmpEx )
{
}
ImplImageData::~ImplImageData()
{
delete mpImageBitmap;
}
bool ImplImageData::IsEqual( const ImplImageData& rData )
{
return( maBmpEx == rData.maBmpEx );
}
ImplImage::ImplImage()
: mnRefCount(1)
, mpData(nullptr)
, meType(IMAGETYPE_BITMAP)
{
}
ImplImage::~ImplImage()
{
switch( meType )
{
case IMAGETYPE_BITMAP:
delete static_cast< Bitmap* >( mpData );
break;
case IMAGETYPE_IMAGE:
delete static_cast< ImplImageData* >( mpData );
break;
}
}
ImplImageBmp::ImplImageBmp() ImplImageBmp::ImplImageBmp()
: maBitmapChecksum(0) : maBitmapChecksum(0)
, mpDisplayBmp(nullptr) , mpDisplayBmp(nullptr)
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <vcl/outdev.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/alpha.hxx>
#include <vcl/window.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/virdev.hxx>
#include <vcl/image.hxx>
#include <vcl/settings.hxx>
#include <image.h>
#include <memory>
ImplImageData::ImplImageData( const BitmapEx& rBmpEx ) :
mpImageBitmap( nullptr ),
maBmpEx( rBmpEx )
{
}
ImplImageData::~ImplImageData()
{
delete mpImageBitmap;
}
bool ImplImageData::IsEqual( const ImplImageData& rData )
{
return( maBmpEx == rData.maBmpEx );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <vcl/outdev.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/alpha.hxx>
#include <vcl/window.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/virdev.hxx>
#include <vcl/image.hxx>
#include <vcl/settings.hxx>
#include <image.h>
#include <memory>
ImplImageList::ImplImageList()
: mnRefCount(1)
{
}
ImplImageList::ImplImageList( const ImplImageList &aSrc )
: maPrefix(aSrc.maPrefix)
, maImageSize(aSrc.maImageSize)
, mnRefCount(1)
{
maImages.reserve( aSrc.maImages.size() );
for ( ImageAryDataVec::const_iterator aIt = aSrc.maImages.begin(), aEnd = aSrc.maImages.end(); aIt != aEnd; ++aIt )
{
ImageAryData* pAryData = new ImageAryData( **aIt );
maImages.push_back( pAryData );
if( !pAryData->maName.isEmpty() )
maNameHash [ pAryData->maName ] = pAryData;
}
}
ImplImageList::~ImplImageList()
{
for ( ImageAryDataVec::iterator aIt = maImages.begin(), aEnd = maImages.end(); aIt != aEnd; ++aIt )
delete *aIt;
}
void ImplImageList::AddImage( const OUString &aName,
sal_uInt16 nId, const BitmapEx &aBitmapEx )
{
ImageAryData *pImg = new ImageAryData( aName, nId, aBitmapEx );
maImages.push_back( pImg );
if( !aName.isEmpty() )
maNameHash [ aName ] = pImg;
}
void ImplImageList::RemoveImage( sal_uInt16 nPos )
{
ImageAryData *pImg = maImages[ nPos ];
if( !pImg->maName.isEmpty() )
maNameHash.erase( pImg->maName );
maImages.erase( maImages.begin() + nPos );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment