Files
libreoffice/vcl/source/gdi/impbmp.cxx
Kurt Zenker 1fc2f2275a INTEGRATION: CWS presfixes09 (1.8.60); FILE MERGED
2006/11/15 12:43:47 thb 1.8.60.1: #140456# en passant, removed obsolete RMBitmap member at various places
2006-12-13 14:01:44 +00:00

147 lines
4.2 KiB
C++

/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: impbmp.cxx,v $
*
* $Revision: 1.9 $
*
* last change: $Author: kz $ $Date: 2006-12-13 15:01:44 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
#ifndef _SV_SVSYS_HXX
#include <svsys.h>
#endif
#ifndef _SV_SALBMP_HXX
#include <salbmp.hxx>
#endif
#ifndef _DEBUG_HXX
#include <tools/debug.hxx>
#endif
#include <impbmp.hxx>
#include <bitmap.hxx>
#include <svdata.hxx>
#include <salinst.hxx>
// --------------
// - ImpBitmap -
// --------------
ImpBitmap::ImpBitmap() :
mnRefCount ( 1UL ),
mnChecksum ( 0UL ),
mpSalBitmap ( ImplGetSVData()->mpDefInst->CreateSalBitmap() ),
maSourceSize( 0, 0 )
{
}
// -----------------------------------------------------------------------
ImpBitmap::~ImpBitmap()
{
delete mpSalBitmap;
}
// -----------------------------------------------------------------------
void ImpBitmap::ImplSetSalBitmap( SalBitmap* pBitmap )
{
delete mpSalBitmap, mpSalBitmap = pBitmap;
}
// -----------------------------------------------------------------------
BOOL ImpBitmap::ImplCreate( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal )
{
maSourceSize = rSize;
return mpSalBitmap->Create( rSize, nBitCount, rPal );
}
// -----------------------------------------------------------------------
BOOL ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap )
{
maSourceSize = rImpBitmap.maSourceSize;
mnChecksum = rImpBitmap.mnChecksum;
return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap );
}
// -----------------------------------------------------------------------
BOOL ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, SalGraphics* pGraphics )
{
return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, pGraphics );
}
// -----------------------------------------------------------------------
BOOL ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, USHORT nNewBitCount )
{
return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, nNewBitCount );
}
// -----------------------------------------------------------------------
void ImpBitmap::ImplDestroy()
{
mpSalBitmap->Destroy();
}
// -----------------------------------------------------------------------
Size ImpBitmap::ImplGetSize() const
{
return mpSalBitmap->GetSize();
}
// -----------------------------------------------------------------------
USHORT ImpBitmap::ImplGetBitCount() const
{
USHORT nBitCount = mpSalBitmap->GetBitCount();
return( ( nBitCount <= 1 ) ? 1 : ( nBitCount <= 4 ) ? 4 : ( nBitCount <= 8 ) ? 8 : 24 );
}
// -----------------------------------------------------------------------
BitmapBuffer* ImpBitmap::ImplAcquireBuffer( BOOL bReadOnly )
{
return mpSalBitmap->AcquireBuffer( bReadOnly );
}
// -----------------------------------------------------------------------
void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly )
{
mpSalBitmap->ReleaseBuffer( pBuffer, bReadOnly );
if( !bReadOnly )
mnChecksum = 0;
}