From b639fe60eab2a221e23dc9d509f9281857d656a3 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 19 Nov 2015 11:51:47 +0000 Subject: VirtualDevices either match another device depth, or are 1 bit cairo can therefore always render to a svp virtual device with need for a fallback Change-Id: I5d03ae541820389e26f7448444444be009fb28a4 --- canvas/source/directx/dx_textlayout_drawhelper.cxx | 4 +-- canvas/source/vcl/backbuffer.cxx | 2 +- canvas/source/vcl/bitmapbackbuffer.cxx | 2 +- chart2/source/view/main/3DChartObjects.cxx | 2 +- chart2/source/view/main/DummyXShape.cxx | 2 +- .../source/mtfrenderer/transparencygroupaction.cxx | 2 +- desktop/CppunitTest_desktop_lib.mk | 1 + desktop/qa/desktop_lib/test_desktop_lib.cxx | 6 ++-- desktop/source/lib/init.cxx | 25 +++++++++------- .../source/processor2d/vclhelperbufferdevice.cxx | 2 +- include/vcl/salgtype.hxx | 9 +++++- include/vcl/virdev.hxx | 35 +++++++++++----------- sd/source/ui/presenter/PresenterTextView.cxx | 4 +-- .../view/SlsInsertionIndicatorOverlay.cxx | 2 +- svtools/source/table/gridtablerenderer.cxx | 4 +-- svx/source/dialog/dialcontrol.cxx | 2 +- sw/source/uibase/uno/unotxdoc.cxx | 2 +- vcl/headless/svpcairotextrender.cxx | 22 +------------- vcl/headless/svpcairotextrender.hxx | 2 -- vcl/headless/svpgdi.cxx | 6 ---- vcl/headless/svpinst.cxx | 3 -- vcl/headless/svptext.cxx | 14 --------- vcl/inc/cairotextrender.hxx | 4 --- vcl/inc/headless/svpgdi.hxx | 3 -- vcl/opengl/x11/salvd.cxx | 4 --- vcl/quartz/salvd.cxx | 2 ++ vcl/source/gdi/bitmapex.cxx | 2 +- vcl/source/gdi/gdimtf.cxx | 2 +- vcl/source/gdi/pdfwriter_impl.cxx | 2 +- vcl/source/gdi/virdev.cxx | 4 +-- vcl/source/window/paint.cxx | 4 +-- vcl/unx/generic/gdi/cairo_xlib_cairo.cxx | 9 ++---- vcl/unx/generic/gdi/salvd.cxx | 3 -- vcl/unx/gtk/gtksalframe.cxx | 2 +- vcl/unx/gtk3/cairo_gtk3_cairo.cxx | 2 +- vcl/win/source/gdi/salvd.cxx | 3 -- vcl/workben/vcldemo.cxx | 2 +- 37 files changed, 75 insertions(+), 126 deletions(-) diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index 574a9693c021..c530aaa3e38c 100644 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -84,7 +84,7 @@ namespace dxcanvas SystemGraphicsData aSystemGraphicsData; aSystemGraphicsData.nSize = sizeof(SystemGraphicsData); aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(hdc); - ScopedVclPtrInstance xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::FULLCOLOR); + ScopedVclPtrInstance xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT); // disable font antialiasing - GDI does not handle alpha // surfaces properly. @@ -240,7 +240,7 @@ namespace dxcanvas SystemGraphicsData aSystemGraphicsData; aSystemGraphicsData.nSize = sizeof(SystemGraphicsData); aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(GetDC( NULL )); - ScopedVclPtrInstance xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::FULLCOLOR); + ScopedVclPtrInstance xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT); // create the font const css::rendering::FontRequest& rFontRequest = rCanvasFont->getFontRequest(); diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx index 39a1b67af240..143f7a2212e8 100644 --- a/canvas/source/vcl/backbuffer.cxx +++ b/canvas/source/vcl/backbuffer.cxx @@ -27,7 +27,7 @@ namespace vclcanvas BackBuffer::BackBuffer( const OutputDevice& rRefDevice, bool bMonochromeBuffer ) : maVDev( VclPtr::Create( rRefDevice, - bMonochromeBuffer ? DeviceFormat::BITMASK : DeviceFormat::FULLCOLOR ) ) + bMonochromeBuffer ? DeviceFormat::BITMASK : DeviceFormat::DEFAULT ) ) { if( !bMonochromeBuffer ) { diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx b/canvas/source/vcl/bitmapbackbuffer.cxx index 1fb22b04cb85..c746b189b433 100644 --- a/canvas/source/vcl/bitmapbackbuffer.cxx +++ b/canvas/source/vcl/bitmapbackbuffer.cxx @@ -112,7 +112,7 @@ namespace vclcanvas // VDev not yet created, do it now. Create an alpha-VDev, // if bitmap has transparency. mpVDev = maBitmap->IsTransparent() ? - VclPtr::Create( mrRefDevice, DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR ) : + VclPtr::Create( mrRefDevice, DeviceFormat::DEFAULT, DeviceFormat::DEFAULT ) : VclPtr::Create( mrRefDevice ); OSL_ENSURE( mpVDev, diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx index 9a72479f544f..e8bb046add59 100644 --- a/chart2/source/view/main/3DChartObjects.cxx +++ b/chart2/source/view/main/3DChartObjects.cxx @@ -77,7 +77,7 @@ const TextCacheItem& TextCache::getText(OUString const & rText, bool bIs3dText) return *itr->second; ScopedVclPtrInstance< VirtualDevice > pDevice(*Application::GetDefaultDevice(), - DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR); + DeviceFormat::DEFAULT, DeviceFormat::DEFAULT); vcl::Font aFont; if(bIs3dText) aFont = vcl::Font("Brillante St",Size(0,0)); diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index add14b383ca6..a6f9ed12c00d 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -836,7 +836,7 @@ DummyText::DummyText(const OUString& rText, const tNameSequence& rNames, vcl::Font aFont; std::for_each(maProperties.begin(), maProperties.end(), FontAttribSetter(aFont)); ScopedVclPtrInstance< VirtualDevice > pDevice(*Application::GetDefaultDevice(), - DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR); + DeviceFormat::DEFAULT, DeviceFormat::DEFAULT); pDevice->Erase(); Rectangle aRect; pDevice->SetFont(aFont); diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx index 7962877deac4..9d75134a38cb 100644 --- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx +++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx @@ -241,7 +241,7 @@ namespace cppcanvas // render our content into an appropriately sized // VirtualDevice with alpha channel ScopedVclPtrInstance aVDev( - *::Application::GetDefaultDevice(), DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR ); + *::Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT ); aVDev->SetOutputSizePixel( aBitmapSizePixel ); aVDev->SetMapMode(); diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk index bbedfdc8348e..2119e15735fb 100644 --- a/desktop/CppunitTest_desktop_lib.mk +++ b/desktop/CppunitTest_desktop_lib.mk @@ -16,6 +16,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,desktop_lib, \ )) $(eval $(call gb_CppunitTest_use_libraries,desktop_lib, \ + basebmp \ comphelper \ cppu \ cppuhelper \ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 0874eeddba1b..07607dd6b365 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -14,7 +14,7 @@ #include #include #include - +#include #include #include #include @@ -316,7 +316,9 @@ void DesktopLOKTest::testPaintTile() LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); int nCanvasWidth = 100; int nCanvasHeight = 300; - std::vector aBuffer(nCanvasWidth * nCanvasHeight * 4); + sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(basebmp::Format::ThirtyTwoBitTcMaskBGRX, + nCanvasWidth); + std::vector aBuffer(nStride * nCanvasHeight); int nTilePosX = 0; int nTilePosY = 0; int nTileWidth = 1000; diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 68eb01dd67ba..69ff1c3b1aaf 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -882,12 +882,12 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, SystemGraphicsData aData; aData.rCGContext = reinterpret_cast(pBuffer); // the Size argument is irrelevant, I hope - ScopedVclPtrInstance pDevice(&aData, Size(1, 1), DeviceFormat::FULLCOLOR); + ScopedVclPtrInstance pDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT); pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); #elif defined(ANDROID) - ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::FULLCOLOR) ; + ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ; boost::shared_array aBuffer(pBuffer, NoDelete< sal_uInt8 >()); @@ -900,20 +900,19 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); #else - ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::FULLCOLOR) ; + ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ; // Set background to transparent by default. - memset(pBuffer, 0, nCanvasWidth * nCanvasHeight * 4); pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() ); // Allocate a separate buffer for the alpha device. - std::vector aAlpha(nCanvasWidth * nCanvasHeight); - memset(aAlpha.data(), 0, nCanvasWidth * nCanvasHeight); -// TO_DO: enable alpha -// boost::shared_array aAlphaBuffer(aAlpha.data(), NoDelete()); - boost::shared_array aAlphaBuffer; + sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(basebmp::Format::ThirtyTwoBitTcMaskBGRX, + nCanvasWidth); + std::vector aAlpha(nCanvasHeight * nStride); + + boost::shared_array aAlphaBuffer(aAlpha.data(), NoDelete()); pDevice->SetOutputSizePixelScaleOffsetAndBuffer( Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), @@ -927,11 +926,15 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, { for (int nCol = 0; nCol < nCanvasWidth; ++nCol) { - const int nOffset = (nCanvasWidth * nRow) + nCol; + const int nOffset = (nRow * nStride) + nCol * 4; // VCL's transparent is 0, RGBA's transparent is 0xff. - pBuffer[nOffset * 4 +3] = 0xff - aAlpha[nOffset]; + pBuffer[nOffset + 3] = 0xff - aAlpha[nOffset]; + double fAlpha = pBuffer[nOffset + 3]/255.0; + for (int i = 0; i < 3; ++i) + pBuffer[nOffset + i] *= fAlpha; } } + #endif static bool bDebug = getenv("LOK_DEBUG") != nullptr; diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index 2d1d498f095d..e7ff5a1b0daa 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -162,7 +162,7 @@ namespace // no success yet, create new buffer if(!pRetval) { - pRetval = VclPtr::Create(rOutDev, bMonoChrome ? DeviceFormat::BITMASK : DeviceFormat::FULLCOLOR); + pRetval = VclPtr::Create(rOutDev, bMonoChrome ? DeviceFormat::BITMASK : DeviceFormat::DEFAULT); pRetval->SetOutputSizePixel(rSizePixel, bClear); } else diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx index 59654f6595d5..a43a19db72b4 100644 --- a/include/vcl/salgtype.hxx +++ b/include/vcl/salgtype.hxx @@ -22,7 +22,14 @@ #include -enum class DeviceFormat { NONE = -1, FULLCOLOR = 0, BITMASK = 1, GRAYSCALE = 8 }; +enum class DeviceFormat { + NONE = -1, + DEFAULT = 0, + BITMASK = 1, +#ifdef IOS + GRAYSCALE = 8 +#endif + }; typedef sal_uInt32 SalColor; #define MAKE_SALCOLOR( r, g, b ) ((SalColor)(((sal_uInt32)((sal_uInt8)(b))))|(((sal_uInt32)((sal_uInt8)(g)))<<8)|(((sal_uInt32)((sal_uInt8)(r)))<<16)) diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index 76076ba657fd..cd6db85e9ab2 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -74,38 +74,39 @@ public: /** Create a virtual device of size 1x1 @param nBitCount - Bit depth of the generated virtual device. Use 0 here, to - indicate: take default screen depth. Only 0, 1 and 8 - are allowed here, with 1 denoting binary mask and 8 a graylevel mask. + Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to + indicate: take default screen depth. Only DeviceFormat::BITMASK + is the other possibility to denote a binary mask. */ - explicit VirtualDevice(DeviceFormat eFormat = DeviceFormat::FULLCOLOR); + explicit VirtualDevice(DeviceFormat eFormat = DeviceFormat::DEFAULT); /** Create a virtual device of size 1x1 @param rCompDev The generated vdev will be compatible to this device. - @param nBitCount - Bit depth of the generated virtual device. Use 0 here, to - indicate: take default screen depth. + @param eFormat + Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to + indicate: take default screen depth. Only DeviceFormat::BITMASK + is the other possibility to denote a binary mask. */ explicit VirtualDevice(const OutputDevice& rCompDev, - DeviceFormat eFormat = DeviceFormat::FULLCOLOR); + DeviceFormat eFormat = DeviceFormat::DEFAULT); /** Create a virtual device of size 1x1 with alpha channel @param rCompDev The generated vdev will be compatible to this device. - @param nBitCount - Bit depth of the generated virtual device. Use 0 here, to - indicate: take default screen depth. Only 0 and 1 - are allowed here, with 1 denoting binary mask. - - @param nAlphaBitCount - Bit depth of the generated virtual device. Use 0 here, to - indicate: take default screen depth. Only 0 and 1 - are allowed here, with 1 denoting binary mask. + @param eFormat + Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to + indicate: take default screen depth. Only DeviceFormat::BITMASK + is the other possibility to denote a binary mask. + + @param eAlphaFormat + Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to + indicate: take default screen depth. Only DeviceFormat::BITMASK + is the other possibility to denote a binary mask. */ explicit VirtualDevice( const OutputDevice& rCompDev, DeviceFormat eFormat, DeviceFormat eAlphaFormat); diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx index db281d63195b..02f0b311dd81 100644 --- a/sd/source/ui/presenter/PresenterTextView.cxx +++ b/sd/source/ui/presenter/PresenterTextView.cxx @@ -242,7 +242,7 @@ PresenterTextView::Implementation::Implementation() msTotalHeightPropertyName("TotalHeight"), mxBitmap(), mpCanvas(), - mpOutputDevice(VclPtr::Create(*Application::GetDefaultDevice(), DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR)), + mpOutputDevice(VclPtr::Create(*Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT)), mpEditEngine(nullptr), mpEditEngineItemPool(EditEngine::CreatePool()), maSize(100,100), @@ -455,7 +455,7 @@ Reference PresenterTextView::Implementation::GetBitmap() { mpOutputDevice.disposeAndClear(); mpOutputDevice = VclPtr::Create(*Application::GetDefaultDevice(), - DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR); + DeviceFormat::DEFAULT, DeviceFormat::DEFAULT); mpOutputDevice->SetMapMode(MAP_PIXEL); mpOutputDevice->SetOutputSizePixel(maSize); mpOutputDevice->SetLineColor(); diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx index 84590d864b37..fdef07a39d97 100644 --- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx +++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx @@ -135,7 +135,7 @@ void InsertionIndicatorOverlay::Create ( // Create virtual devices for bitmap and mask whose bitmaps later be // combined to form the BitmapEx of the icon. ScopedVclPtrInstance pContent( - *mrSlideSorter.GetContentWindow(), DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR); + *mrSlideSorter.GetContentWindow(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT); pContent->SetOutputSizePixel(aIconSize); pContent->SetFillColor(); diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index bae4ee3d0912..3c935ab01bd0 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -84,8 +84,8 @@ namespace svt { namespace table Point const aBitmapPos( 0, 0 ); Size const aBitmapSize( nSortIndicatorWidth, nSortIndicatorHeight ); - ScopedVclPtrInstance< VirtualDevice > aDevice(i_device, DeviceFormat::FULLCOLOR, - DeviceFormat::FULLCOLOR); + ScopedVclPtrInstance< VirtualDevice > aDevice(i_device, DeviceFormat::DEFAULT, + DeviceFormat::DEFAULT); aDevice->SetOutputSizePixel( aBitmapSize ); DecorationView aDecoView(aDevice.get()); diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx index c93c0ace9e81..77f62b1b4fc4 100644 --- a/svx/source/dialog/dialcontrol.cxx +++ b/svx/source/dialog/dialcontrol.cxx @@ -35,7 +35,7 @@ namespace svx { const long DIAL_OUTER_WIDTH = 8; DialControlBmp::DialControlBmp(vcl::Window& rParent) : - VirtualDevice(rParent, DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR), + VirtualDevice(rParent, DeviceFormat::DEFAULT, DeviceFormat::DEFAULT), mbEnabled(true), mrParent(rParent), mnCenterX(0), diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 738be4b47fa6..a8ddf713f4cd 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3426,7 +3426,7 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I sal_Int64 nWindowHandle; Parent >>= nWindowHandle; aData.hWnd = (HWND) nWindowHandle; - ScopedVclPtrInstance xDevice(&aData, Size(1, 1), DeviceFormat::FULLCOLOR); + ScopedVclPtrInstance xDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT); paintTile(*xDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); #else // TODO: support other platforms diff --git a/vcl/headless/svpcairotextrender.cxx b/vcl/headless/svpcairotextrender.cxx index 06abf0ccc48a..681d65dd2e5a 100644 --- a/vcl/headless/svpcairotextrender.cxx +++ b/vcl/headless/svpcairotextrender.cxx @@ -22,13 +22,7 @@ GlyphCache& SvpCairoTextRender::getPlatformGlyphCache() cairo_t* SvpCairoTextRender::getCairoContext() { - cairo_t* pRet = mrParent.getCairoContext(); - if (!pRet) - { - mxTmpSurface = mrParent.createSimpleMask(); - pRet = SvpSalGraphics::createCairoContext(mxTmpSurface); - } - return pRet; + return mrParent.getCairoContext(); } void SvpCairoTextRender::getSurfaceOffset(double& nDX, double& nDY) @@ -42,22 +36,8 @@ void SvpCairoTextRender::clipRegion(cairo_t* cr) mrParent.clipRegion(cr); } -basebmp::BitmapDeviceSharedPtr SvpCairoTextRender::createSimpleMask() -{ - return mrParent.createSimpleMask(); -} - void SvpCairoTextRender::drawSurface(cairo_t*) { - //typically we have drawn directly to the real surface, in edge-cases of - //strange surface depths, we'll have drawn into a tmp surface, so flush - //it - if (mxTmpSurface) - { - // blend text color into target using the glyph's mask - mrParent.BlendTextColor(basebmp::Color(GetTextColor()), mxTmpSurface, basegfx::B2IPoint(0, 0)); - mxTmpSurface.reset(); - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/headless/svpcairotextrender.hxx b/vcl/headless/svpcairotextrender.hxx index daae42c51842..1a0a1ec3b871 100644 --- a/vcl/headless/svpcairotextrender.hxx +++ b/vcl/headless/svpcairotextrender.hxx @@ -17,7 +17,6 @@ class SvpSalGraphics; class SvpCairoTextRender : public CairoTextRender { protected: - basebmp::BitmapDeviceSharedPtr mxTmpSurface; SvpSalGraphics& mrParent; public: @@ -28,7 +27,6 @@ public: virtual void getSurfaceOffset(double& nDX, double& nDY) override; virtual void clipRegion(cairo_t* cr) override; virtual void drawSurface(cairo_t* cr) override; - virtual basebmp::BitmapDeviceSharedPtr createSimpleMask() override; }; #endif diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 05e673cda733..1fd0820e1dd4 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -122,12 +122,6 @@ namespace #endif -basebmp::BitmapDeviceSharedPtr SvpSalGraphics::createSimpleMask() const -{ - return basebmp::createBitmapDevice(m_aOrigDevice->getSize(), true, basebmp::Format::OneBitLsbGrey, - cairo_format_stride_for_width(CAIRO_FORMAT_A1, m_aOrigDevice->getSize().getX())); -} - void SvpSalGraphics::clipRegion(cairo_t* cr) { RectangleVector aRectangles; diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index fe381fb16a04..ec7039a315e0 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -446,12 +446,9 @@ Format SvpSalInstance::getBaseBmpFormatForDeviceFormat(DeviceFormat eFormat) { case DeviceFormat::BITMASK: return Format::OneBitMsbPal; - case DeviceFormat::GRAYSCALE: - return Format::EightBitPal; default: return SVP_CAIRO_FORMAT; } - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx index 9eb39f263b69..cb6720ca0cd9 100644 --- a/vcl/headless/svptext.cxx +++ b/vcl/headless/svptext.cxx @@ -133,18 +133,4 @@ SystemFontData SvpSalGraphics::GetSysFontData( int nFallbacklevel ) const #endif // ENABLE_CAIRO_CANVAS -void SvpSalGraphics::BlendTextColor(const basebmp::Color &rTextColor, const basebmp::BitmapDeviceSharedPtr &rAlphaMask, - const basegfx::B2IPoint &rDstPoint) -{ - // blend text color into target using the glyph's mask - const basegfx::B2IBox aSrcRect(basegfx::B2ITuple(0,0), rAlphaMask->getSize()); - const basegfx::B2IBox aClipRect(rDstPoint, rAlphaMask->getSize()); - - SvpSalGraphics::ClipUndoHandle aUndo(this); - if (isClippedSetup(aClipRect, aUndo)) - return; - - m_aDevice->drawMaskedColor(rTextColor, rAlphaMask, aSrcRect, rDstPoint, m_aClipMap); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/cairotextrender.hxx b/vcl/inc/cairotextrender.hxx index 1ff7d94b85a5..60b1b8f7468e 100644 --- a/vcl/inc/cairotextrender.hxx +++ b/vcl/inc/cairotextrender.hxx @@ -81,10 +81,6 @@ protected: virtual cairo_t* getCairoContext() = 0; virtual void getSurfaceOffset(double& nDX, double& nDY) = 0; virtual void drawSurface(cairo_t* cr) = 0; - virtual basebmp::BitmapDeviceSharedPtr createSimpleMask() - { - return basebmp::BitmapDeviceSharedPtr(); - } bool setFont( const FontSelectPattern *pEntry, int nFallbackLevel ); diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 5320909791ff..686301d54ea4 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -64,9 +64,6 @@ class VCL_DLLPUBLIC SvpSalGraphics : public SalGraphics public: static GlyphCache& getPlatformGlyphCache(); - void BlendTextColor(const basebmp::Color &rTextColor, const basebmp::BitmapDeviceSharedPtr &rAlphaMask, - const basegfx::B2IPoint &rDstPoint); - basebmp::BitmapDeviceSharedPtr createSimpleMask() const; void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice); private: diff --git a/vcl/opengl/x11/salvd.cxx b/vcl/opengl/x11/salvd.cxx index 627661acf632..d6b8eaf4e286 100644 --- a/vcl/opengl/x11/salvd.cxx +++ b/vcl/opengl/x11/salvd.cxx @@ -44,16 +44,12 @@ X11OpenGLSalVirtualDevice::X11OpenGLSalVirtualDevice( SalGraphics* pGraphics, { assert(mpGraphics); - // TODO Do we really need the requested bit count? sal_uInt16 nBitCount; switch (eFormat) { case DeviceFormat::BITMASK: nBitCount = 1; break; - case DeviceFormat::GRAYSCALE: - nBitCount = 8; - break; default: nBitCount = pGraphics->GetBitCount(); break; diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx index b7717fa0f433..c09dd449e289 100644 --- a/vcl/quartz/salvd.cxx +++ b/vcl/quartz/salvd.cxx @@ -115,9 +115,11 @@ AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX case DeviceFormat::BITMASK: mnBitmapDepth = 1; break; +#ifdef IOS case DeviceFormat::GRAYSCALE: mnBitmapDepth = 8; break; +#endif default: mnBitmapDepth = 0; break; diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index a75afd6afbf0..f390855e7d7b 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -698,7 +698,7 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize Rectangle aRect(aEmptyPoint, aStdSize ); ScopedVclPtrInstance< VirtualDevice > aVirDevice(*Application::GetDefaultDevice(), - DeviceFormat::FULLCOLOR, DeviceFormat::BITMASK); + DeviceFormat::DEFAULT, DeviceFormat::BITMASK); aVirDevice->SetOutputSizePixel( aStdSize ); aVirDevice->SetFillColor( COL_TRANSPARENT ); aVirDevice->SetLineColor( COL_TRANSPARENT ); diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index b7be53beb206..21d1f112a641 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -886,7 +886,7 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile& rMtf, const Gradient& rGrad ) { // Generate comment, GradientEx and Gradient actions (within DrawGradient) - ScopedVclPtrInstance< VirtualDevice > aVDev(rMapDev, DeviceFormat::FULLCOLOR); + ScopedVclPtrInstance< VirtualDevice > aVDev(rMapDev, DeviceFormat::DEFAULT); aVDev->EnableOutput( false ); GDIMetaFile aGradMtf; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index a454704cfb3c..13906b435b01 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2222,7 +2222,7 @@ OutputDevice* PDFWriterImpl::getReferenceDevice() { if( ! m_pReferenceDevice ) { - VclPtrInstance pVDev(DeviceFormat::FULLCOLOR); + VclPtrInstance pVDev(DeviceFormat::DEFAULT); m_pReferenceDevice = pVDev; diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 4557dc232c94..cab8fa3953f3 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -165,8 +165,6 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev, { case DeviceFormat::BITMASK: mnBitCount = 1; - case DeviceFormat::GRAYSCALE: - mnBitCount = 8; default: mnBitCount = pOutDev->GetBitCount(); break; @@ -453,7 +451,7 @@ bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( const basebmp::RawMemorySharedArray &pBuffer, const basebmp::RawMemorySharedArray &pAlphaBuffer ) { if (pAlphaBuffer) - meAlphaFormat = DeviceFormat::GRAYSCALE; + meAlphaFormat = DeviceFormat::DEFAULT; if (pBuffer) { MapMode mm = GetMapMode(); diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index d2b452c3c6b6..6402639c6f47 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -1437,8 +1437,8 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP // paint metafile to VDev VclPtrInstance pMaskedDevice(*i_pTargetOutDev, - DeviceFormat::FULLCOLOR, - DeviceFormat::FULLCOLOR); + DeviceFormat::DEFAULT, + DeviceFormat::DEFAULT); pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() ); pMaskedDevice->EnableRTL( IsRTLEnabled() ); aMtf.WindStart(); diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx index a45faa4f8061..11d4e6cc19a1 100644 --- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx +++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx @@ -301,9 +301,8 @@ namespace cairo **/ int X11Surface::getDepth() const { - if( maSysData.pRenderFormat ) + if (maSysData.pRenderFormat) return static_cast(maSysData.pRenderFormat)->depth; - return -1; } @@ -315,15 +314,13 @@ namespace cairo DeviceFormat X11Surface::getFormat() const { if (!maSysData.pRenderFormat) - return DeviceFormat::FULLCOLOR; + return DeviceFormat::DEFAULT; switch (static_cast(maSysData.pRenderFormat)->depth) { case 1: return DeviceFormat::BITMASK; - case 8: - return DeviceFormat::GRAYSCALE; default: - return DeviceFormat::FULLCOLOR; + return DeviceFormat::DEFAULT; } } } diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index d86677beb12d..97b1d3be778b 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -104,9 +104,6 @@ X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics* pGraphics, long &nDX, long case DeviceFormat::BITMASK: nBitCount = 1; break; - case DeviceFormat::GRAYSCALE: - nBitCount = 8; - break; default: nBitCount = pGraphics->GetBitCount(); break; diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx index 09ce9a089d81..39c34534ebd9 100644 --- a/vcl/unx/gtk/gtksalframe.cxx +++ b/vcl/unx/gtk/gtksalframe.cxx @@ -406,7 +406,7 @@ void GtkSalFrame::doKeyCallback( guint state, if (keyval == GDK_0) { fprintf( stderr, "force widget_queue_draw\n"); - gtk_widget_queue_draw (m_pFixedContainer); + gtk_widget_queue_draw(GTK_WIDGET(m_pFixedContainer)); return; } else if (keyval == GDK_1) diff --git a/vcl/unx/gtk3/cairo_gtk3_cairo.cxx b/vcl/unx/gtk3/cairo_gtk3_cairo.cxx index 25e5a0ce1264..4f6c7934af78 100644 --- a/vcl/unx/gtk3/cairo_gtk3_cairo.cxx +++ b/vcl/unx/gtk3/cairo_gtk3_cairo.cxx @@ -109,7 +109,7 @@ namespace cairo VclPtr Gtk3Surface::createVirtualDevice() const { - return VclPtrInstance(nullptr, Size(1, 1), DeviceFormat::FULLCOLOR); + return VclPtrInstance(nullptr, Size(1, 1), DeviceFormat::DEFAULT); } } diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index 9b2136c0a0ca..2cfef6f5f770 100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx @@ -79,9 +79,6 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, case DeviceFormat::BITMASK: nBitCount = 1; break; - case DeviceFormat::GRAYSCALE: - nBitCount = 8; - break; default: nBitCount = 0; break; diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 7e398ed12daf..768e72562e41 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -789,7 +789,7 @@ public: if ((int)eType < RENDER_AS_BITMAPEX) pNested = VclPtr::Create(rDev).get(); else - pNested = VclPtr::Create(rDev,DeviceFormat::FULLCOLOR,DeviceFormat::FULLCOLOR).get(); + pNested = VclPtr::Create(rDev,DeviceFormat::DEFAULT,DeviceFormat::DEFAULT).get(); pNested->SetOutputSizePixel(r.GetSize()); Rectangle aWhole(Point(0,0), r.GetSize()); -- cgit