Kaydet (Commit) ccd316d1 authored tarafından Noel Grandin's avatar Noel Grandin

use VirtualDevice in createHistorical8x8FromArray

part of making BitmapWriteAccess an internal detail of vcl/

Change-Id: I8b3aa2fdd3c26db0e48b228640cd31b0bd31543c
Reviewed-on: https://gerrit.libreoffice.org/49937Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst add367bf
......@@ -72,9 +72,9 @@ public:
// BitmapCtl: Returns the Bitmap
BitmapEx GetBitmapEx()
{
const Bitmap aRetval(createHistorical8x8FromArray(pBmpArray, aPixelColor, aBackgroundColor));
return (pBmpArray != nullptr) ? BitmapEx(aRetval) : BitmapEx();
if (!pBmpArray)
return BitmapEx();
return createHistorical8x8FromArray(pBmpArray, aPixelColor, aBackgroundColor);
}
void SetBmpArray( const sal_uInt16* pPixel ) { pBmpArray = pPixel; }
......
......@@ -30,7 +30,7 @@ class BitmapColor;
// helper to construct historical 8x8 bitmaps with two colors
Bitmap SVX_DLLPUBLIC createHistorical8x8FromArray(const sal_uInt16* pArray, Color aColorPix, Color aColorBack);
BitmapEx SVX_DLLPUBLIC createHistorical8x8FromArray(sal_uInt16 const * pArray, Color aColorPix, Color aColorBack);
bool SVX_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBack, BitmapColor& o_rFront);
......
......@@ -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)
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment