diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-16 16:13:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-19 10:13:00 +0100 |
commit | 6fbb6d80fe6203ff6f84ee85ca625b6e60bf5bae (patch) | |
tree | 1482de217efaafface8b1fa82ecd2320b82a1a68 /include/svx | |
parent | 2ab300bfa18cdcc91a9311c4c9710254b0ad7753 (diff) |
use std::array in createHistorical8x8FromArray
to make the assumption about the size of the array obvious in the code.
Change-Id: I7ebe0b037e3be38f7e33c0160742f829288bb474
Reviewed-on: https://gerrit.libreoffice.org/49938
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svx')
-rw-r--r-- | include/svx/dlgctrl.hxx | 17 | ||||
-rw-r--r-- | include/svx/xbtmpit.hxx | 3 |
2 files changed, 11 insertions, 9 deletions
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 26cfb511700c..0cf9220cb34f 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -27,6 +27,7 @@ #include <svx/xtable.hxx> #include <rtl/ref.hxx> #include <o3tl/typed_flags_set.hxx> +#include <array> class XOBitmap; class XOutdevItemPool; @@ -147,11 +148,12 @@ public: class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxPixelCtl final : public Control { private: - sal_uInt16 nLines, nSquares; + static sal_uInt16 constexpr nLines = 8; + static sal_uInt16 constexpr nSquares = nLines * nLines; Color aPixelColor; Color aBackgroundColor; Size aRectSize; - sal_uInt16* pPixel; + std::array<sal_uInt8,nSquares> maPixelData; bool bPaintable; //Add member identifying position Point aFocusPosition; @@ -163,10 +165,9 @@ private: void ChangePixel( sal_uInt16 nPixel ); public: - SvxPixelCtl( vcl::Window* pParent, sal_uInt16 nNumber = 8 ); + SvxPixelCtl( vcl::Window* pParent ); virtual ~SvxPixelCtl() override; - virtual void dispose() override; virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; @@ -178,15 +179,15 @@ public: void SetPixelColor( const Color& rCol ) { aPixelColor = rCol; } void SetBackgroundColor( const Color& rCol ) { aBackgroundColor = rCol; } - sal_uInt16 GetLineCount() const { return nLines; } + static sal_uInt16 GetLineCount() { return nLines; } - sal_uInt16 GetBitmapPixel( const sal_uInt16 nPixelNumber ); - sal_uInt16* GetBitmapPixelPtr() { return pPixel; } + sal_uInt8 GetBitmapPixel( const sal_uInt16 nPixelNumber ) const; + std::array<sal_uInt8,64> const & GetBitmapPixelPtr() const { return maPixelData; } void SetPaintable( bool bTmp ) { bPaintable = bTmp; } void Reset(); virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; - long GetSquares() const { return nSquares ; } + static long GetSquares() { return nSquares ; } long GetWidth() const { return aRectSize.getWidth() ; } long GetHeight() const { return aRectSize.getHeight() ; } diff --git a/include/svx/xbtmpit.hxx b/include/svx/xbtmpit.hxx index b9ced7c42fb0..7c2e2fa2582c 100644 --- a/include/svx/xbtmpit.hxx +++ b/include/svx/xbtmpit.hxx @@ -23,6 +23,7 @@ #include <svx/svxdllapi.h> #include <svx/xit.hxx> #include <svtools/grfmgr.hxx> +#include <array> class SdrModel; class BitmapColor; @@ -30,7 +31,7 @@ class BitmapColor; // helper to construct historical 8x8 bitmaps with two colors -BitmapEx SVX_DLLPUBLIC createHistorical8x8FromArray(sal_uInt16 const * pArray, Color aColorPix, Color aColorBack); +BitmapEx SVX_DLLPUBLIC createHistorical8x8FromArray(std::array<sal_uInt8,64> const & pArray, Color aColorPix, Color aColorBack); bool SVX_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBack, BitmapColor& o_rFront); |