1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: impbmp.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
37 #include <vcl/salbmp.hxx>
38 #include <tools/debug.hxx>
39 #include <vcl/impbmp.hxx>
40 #include <vcl/bitmap.hxx>
41 #include <vcl/svdata.hxx>
42 #include <vcl/salinst.hxx>
48 ImpBitmap::ImpBitmap() :
51 mpSalBitmap ( ImplGetSVData()->mpDefInst
->CreateSalBitmap() ),
56 // -----------------------------------------------------------------------
58 ImpBitmap::~ImpBitmap()
63 // -----------------------------------------------------------------------
64 void ImpBitmap::ImplSetSalBitmap( SalBitmap
* pBitmap
)
66 delete mpSalBitmap
, mpSalBitmap
= pBitmap
;
69 // -----------------------------------------------------------------------
71 BOOL
ImpBitmap::ImplCreate( const Size
& rSize
, USHORT nBitCount
, const BitmapPalette
& rPal
)
74 return mpSalBitmap
->Create( rSize
, nBitCount
, rPal
);
77 // -----------------------------------------------------------------------
79 BOOL
ImpBitmap::ImplCreate( const ImpBitmap
& rImpBitmap
)
81 maSourceSize
= rImpBitmap
.maSourceSize
;
82 mnChecksum
= rImpBitmap
.mnChecksum
;
83 return mpSalBitmap
->Create( *rImpBitmap
.mpSalBitmap
);
86 // -----------------------------------------------------------------------
88 BOOL
ImpBitmap::ImplCreate( const ImpBitmap
& rImpBitmap
, SalGraphics
* pGraphics
)
90 return mpSalBitmap
->Create( *rImpBitmap
.mpSalBitmap
, pGraphics
);
93 // -----------------------------------------------------------------------
95 BOOL
ImpBitmap::ImplCreate( const ImpBitmap
& rImpBitmap
, USHORT nNewBitCount
)
97 return mpSalBitmap
->Create( *rImpBitmap
.mpSalBitmap
, nNewBitCount
);
100 // -----------------------------------------------------------------------
102 void ImpBitmap::ImplDestroy()
104 mpSalBitmap
->Destroy();
107 // -----------------------------------------------------------------------
109 Size
ImpBitmap::ImplGetSize() const
111 return mpSalBitmap
->GetSize();
114 // -----------------------------------------------------------------------
116 USHORT
ImpBitmap::ImplGetBitCount() const
118 USHORT nBitCount
= mpSalBitmap
->GetBitCount();
119 return( ( nBitCount
<= 1 ) ? 1 : ( nBitCount
<= 4 ) ? 4 : ( nBitCount
<= 8 ) ? 8 : 24 );
122 // -----------------------------------------------------------------------
124 BitmapBuffer
* ImpBitmap::ImplAcquireBuffer( BOOL bReadOnly
)
126 return mpSalBitmap
->AcquireBuffer( bReadOnly
);
129 // -----------------------------------------------------------------------
131 void ImpBitmap::ImplReleaseBuffer( BitmapBuffer
* pBuffer
, BOOL bReadOnly
)
133 mpSalBitmap
->ReleaseBuffer( pBuffer
, bReadOnly
);