[Libreoffice-commits] core.git: sw/source

Armin Le Grand alg at apache.org
Tue Oct 7 13:00:40 PDT 2014


 sw/source/core/layout/paintfrm.cxx |   33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

New commits:
commit 1e09d294f443f015e51c601d1b02f19389fb90ac
Author: Armin Le Grand <alg at apache.org>
Date:   Tue Oct 7 16:20:59 2014 +0000

    Resolves: #i125698# Finetuned visualization for aligned AAed areas
    
    (cherry picked from commit f4d179a8f647336b27098ebb2e0418b22b3ba44e)
    
    Change-Id: Id80206de568048b517b62f31e702182f939771e5

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 4b963b9..be4fc5f 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1867,13 +1867,34 @@ bool DrawFillAttributes(
             !basegfx::fTools::equalZero(aPaintRange.getWidth()) &&
             !basegfx::fTools::equalZero(aPaintRange.getHeight()))
         {
-            //UUUU need to expand for correct AAed and non-AAed visualization as primitive; move
-            // bounds to half-(logical)pixel bounds and add a width/height of one pixel that is missing
-            // from SwRect/Rectangle integer handling
-            const basegfx::B2DVector aSingleUnit(rOut.GetInverseViewTransformation() * basegfx::B2DVector(0.5, 0.5));
+            const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
 
-            aPaintRange.expand(aPaintRange.getMinimum() - (aSingleUnit * 0.5));
-            aPaintRange.expand(aPaintRange.getMaximum() + (aSingleUnit * 1.5));
+            //UUUU need to expand for correct AAed and non-AAed visualization as primitive.
+            // This must probably be removed again when we will be able to get all Writer visualization
+            // as primitives and Writer prepares all it's stuff in high precision coordinates (also
+            // needs to avoid moving boundaries around to better show overlapping stuff...)
+            if(aSvtOptionsDrawinglayer.IsAntiAliasing())
+            {
+                // if AAed in principle expand by 0.5 in all directions. Since painting edges of
+                // AAed regions does not add to no transparence (0.5 opacity covered by 0.5 opacity
+                // is not full opacity but 0.75 opacity) we need some overlap here to avoid paint
+                // artifacts. Checked experimentally - a little bit more in Y is needed, probably
+                // due to still existing integer alignment and cruncing in writer.
+                static double fExpandX = 0.55;
+                static double fExpandY = 0.70;
+                const basegfx::B2DVector aSingleUnit(rOut.GetInverseViewTransformation() * basegfx::B2DVector(fExpandX, fExpandY));
+
+                aPaintRange.expand(aPaintRange.getMinimum() - aSingleUnit);
+                aPaintRange.expand(aPaintRange.getMaximum() + aSingleUnit);
+            }
+            else
+            {
+                // if not AAed expand by one unit to bottom right due to the missing unit
+                // from SwRect/Rectangle integer handling
+                const basegfx::B2DVector aSingleUnit(rOut.GetInverseViewTransformation() * basegfx::B2DVector(1.0, 1.0));
+
+                aPaintRange.expand(aPaintRange.getMaximum() + aSingleUnit);
+            }
 
             const basegfx::B2DRange aDefineRange(
                 rOriginalLayoutRect.Left(),


More information about the Libreoffice-commits mailing list