1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <com/sun/star/rendering/IntegerBitmapLayout.hpp>
23 #include <verifyinput.hxx>
28 /** Helper template to handle XIntegerBitmap method forwarding to
31 Use this helper to handle the XIntegerBitmap part of your
35 Either BitmapCanvasBase (just XBitmap) or BitmapCanvasBase2 (XBitmap and
38 template< class Base
> class IntegerBitmapBase
:
43 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getData( css::rendering::IntegerBitmapLayout
& bitmapLayout
,
44 const css::geometry::IntegerRectangle2D
& rect
) override
46 tools::verifyArgs(rect
,
48 static_cast< typename
Base::UnambiguousBaseType
* >(this));
49 tools::verifyIndexRange(rect
, Base::getSize() );
51 typename
Base::MutexType
aGuard( Base::m_aMutex
);
53 return Base::maCanvasHelper
.getData( bitmapLayout
,
57 virtual void SAL_CALL
setData( const css::uno::Sequence
< sal_Int8
>&,
58 const css::rendering::IntegerBitmapLayout
& bitmapLayout
,
59 const css::geometry::IntegerRectangle2D
& rect
) override
61 tools::verifyArgs(bitmapLayout
, rect
,
63 static_cast< typename
Base::UnambiguousBaseType
* >(this));
64 tools::verifyIndexRange(rect
, Base::getSize() );
66 typename
Base::MutexType
aGuard( Base::m_aMutex
);
68 Base::mbSurfaceDirty
= true;
71 virtual void SAL_CALL
setPixel( const css::uno::Sequence
< sal_Int8
>&,
72 const css::rendering::IntegerBitmapLayout
& bitmapLayout
,
73 const css::geometry::IntegerPoint2D
& pos
) override
75 tools::verifyArgs(bitmapLayout
, pos
,
77 static_cast< typename
Base::UnambiguousBaseType
* >(this));
78 tools::verifyIndexRange(pos
, Base::getSize() );
80 typename
Base::MutexType
aGuard( Base::m_aMutex
);
82 Base::mbSurfaceDirty
= true;
85 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getPixel( css::rendering::IntegerBitmapLayout
& bitmapLayout
,
86 const css::geometry::IntegerPoint2D
& pos
) override
88 tools::verifyArgs(pos
,
90 static_cast< typename
Base::UnambiguousBaseType
* >(this));
91 tools::verifyIndexRange(pos
, Base::getSize() );
93 typename
Base::MutexType
aGuard( Base::m_aMutex
);
95 return Base::maCanvasHelper
.getPixel( bitmapLayout
,
99 virtual css::rendering::IntegerBitmapLayout SAL_CALL
getMemoryLayout( ) override
101 typename
Base::MutexType
aGuard( Base::m_aMutex
);
103 return Base::maCanvasHelper
.getMemoryLayout();
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */