Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <vcl/bitmap.hxx>
21 :
22 : #include <svdata.hxx>
23 : #include <salinst.hxx>
24 : #include <salbmp.hxx>
25 : #include <impbmp.hxx>
26 :
27 0 : ImpBitmap::ImpBitmap() :
28 : mnRefCount ( 1 ),
29 : mnChecksum ( 0 ),
30 0 : mpSalBitmap ( ImplGetSVData()->mpDefInst->CreateSalBitmap() )
31 : {
32 0 : }
33 :
34 0 : ImpBitmap::~ImpBitmap()
35 : {
36 0 : delete mpSalBitmap;
37 0 : }
38 :
39 0 : void ImpBitmap::ImplSetSalBitmap( SalBitmap* pBitmap )
40 : {
41 0 : delete mpSalBitmap, mpSalBitmap = pBitmap;
42 0 : }
43 :
44 0 : bool ImpBitmap::ImplCreate( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal )
45 : {
46 0 : return mpSalBitmap->Create( rSize, nBitCount, rPal );
47 : }
48 :
49 0 : bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap )
50 : {
51 0 : mnChecksum = rImpBitmap.mnChecksum;
52 0 : return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap );
53 : }
54 :
55 0 : bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, SalGraphics* pGraphics )
56 : {
57 0 : return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, pGraphics );
58 : }
59 :
60 0 : bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, sal_uInt16 nNewBitCount )
61 : {
62 0 : return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, nNewBitCount );
63 : }
64 :
65 0 : Size ImpBitmap::ImplGetSize() const
66 : {
67 0 : return mpSalBitmap->GetSize();
68 : }
69 :
70 0 : sal_uInt16 ImpBitmap::ImplGetBitCount() const
71 : {
72 0 : sal_uInt16 nBitCount = mpSalBitmap->GetBitCount();
73 0 : return( ( nBitCount <= 1 ) ? 1 : ( nBitCount <= 4 ) ? 4 : ( nBitCount <= 8 ) ? 8 : 24 );
74 : }
75 :
76 0 : BitmapBuffer* ImpBitmap::ImplAcquireBuffer( bool bReadOnly )
77 : {
78 0 : return mpSalBitmap->AcquireBuffer( bReadOnly );
79 : }
80 :
81 0 : void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly )
82 : {
83 0 : mpSalBitmap->ReleaseBuffer( pBuffer, bReadOnly );
84 :
85 0 : if( !bReadOnly )
86 0 : mnChecksum = 0;
87 0 : }
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|