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 404190 : ImpBitmap::ImpBitmap() :
28 : mnRefCount ( 1 ),
29 : mnChecksum ( 0 ),
30 404190 : mpSalBitmap ( ImplGetSVData()->mpDefInst->CreateSalBitmap() )
31 : {
32 404190 : }
33 :
34 403194 : ImpBitmap::~ImpBitmap()
35 : {
36 403194 : delete mpSalBitmap;
37 403194 : }
38 :
39 250977 : void ImpBitmap::ImplSetSalBitmap( SalBitmap* pBitmap )
40 : {
41 250977 : delete mpSalBitmap, mpSalBitmap = pBitmap;
42 250977 : }
43 :
44 111419 : bool ImpBitmap::ImplCreate( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal )
45 : {
46 111419 : return mpSalBitmap->Create( rSize, nBitCount, rPal );
47 : }
48 :
49 41788 : bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap )
50 : {
51 41788 : mnChecksum = rImpBitmap.mnChecksum;
52 41788 : 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 6 : bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, sal_uInt16 nNewBitCount )
61 : {
62 6 : return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, nNewBitCount );
63 : }
64 :
65 1283621 : Size ImpBitmap::ImplGetSize() const
66 : {
67 1283621 : return mpSalBitmap->GetSize();
68 : }
69 :
70 493149 : sal_uInt16 ImpBitmap::ImplGetBitCount() const
71 : {
72 493149 : sal_uInt16 nBitCount = mpSalBitmap->GetBitCount();
73 493149 : return( ( nBitCount <= 1 ) ? 1 : ( nBitCount <= 4 ) ? 4 : ( nBitCount <= 8 ) ? 8 : 24 );
74 : }
75 :
76 1168266 : BitmapBuffer* ImpBitmap::ImplAcquireBuffer( bool bReadOnly )
77 : {
78 1168266 : return mpSalBitmap->AcquireBuffer( bReadOnly );
79 : }
80 :
81 1168260 : void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly )
82 : {
83 1168260 : mpSalBitmap->ReleaseBuffer( pBuffer, bReadOnly );
84 :
85 1168260 : if( !bReadOnly )
86 397713 : mnChecksum = 0;
87 1169493 : }
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|