diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-20 10:12:53 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-20 14:37:02 -0500 |
commit | b3b57c7a3a43a056217c72716d18bdeced029b66 (patch) | |
tree | 7c44dafab345ffa40eb2281cd37909d75958b7a4 /drawinglayer | |
parent | 82599357ae6066b002ca2bd2b7060b26e51ba00f (diff) |
Same solid line treatment for vertical lines during on-screen drawing.
Change-Id: Idb352dc2afeb2ee7b48620c972c2a186209228ea
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 53 |
1 files changed, 42 insertions, 11 deletions
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index f1429a1e4384..d037d0c8a2cc 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -271,15 +271,20 @@ namespace drawinglayer { case table::BorderLineStyle::SOLID: { + const basegfx::BColor aLineColor = + maBColorModifierStack.getModifiedColor(rSource.getRGBColorLeft()); + double nThick = rtl::math::round(rSource.getLeftWidth()); + + bool bDraw = false; + bool bAsLine = false; + basegfx::B2DPolygon aTarget; + if (fY1 == fY2) { // Horizontal line. Draw it as a rectangle. + bDraw = true; - const basegfx::BColor aLineColor = - maBColorModifierStack.getModifiedColor(rSource.getRGBColorLeft()); - double nThick = rtl::math::round(rSource.getLeftWidth()); - - basegfx::B2DPolygon aTarget = makeRectPolygon(fX1, fY1, fX2-fX1, nThick); + aTarget = makeRectPolygon(fX1, fY1, fX2-fX1, nThick); aTarget.transform(maCurrentTransformation); basegfx::B2DRange aRange = aTarget.getB2DRange(); @@ -291,20 +296,46 @@ namespace drawinglayer aTarget.clear(); aTarget.append(basegfx::B2DPoint(aRange.getMinX(), aRange.getMinY())); aTarget.append(basegfx::B2DPoint(aRange.getMaxX(), aRange.getMinY())); + bAsLine = true; + } + } + else if (fX1 == fX2) + { + // Vertical line. Draw it as a rectangle. + bDraw = true; + + aTarget = makeRectPolygon(fX1, fY1, nThick, fY2-fY1); + aTarget.transform(maCurrentTransformation); - mpOutputDevice->SetFillColor(); - mpOutputDevice->SetLineColor(Color(aLineColor)); + basegfx::B2DRange aRange = aTarget.getB2DRange(); + double fW = aRange.getWidth(); - mpOutputDevice->DrawPolyLine(aTarget); - return true; + if (fW <= 1.0) + { + // Draw it as a line. + aTarget.clear(); + aTarget.append(basegfx::B2DPoint(aRange.getMinX(), aRange.getMinY())); + aTarget.append(basegfx::B2DPoint(aRange.getMinX(), aRange.getMaxY())); + bAsLine = true; } + } + + if (!bDraw) + return false; + if (bAsLine) + { + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(Color(aLineColor)); + mpOutputDevice->DrawPolyLine(aTarget); + } + else + { mpOutputDevice->SetFillColor(Color(aLineColor)); mpOutputDevice->SetLineColor(); - mpOutputDevice->DrawPolygon(aTarget); - return true; } + return true; } break; case table::BorderLineStyle::DOTTED: |