LibreOffice Module canvas (master) 1
integerbitmapbase.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <com/sun/star/rendering/IntegerBitmapLayout.hpp>
23#include <verifyinput.hxx>
24
25
26namespace canvas
27{
38 template< class Base > class IntegerBitmapBase :
39 public Base
40 {
41 public:
42 // XIntegerBitmap
43 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getData( css::rendering::IntegerBitmapLayout& bitmapLayout,
44 const css::geometry::IntegerRectangle2D& rect ) override
45 {
47 __func__,
48 static_cast< typename Base::UnambiguousBaseType* >(this));
49 tools::verifyIndexRange(rect, Base::getSize() );
50
51 typename Base::MutexType aGuard( Base::m_aMutex );
52
53 return Base::maCanvasHelper.getData( bitmapLayout,
54 rect );
55 }
56
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
60 {
61 tools::verifyArgs(bitmapLayout, rect,
62 __func__,
63 static_cast< typename Base::UnambiguousBaseType* >(this));
64 tools::verifyIndexRange(rect, Base::getSize() );
65
66 typename Base::MutexType aGuard( Base::m_aMutex );
67
68 Base::mbSurfaceDirty = true;
69 }
70
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
74 {
75 tools::verifyArgs(bitmapLayout, pos,
76 __func__,
77 static_cast< typename Base::UnambiguousBaseType* >(this));
78 tools::verifyIndexRange(pos, Base::getSize() );
79
80 typename Base::MutexType aGuard( Base::m_aMutex );
81
82 Base::mbSurfaceDirty = true;
83 }
84
85 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getPixel( css::rendering::IntegerBitmapLayout& bitmapLayout,
86 const css::geometry::IntegerPoint2D& pos ) override
87 {
89 __func__,
90 static_cast< typename Base::UnambiguousBaseType* >(this));
91 tools::verifyIndexRange(pos, Base::getSize() );
92
93 typename Base::MutexType aGuard( Base::m_aMutex );
94
95 return Base::maCanvasHelper.getPixel( bitmapLayout,
96 pos );
97 }
98
99 virtual css::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout( ) override
100 {
101 typename Base::MutexType aGuard( Base::m_aMutex );
102
103 return Base::maCanvasHelper.getMemoryLayout();
104 }
105 };
106}
107
108/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper template to handle XIntegerBitmap method forwarding to BitmapCanvasHelper.
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getPixel(css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerPoint2D &pos) override
virtual css::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout() override
virtual void SAL_CALL setData(const css::uno::Sequence< sal_Int8 > &, const css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerRectangle2D &rect) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getData(css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerRectangle2D &rect) override
virtual void SAL_CALL setPixel(const css::uno::Sequence< sal_Int8 > &, const css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerPoint2D &pos) override
void verifyIndexRange(const geometry::IntegerRectangle2D &rect, const geometry::IntegerSize2D &size)
void verifyArgs(const Arg0 &rArg0, const char *pStr, const css::uno::Reference< css::uno::XInterface > &xIf)
Base
size_t pos