[Libreoffice-commits] core.git: include/vcl vcl/source

Michael Stahl mstahl at redhat.com
Wed Apr 27 16:49:40 UTC 2016


 include/vcl/print.hxx      |    4 ----
 vcl/source/gdi/print.cxx   |   13 -------------
 vcl/source/image/Image.cxx |    3 ++-
 3 files changed, 2 insertions(+), 18 deletions(-)

New commits:
commit ef52ce82bf55b37279e344ea5fef67b4277fb009
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Apr 27 14:50:05 2016 +0200

    tdf#89866 tdf#96504 vcl: fix printing of form controls with images
    
    Originally in 2004 commit 0339e43208cd7b98d302e420b39ac32911acaa56 added a
    "DBG_ASSERT( GetOutDevType() != OUTDEV_PRINTER, "DrawImage(): Images can't
     be drawn on any mprinter" );"
    
    Recently commit f749ffbdf4c007f1a42bcafc9c2723c47bac22d1 made the mistake
    of trusting this assertion to be correct and added Printer::DrawImage()
    overrides that do a hard "assert()" now and don't do any drawing.
    
    Armin claims that the implementation of OutputDevice::DrawImage() should
    actually work for Printer as well due to fall-backs and thus the
    original DBG_ASSERT was misleading.
    
    This matters when printing documents that contain form controls
    such as ImageControl.
    
    Additionally, Image::Draw() should not return early when
    IsDeviceOutputNecessary() is false, because that is the case when
    printing, where instead a meta-file is recorded.
    The called OutputDevice::DrawBitmapEx() will check
    IsDeviceOutputNecessary() internally anyway.
    
    This check was actually always there, so i do not understand how this
    should have worked in LO 4.2, as the bug reporters claim.
    
    Change-Id: I92ba19e7036197d1dde88c361f8e1cb59fae3a60

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index e92e13d..bf5112a 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -372,10 +372,6 @@ public:
     virtual void                CopyArea( const Point& rDestPt, const Point& rSrcPt,
                                     const Size& rSrcSize, bool bWindowInvalidate = false ) override;
 
-    virtual void                DrawImage( const Point&, const Image&, DrawImageFlags ) override;
-    virtual void                DrawImage( const Point&, const Size&, const Image&, DrawImageFlags ) override;
-
-
     // These 3 together are more modular PrintJob(), allowing printing more documents as one print job
     // by repeated calls to ExecutePrintJob(). Used by mailmerge.
     static bool                 PreparePrintJob( std::shared_ptr<vcl::PrinterController> i_pController,
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 7256053..8e07fd0 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1792,19 +1792,6 @@ void Printer::SetFontOrientation( LogicalFontInstance* const pFontEntry ) const
     pFontEntry->mnOrientation = pFontEntry->mxFontMetric->GetOrientation();
 }
 
-void Printer::DrawImage( const Point&, const Image&, DrawImageFlags )
-{
-    SAL_WARN ("vcl.gdi", "DrawImage(): Images can't be drawn on any Printer instance");
-    assert(false);
-}
-
-void Printer::DrawImage( const Point&, const Size&, const Image&, DrawImageFlags )
-{
-    SAL_WARN ("vcl.gdi", "DrawImage(): Images can't be drawn on any Printer instance");
-    assert(false);
-}
-
-
 Bitmap Printer::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
 {
     SAL_WARN("vcl.gdi", "GetBitmap(): This should never be called on by a Printer instance");
diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx
index dedc0cf..607fed2 100644
--- a/vcl/source/image/Image.cxx
+++ b/vcl/source/image/Image.cxx
@@ -228,7 +228,8 @@ bool Image::operator==(const Image& rImage) const
 
 void Image::Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize)
 {
-    if (mpImplData == nullptr || !mpImplData->mpBitmapEx || !pOutDev->IsDeviceOutputNecessary())
+    if (mpImplData == nullptr || !mpImplData->mpBitmapEx ||
+        (!pOutDev->IsDeviceOutputNecessary() && pOutDev->GetConnectMetaFile() == nullptr))
         return;
 
     const Point aSrcPos(0, 0);


More information about the Libreoffice-commits mailing list