[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-text-background-color' - editeng/source include/vcl vcl/source
matteocam
matteo.campanelli at gmail.com
Sat May 24 10:03:45 PDT 2014
editeng/source/items/svxfont.cxx | 7 ++-----
include/vcl/font.hxx | 2 ++
include/vcl/outdev.hxx | 4 ++--
vcl/source/outdev/outdevstate.cxx | 5 -----
vcl/source/outdev/text.cxx | 19 ++++++++++++++++---
5 files changed, 22 insertions(+), 15 deletions(-)
New commits:
commit b09cf493611f2521e66159287b88acc3c05d6d33
Author: matteocam <matteo.campanelli at gmail.com>
Date: Sat May 24 13:02:43 2014 -0400
Moved Text Filling Color in OutDev. Text Filling occurs in ImplDrawText
Change-Id: I9c75066a8dea32721757d0511a2af58c68408438
diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index e9f2a71..718675b 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -459,14 +459,11 @@ void SvxFont::QuickDrawText( OutputDevice *pOut,
fprintf(stderr, "About to print %s\n", rTxt.getStr());
+
+
// Font has to be selected in OutputDevice...
if ( !IsCaseMap() && !IsCapital() && !IsKern() && !IsEsc() )
{
- // set right background
- if ( HasBackgroundColor() ) {
- Color aColor = COL_RED;
- pOut->SetTextFillColor(aColor);
- }
pOut->DrawTextArray( rPos, rTxt, pDXArray, nIdx, nLen );
return;
}
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index 7079c8d..0e1358f 100644
--- a/include/vcl/font.hxx
+++ b/include/vcl/font.hxx
@@ -61,7 +61,9 @@ public:
FontAlign GetAlign() const;
// XXX: now font has background iff it is (single-y) underlined
+ // also forces non transparency
bool HasBackgroundColor() const {
+
return GetUnderline() == UNDERLINE_SINGLE;
}
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 5336df1..21083ee 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -995,7 +995,7 @@ public:
void SetTextFillColor();
void SetTextFillColor( const Color& rColor );
Color GetTextFillColor() const;
- bool IsTextFillColor() const { return !maFont.IsTransparent(); }
+ bool IsTextFillColor() const { return maFont.GetUnderline() == UNDERLINE_SINGLE; /*return !maFont.IsTransparent();*/ }
void SetTextLineColor();
void SetTextLineColor( const Color& rColor );
@@ -1044,7 +1044,7 @@ private:
SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
- SAL_DLLPRIVATE bool ImplDrawTextDirect( SalLayout&, bool bTextLines, bool bTextBkg = false, sal_uInt32 flags = 0 );
+ SAL_DLLPRIVATE bool ImplDrawTextDirect( SalLayout&, bool bTextLines, sal_uInt32 flags = 0 );
SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& );
SAL_DLLPRIVATE void ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight );
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index 8787a6e..15fa53c 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -521,11 +521,6 @@ void OutputDevice::SetFont( const Font& rNewFont )
aFont.SetColor( aTextColor );
mbTextBackground = aFont.HasBackgroundColor();
- if ( mbTextBackground )
- {
- Color aRedColor ( COL_RED );
- SetBackground(aRedColor);
- }
bool bTransFill = aFont.IsTransparent();
if ( !bTransFill )
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index eea1569..a1a034c 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -281,7 +281,6 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout )
bool OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout,
bool bTextLines,
- bool bTextBkg,
sal_uInt32 flags )
{
if( mpFontEntry->mnOwnOrientation )
@@ -289,6 +288,8 @@ bool OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout,
return true;
+
+
long nOldX = rSalLayout.DrawBase().X();
if( HasMirroredGraphics() )
{
@@ -427,7 +428,7 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout )
if ( maFont.IsOutline() )
{
- if(! ImplDrawTextDirect( rSalLayout, mbTextLines, false, DRAWTEXT_F_OUTLINE))
+ if(! ImplDrawTextDirect( rSalLayout, mbTextLines, DRAWTEXT_F_OUTLINE))
{
rSalLayout.DrawBase() = aOrigPos + Point(-1,-1);
ImplDrawTextDirect( rSalLayout, mbTextLines );
@@ -472,13 +473,24 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout )
rSalLayout.DrawBase() += Point( mnTextOffX, mnTextOffY );
+ /*
+ if the text has some background get it (XXX: now getting fixed color)
+ and the set it as the new filling color
+ */
+ if (mbTextBackground) {
+ // set right background
+ Color aColor = COL_PINK;
+ // SetBackground does not work
+ SetFillColor(aColor);
+ }
+
if( IsTextFillColor() )
ImplDrawTextBackground( rSalLayout );
if( mbTextSpecial )
ImplDrawSpecialText( rSalLayout );
else
- ImplDrawTextDirect( rSalLayout, mbTextLines, mbTextBackground );
+ ImplDrawTextDirect( rSalLayout, mbTextLines );
}
long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
@@ -836,6 +848,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr,
nLen = rStr.getLength() - nIndex;
}
+
if( mpOutDevData && mpOutDevData->mpRecordLayout )
{
pVector = &mpOutDevData->mpRecordLayout->m_aUnicodeBoundRects;
More information about the Libreoffice-commits
mailing list