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 108583 : ImpBitmap::ImpBitmap() :
28 : mnRefCount ( 1 ),
29 : mnChecksum ( 0 ),
30 108583 : mpSalBitmap ( ImplGetSVData()->mpDefInst->CreateSalBitmap() )
31 : {
32 108583 : }
33 :
34 176036 : ImpBitmap::ImpBitmap(SalBitmap* pBitmap) :
35 : mnRefCount ( 1 ),
36 : mnChecksum ( 0 ),
37 176036 : mpSalBitmap ( pBitmap )
38 : {
39 176036 : }
40 :
41 280604 : ImpBitmap::~ImpBitmap()
42 : {
43 280604 : delete mpSalBitmap;
44 280604 : }
45 :
46 72759 : bool ImpBitmap::ImplCreate( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal )
47 : {
48 72759 : return mpSalBitmap->Create( rSize, nBitCount, rPal );
49 : }
50 :
51 35821 : bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap )
52 : {
53 35821 : mnChecksum = rImpBitmap.mnChecksum;
54 35821 : return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap );
55 : }
56 :
57 0 : bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, SalGraphics* pGraphics )
58 : {
59 0 : return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, pGraphics );
60 : }
61 :
62 3 : bool ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, sal_uInt16 nNewBitCount )
63 : {
64 3 : return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, nNewBitCount );
65 : }
66 :
67 885096 : Size ImpBitmap::ImplGetSize() const
68 : {
69 885096 : return mpSalBitmap->GetSize();
70 : }
71 :
72 361455 : sal_uInt16 ImpBitmap::ImplGetBitCount() const
73 : {
74 361455 : sal_uInt16 nBitCount = mpSalBitmap->GetBitCount();
75 361455 : return( ( nBitCount <= 1 ) ? 1 : ( nBitCount <= 4 ) ? 4 : ( nBitCount <= 8 ) ? 8 : 24 );
76 : }
77 :
78 887478 : BitmapBuffer* ImpBitmap::ImplAcquireBuffer( BitmapAccessMode nMode )
79 : {
80 887478 : return mpSalBitmap->AcquireBuffer( nMode );
81 : }
82 :
83 887475 : void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode )
84 : {
85 887475 : mpSalBitmap->ReleaseBuffer( pBuffer, nMode );
86 :
87 887475 : if( nMode == BITMAP_WRITE_ACCESS )
88 382074 : mnChecksum = 0;
89 887475 : }
90 :
91 4620 : bool ImpBitmap::ImplScale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag )
92 : {
93 4620 : return mpSalBitmap->Scale( rScaleX, rScaleY, nScaleFlag );
94 : }
95 :
96 512 : bool ImpBitmap::ImplReplace( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol )
97 : {
98 512 : return mpSalBitmap->Replace( rSearchColor, rReplaceColor, nTol );
99 : }
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|