summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-01-20 18:37:08 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-01-20 18:39:54 -0500
commit15974abe63f0d4fc88099634d5cd2ddb9760ec23 (patch)
tree3aa2bd8f358183c23442692247266fa4888c2aba
parentaf43015cd7316b7d611b357a96a415c23b51db5d (diff)
fdo#73487: Center thick border lines around cell grid.
This reduces the amount of gap at line joins. Plus it generally looks better this way. Change-Id: Ifd21cd0bc1f61f8a875b1bad9cfb33564c18b9ae
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx81
1 files changed, 66 insertions, 15 deletions
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 61145f529f44..fc9a19c0fd33 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -317,22 +317,38 @@ namespace drawinglayer
basegfx::B2DRange aRange = aTarget.getB2DRange();
double fH = aRange.getHeight();
- if (fH <= 1.0 || bDouble)
+ if (bDouble)
+ {
+ // Double line
+ drawHairLine(
+ mpOutputDevice, aRange.getMinX(), aRange.getMinY()-1.0, aRange.getMaxX(), aRange.getMinY()-1.0,
+ aLineColor);
+
+ drawHairLine(
+ mpOutputDevice, aRange.getMinX(), aRange.getMinY()+1.0, aRange.getMaxX(), aRange.getMinY()+1.0,
+ aLineColor);
+
+ return true;
+ }
+
+ if (fH <= 1.0)
{
// Draw it as a line.
drawHairLine(
mpOutputDevice, aRange.getMinX(), aRange.getMinY(), aRange.getMaxX(), aRange.getMinY(),
aLineColor);
- if (bDouble)
- {
- drawHairLine(
- mpOutputDevice, aRange.getMinX(), aRange.getMinY()+2.0, aRange.getMaxX(), aRange.getMinY()+2.0,
- aLineColor);
- }
-
return true;
}
+
+ double fOffset = rtl::math::round(fH/2.0, 0, rtl_math_RoundingMode_Down);
+ if (fOffset != 0.0)
+ {
+ // Move it up a bit to align it vertically centered.
+ basegfx::B2DHomMatrix aMat;
+ aMat.set(1, 2, -fOffset);
+ aTarget.transform(aMat);
+ }
}
else
{
@@ -344,21 +360,38 @@ namespace drawinglayer
basegfx::B2DRange aRange = aTarget.getB2DRange();
double fW = aRange.getWidth();
- if (fW <= 1.0 || bDouble)
+ if (bDouble)
+ {
+ // Draw it as a line.
+ drawHairLine(
+ mpOutputDevice, aRange.getMinX()-1.0, aRange.getMinY(), aRange.getMinX()-1.0, aRange.getMaxY(),
+ aLineColor);
+
+ drawHairLine(
+ mpOutputDevice, aRange.getMinX()+1.0, aRange.getMinY(), aRange.getMinX()+1.0, aRange.getMaxY(),
+ aLineColor);
+
+ return true;
+ }
+
+ if (fW <= 1.0)
{
// Draw it as a line.
drawHairLine(
mpOutputDevice, aRange.getMinX(), aRange.getMinY(), aRange.getMinX(), aRange.getMaxY(),
aLineColor);
- if (bDouble)
- {
- drawHairLine(
- mpOutputDevice, aRange.getMinX()+2.0, aRange.getMinY(), aRange.getMinX()+2.0, aRange.getMaxY(),
- aLineColor);
- }
return true;
}
+
+ double fOffset = rtl::math::round(fW/2.0, 0, rtl_math_RoundingMode_Down);
+ if (fOffset != 0.0)
+ {
+ // Move it to the left a bit to center it horizontally.
+ basegfx::B2DHomMatrix aMat;
+ aMat.set(0, 2, -fOffset);
+ aTarget.transform(aMat);
+ }
}
mpOutputDevice->SetFillColor(Color(aLineColor));
@@ -463,6 +496,15 @@ namespace drawinglayer
if (i >= n)
i = 0;
}
+
+ double fOffset = rtl::math::round(nThick/2.0, 0, rtl_math_RoundingMode_Down);
+ if (fOffset != 0.0)
+ {
+ // Move it up a bit to align it vertically centered.
+ basegfx::B2DHomMatrix aMat;
+ aMat.set(1, 2, -fOffset);
+ aTarget.transform(aMat);
+ }
}
else
{
@@ -535,6 +577,15 @@ namespace drawinglayer
if (i >= n)
i = 0;
}
+
+ double fOffset = rtl::math::round(nThick/2.0, 0, rtl_math_RoundingMode_Down);
+ if (fOffset != 0.0)
+ {
+ // Move it to the left a bit to center it horizontally.
+ basegfx::B2DHomMatrix aMat;
+ aMat.set(0, 2, -fOffset);
+ aTarget.transform(aMat);
+ }
}
mpOutputDevice->SetFillColor(Color(aLineColor));