Hi,

I was the person who removed the dog preview from Writer's Picture
dialogue. In it's place there is now a nice alpine landscape (that I
nabbed from the Writer icon, but whatever). Sadly, it's stretched
larger than its original size which leads to pixelation. This is a
condition I wanted to remedy before closing fdo#43976.
So, I wrote a patch, everything looks fine, but the preview image
can't be mirrored any more (or is maybe drawn mirrored somewhere it
can't be seen). Attaching this patch might be a bit embarrassing, but
I hope people here recognise that I am not really a programmer. Hints
very much appreciated.

Regards,

Astron.

(I know I could probably unify nWidth and nHeight to a const Size...
but I wanted to leave that for later...)
From 3c4321fc9477904f92eb2be70397deac0aee67d8 Mon Sep 17 00:00:00 2001
From: "Stefan Knorr (astron)" <heinzless...@gmail.com>
Date: Mon, 19 Dec 2011 12:37:59 +0100
Subject: [PATCH] FRMDLG: Try to draw replacement preview at original size

---
 sw/source/ui/frmdlg/frmpage.cxx |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 288141b..0d6bf7c 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -224,7 +224,7 @@ static FrmMap aHFlyHtmlMap[] =
     {SwFPos::FROMLEFT,      SwFPos::MIR_FROMLEFT,   text::HoriOrientation::NONE,      LB_FLY_REL_PG_FRAME}
 };
 
-// own vertical alignment map for to frame anchored objects
+// own vertical alignment map for objects anchored to frame
 #define VERT_FRAME_REL   (LB_FLY_VERT_FRAME|LB_FLY_VERT_PRTAREA)
 
 static FrmMap aVFrameMap[] =
@@ -1941,7 +1941,7 @@ IMPL_LINK( SwFrmPage, PosHdl, ListBox *, pLB )
 }
 
 /*--------------------------------------------------------------------
-    Description:    horizonal Pos
+    Description:    horizontal Pos
  --------------------------------------------------------------------*/
 IMPL_LINK( SwFrmPage, RelHdl, ListBox *, pLB )
 {
@@ -2562,7 +2562,15 @@ void BmpWindow::Paint( const Rectangle& )
     if(nRelGrf < nRelWin)
     {
         const long nWidth = aPntSz.Width();
-        aPntSz.Width() = aPntSz.Height() * nRelGrf /100;
+        const long nHeight = aPntSz.Height();
+        // if we use a replacement preview, try to draw at original size
+        if ( !bGraphic && ( aGrfSize.Width() <= aPntSz.Width() ) && ( aGrfSize.Height() <= aPntSz.Height() ) ) {
+            aPntSz.Width() = aGrfSize.Width();
+            aPntSz.Height() = aGrfSize.Height();
+            aPntPos.Y() += (nHeight - aPntSz.Height())/2 ;
+            }
+
+        else aPntSz.Width() = aPntSz.Height() * nRelGrf /100;
         if(!bLeftAlign)
             aPntPos.X() += nWidth - aPntSz.Width() ;
     }
-- 
1.7.5.4

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to