Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / basegfx / raster / bzpixelraster.hxx
blob9f6900d3b125712e19ae853a87f1c7b2c8143da5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_BASEGFX_RASTER_BZPIXELRASTER_HXX
21 #define INCLUDED_BASEGFX_RASTER_BZPIXELRASTER_HXX
23 #include <memory>
24 #include <basegfx/raster/bpixelraster.hxx>
25 #include <basegfx/basegfxdllapi.h>
26 #include <osl/diagnose.h>
28 namespace basegfx
30 class BZPixelRaster : public BPixelRaster
32 protected:
33 // additionally, host a ZBuffer
34 std::unique_ptr<sal_uInt16[]> mpZBuffer;
36 public:
37 // constructor/destructor
38 BZPixelRaster(sal_uInt32 nWidth, sal_uInt32 nHeight)
39 : BPixelRaster(nWidth, nHeight),
40 mpZBuffer(new sal_uInt16[mnCount])
42 memset(mpZBuffer.get(), 0, sizeof(sal_uInt16) * mnCount);
45 // data access read only
46 const sal_uInt16& getZ(sal_uInt32 nIndex) const
48 #ifdef DBG_UTIL
49 if(nIndex >= mnCount)
51 OSL_FAIL("getZ: Access out of range (!)");
52 return mpZBuffer[0L];
54 #endif
55 return mpZBuffer[nIndex];
58 // data access read/write
59 sal_uInt16& getZ(sal_uInt32 nIndex)
61 #ifdef DBG_UTIL
62 if(nIndex >= mnCount)
64 OSL_FAIL("getZ: Access out of range (!)");
65 return mpZBuffer[0L];
67 #endif
68 return mpZBuffer[nIndex];
71 } // end of namespace basegfx
73 #endif // INCLUDED_BASEGFX_RASTER_BZPIXELRASTER_HXX
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */