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 #include <osl/diagnose.h>
25 
26 
27 namespace canvas
28 {
39  template< class Base > class IntegerBitmapBase :
40  public Base
41  {
42  public:
43  // XIntegerBitmap
44  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getData( css::rendering::IntegerBitmapLayout& bitmapLayout,
45  const css::geometry::IntegerRectangle2D& rect ) override
46  {
47  tools::verifyArgs(rect,
48  OSL_THIS_FUNC,
49  static_cast< typename Base::UnambiguousBaseType* >(this));
50  tools::verifyIndexRange(rect, Base::getSize() );
51 
52  typename Base::MutexType aGuard( Base::m_aMutex );
53 
54  return Base::maCanvasHelper.getData( bitmapLayout,
55  rect );
56  }
57 
58  virtual void SAL_CALL setData( const css::uno::Sequence< sal_Int8 >&,
59  const css::rendering::IntegerBitmapLayout& bitmapLayout,
60  const css::geometry::IntegerRectangle2D& rect ) override
61  {
62  tools::verifyArgs(bitmapLayout, rect,
63  OSL_THIS_FUNC,
64  static_cast< typename Base::UnambiguousBaseType* >(this));
65  tools::verifyIndexRange(rect, Base::getSize() );
66 
67  typename Base::MutexType aGuard( Base::m_aMutex );
68 
69  Base::mbSurfaceDirty = true;
70  }
71 
72  virtual void SAL_CALL setPixel( const css::uno::Sequence< sal_Int8 >&,
73  const css::rendering::IntegerBitmapLayout& bitmapLayout,
74  const css::geometry::IntegerPoint2D& pos ) override
75  {
76  tools::verifyArgs(bitmapLayout, pos,
77  OSL_THIS_FUNC,
78  static_cast< typename Base::UnambiguousBaseType* >(this));
79  tools::verifyIndexRange(pos, Base::getSize() );
80 
81  typename Base::MutexType aGuard( Base::m_aMutex );
82 
83  Base::mbSurfaceDirty = true;
84  }
85 
86  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getPixel( css::rendering::IntegerBitmapLayout& bitmapLayout,
87  const css::geometry::IntegerPoint2D& pos ) override
88  {
90  OSL_THIS_FUNC,
91  static_cast< typename Base::UnambiguousBaseType* >(this));
92  tools::verifyIndexRange(pos, Base::getSize() );
93 
94  typename Base::MutexType aGuard( Base::m_aMutex );
95 
96  return Base::maCanvasHelper.getPixel( bitmapLayout,
97  pos );
98  }
99 
100  virtual css::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout( ) override
101  {
102  typename Base::MutexType aGuard( Base::m_aMutex );
103 
104  return Base::maCanvasHelper.getMemoryLayout();
105  }
106  };
107 }
108 
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void verifyIndexRange(const geometry::IntegerRectangle2D &rect, const geometry::IntegerSize2D &size)
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getPixel(css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerPoint2D &pos) override
Base
Helper template to handle XIntegerBitmap method forwarding to BitmapCanvasHelper. ...
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getData(css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerRectangle2D &rect) override
virtual void SAL_CALL setData(const css::uno::Sequence< sal_Int8 > &, const 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
virtual css::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout() override
void verifyArgs(const Arg0 &rArg0, const char *pStr, const css::uno::Reference< css::uno::XInterface > &xIf)