summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-16 14:26:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-19 07:12:56 +0100
commitccd316d1cb310734848bd20244f509024b549b8c (patch)
tree3f942f2c44c42f4422e8889e94100684e25cf5c4 /svx
parentadd367bfec9d12502e64d2994f0f39e2e436442a (diff)
use VirtualDevice in createHistorical8x8FromArray
part of making BitmapWriteAccess an internal detail of vcl/ Change-Id: I8b3aa2fdd3c26db0e48b228640cd31b0bd31543c Reviewed-on: https://gerrit.libreoffice.org/49937 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/xoutdev/xattrbmp.cxx34
-rw-r--r--svx/source/xoutdev/xtabptrn.cxx2
2 files changed, 13 insertions, 23 deletions
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index 8e6e5afb18a8..336f84d9c2a8 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <vcl/salbtype.hxx>
#include <vcl/bitmapaccess.hxx>
+#include <vcl/BitmapTools.hxx>
#include <vcl/dibtools.hxx>
#include <libxml/xmlwriter.h>
@@ -143,37 +144,26 @@ XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem)
{
}
-Bitmap createHistorical8x8FromArray(const sal_uInt16* pArray, Color aColorPix, Color aColorBack)
+BitmapEx createHistorical8x8FromArray(sal_uInt16 const *pArray, Color aColorPix, Color aColorBack)
{
- BitmapPalette aPalette(2);
+ vcl::bitmap::RawBitmap aBitmap(Size(8, 8));
- aPalette[0] = BitmapColor(aColorBack);
- aPalette[1] = BitmapColor(aColorPix);
-
- Bitmap aBitmap(Size(8, 8), 1, &aPalette);
- Bitmap::ScopedWriteAccess pContent(aBitmap);
-
- if(pContent)
+ for(sal_uInt16 a(0); a < 8; a++)
{
- for(sal_uInt16 a(0); a < 8; a++)
+ for(sal_uInt16 b(0); b < 8; b++)
{
- for(sal_uInt16 b(0); b < 8; b++)
+ if(pArray[(a * 8) + b])
{
- if(pArray[(a * 8) + b])
- {
- pContent->SetPixelIndex(a, b, 1);
- }
- else
- {
- pContent->SetPixelIndex(a, b, 0);
- }
+ aBitmap.SetPixel(a, b, aColorBack);
+ }
+ else
+ {
+ aBitmap.SetPixel(a, b, aColorPix);
}
}
-
- pContent.reset();
}
- return aBitmap;
+ return vcl::bitmap::CreateFromData(std::move(aBitmap));
}
bool isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBack, BitmapColor& o_rFront)
diff --git a/svx/source/xoutdev/xtabptrn.cxx b/svx/source/xoutdev/xtabptrn.cxx
index 9dd126dd3126..40e38cb3e331 100644
--- a/svx/source/xoutdev/xtabptrn.cxx
+++ b/svx/source/xoutdev/xtabptrn.cxx
@@ -49,7 +49,7 @@ bool XPatternList::Create()
{
OUStringBuffer aStr(SvxResId(RID_SVXSTR_PATTERN));
sal_uInt16 aArray[64];
- Bitmap aBitmap;
+ BitmapEx aBitmap;
const sal_Int32 nLen(aStr.getLength() - 1);
memset(aArray, 0, sizeof(aArray));