Kaydet (Commit) 8ed148f6 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: fdo#33455 implement rendering of 1bit pngs palette colors

üst 7be23017
......@@ -44,6 +44,7 @@
#include "vcl/salbtype.hxx"
#include "vcl/printergfx.hxx"
#include "vcl/bmpacc.hxx"
#include "vcl/outdata.hxx"
#undef SALGDI2_TESTTRANS
......@@ -627,7 +628,22 @@ void X11SalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSa
{
// set foreground/background values for 1Bit bitmaps
XGetGCValues( pXDisp, aGC, nValues, &aOldVal );
aNewVal.foreground = rColMap.GetWhitePixel(), aNewVal.background = rColMap.GetBlackPixel();
aNewVal.foreground = rColMap.GetWhitePixel();
aNewVal.background = rColMap.GetBlackPixel();
//fdo#33455 handle 1 bit depth pngs with palette entries
//to set fore/back colors
if (const BitmapBuffer* pBitmapBuffer = const_cast<SalBitmap&>(rSalBitmap).AcquireBuffer(true))
{
const BitmapPalette& rPalette = pBitmapBuffer->maPalette;
if (rPalette.GetEntryCount() == 2)
{
aNewVal.foreground = rColMap.GetPixel(ImplColorToSal(rPalette[0]));
aNewVal.background = rColMap.GetPixel(ImplColorToSal(rPalette[1]));
}
}
XChangeGC( pXDisp, aGC, nValues, &aNewVal );
}
......
......@@ -58,7 +58,8 @@ SLOFILES= $(SLO)$/salgdi.obj \
$(SLO)$/salnativewidgets-luna.obj
EXCEPTIONSFILES= $(SLO)$/salprn.obj
EXCEPTIONSFILES= $(SLO)$/salprn.obj \
$(SLO)$/salgdi2.obj
.IF "$(ENABLE_GRAPHITE)" == "TRUE"
CFLAGS+=-DENABLE_GRAPHITE
......
......@@ -40,6 +40,10 @@
#include <salgdi.h>
#include <salframe.h>
#include "vcl/salbtype.hxx"
#include "vcl/bmpacc.hxx"
#include "vcl/outdata.hxx"
bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const
{
static bool bAllowForTest(true);
......@@ -391,8 +395,24 @@ void ImplDrawBitmap( HDC hDC,
if( bMono )
{
nOldBkColor = SetBkColor( hDC, RGB( 0xFF, 0xFF, 0xFF ) );
nOldTextColor = ::SetTextColor( hDC, RGB( 0x00, 0x00, 0x00 ) );
COLORREF nBkColor = RGB( 0xFF, 0xFF, 0xFF );
COLORREF nTextColor = RGB( 0x00, 0x00, 0x00 );
//fdo#33455 handle 1 bit depth pngs with palette entries
//to set fore/back colors
if (const BitmapBuffer* pBitmapBuffer = const_cast<WinSalBitmap&>(rSalBitmap).AcquireBuffer(true))
{
const BitmapPalette& rPalette = pBitmapBuffer->maPalette;
if (rPalette.GetEntryCount() == 2)
{
SalColor nCol;
nCol = ImplColorToSal(rPalette[0]);
nTextColor = RGB( SALCOLOR_RED(nCol), SALCOLOR_GREEN(nCol), SALCOLOR_BLUE(nCol) );
nCol = ImplColorToSal(rPalette[1]);
nBkColor = RGB( SALCOLOR_RED(nCol), SALCOLOR_GREEN(nCol), SALCOLOR_BLUE(nCol) );
}
}
nOldBkColor = SetBkColor( hDC, nBkColor );
nOldTextColor = ::SetTextColor( hDC, nTextColor );
}
if ( (pPosAry->mnSrcWidth == pPosAry->mnDestWidth) &&
......
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