Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
d9d16df2
Kaydet (Commit)
d9d16df2
authored
Tem 19, 2014
tarafından
Norbert Thiebaud
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
vcl quartz: draw 'bullet' manually for better control
Change-Id: If0f6bd93adc5d39fd421bb482833619f85f7a461
üst
6ca2d0d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
43 deletions
+37
-43
sallayout.hxx
vcl/inc/sallayout.hxx
+1
-1
ctlayout.cxx
vcl/quartz/ctlayout.cxx
+36
-42
No files found.
vcl/inc/sallayout.hxx
Dosyayı görüntüle @
d9d16df2
...
@@ -78,7 +78,7 @@ public:
...
@@ -78,7 +78,7 @@ public:
// positioning related inputs
// positioning related inputs
const
DeviceCoordinate
*
mpDXArray
;
// in pixel units
const
DeviceCoordinate
*
mpDXArray
;
// in pixel units
DeviceCoordinate
mnLayoutWidth
;
// in pixel units
DeviceCoordinate
mnLayoutWidth
;
// in pixel units
int
mnOrientation
;
// in 0-3600 system
int
mnOrientation
;
// in 0-3600 system
// data for bidi and glyph+script fallback
// data for bidi and glyph+script fallback
...
...
vcl/quartz/ctlayout.cxx
Dosyayı görüntüle @
d9d16df2
...
@@ -341,11 +341,12 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons
...
@@ -341,11 +341,12 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons
// the view is vertically flipped => flipped glyphs
// the view is vertically flipped => flipped glyphs
// so apply a temporary transformation that it flips back
// so apply a temporary transformation that it flips back
// also compensate if the font was size limited
// also compensate if the font was size limited
SAL_INFO
(
"vcl.ct"
,
"CGContextSaveGState("
<<
rAquaGraphics
.
mrContext
<<
")"
);
CGContextRef
context
=
rAquaGraphics
.
mrContext
;
CGContextSaveGState
(
rAquaGraphics
.
mrContext
);
SAL_INFO
(
"vcl.ct"
,
"CGContextSaveGState("
<<
context
<<
")"
);
SAL_INFO
(
"vcl.ct"
,
"CGContextScaleCTM("
<<
rAquaGraphics
.
mrContext
<<
",1.0,-1.0)"
);
CGContextSaveGState
(
context
);
CGContextScaleCTM
(
rAquaGraphics
.
mrContext
,
1.0
,
-
1.0
);
SAL_INFO
(
"vcl.ct"
,
"CGContextScaleCTM("
<<
context
<<
",1.0,-1.0)"
);
CGContextSetShouldAntialias
(
rAquaGraphics
.
mrContext
,
!
rAquaGraphics
.
mbNonAntialiasedText
);
CGContextScaleCTM
(
context
,
1.0
,
-
1.0
);
CGContextSetShouldAntialias
(
context
,
!
rAquaGraphics
.
mbNonAntialiasedText
);
// set the text transformation (e.g. position)
// set the text transformation (e.g. position)
CGPoint
aTextPos
=
GetTextDrawPosition
();
CGPoint
aTextPos
=
GetTextDrawPosition
();
...
@@ -353,49 +354,46 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons
...
@@ -353,49 +354,46 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons
if
(
pStyle
->
mfFontRotation
!=
0.0
)
if
(
pStyle
->
mfFontRotation
!=
0.0
)
{
{
const
CGFloat
fRadians
=
pStyle
->
mfFontRotation
;
const
CGFloat
fRadians
=
pStyle
->
mfFontRotation
;
SAL_INFO
(
"vcl.ct"
,
"CGContextRotateCTM("
<<
rAquaGraphics
.
mrC
ontext
<<
","
<<
+
fRadians
<<
")"
);
SAL_INFO
(
"vcl.ct"
,
"CGContextRotateCTM("
<<
c
ontext
<<
","
<<
+
fRadians
<<
")"
);
CGContextRotateCTM
(
rAquaGraphics
.
mrC
ontext
,
+
fRadians
);
CGContextRotateCTM
(
c
ontext
,
+
fRadians
);
const
CGAffineTransform
aInvMatrix
=
CGAffineTransformMakeRotation
(
-
fRadians
);
const
CGAffineTransform
aInvMatrix
=
CGAffineTransformMakeRotation
(
-
fRadians
);
aTextPos
=
CGPointApplyAffineTransform
(
aTextPos
,
aInvMatrix
);
aTextPos
=
CGPointApplyAffineTransform
(
aTextPos
,
aInvMatrix
);
}
}
SAL_INFO
(
"vcl.ct"
,
"CGContextSetTextPosition("
<<
rAquaGraphics
.
mrC
ontext
<<
","
<<
aTextPos
<<
")"
);
SAL_INFO
(
"vcl.ct"
,
"CGContextSetTextPosition("
<<
c
ontext
<<
","
<<
aTextPos
<<
")"
);
CGContextSetTextPosition
(
rAquaGraphics
.
mrC
ontext
,
aTextPos
.
x
,
aTextPos
.
y
);
CGContextSetTextPosition
(
c
ontext
,
aTextPos
.
x
,
aTextPos
.
y
);
#ifndef IOS
#ifndef IOS
// request an update of the to-be-changed window area
// request an update of the to-be-changed window area
if
(
rAquaGraphics
.
IsWindowGraphics
()
)
if
(
rAquaGraphics
.
IsWindowGraphics
()
)
{
{
const
CGRect
aInkRect
=
CTLineGetImageBounds
(
mpCTLine
,
rAquaGraphics
.
mrC
ontext
);
const
CGRect
aInkRect
=
CTLineGetImageBounds
(
mpCTLine
,
c
ontext
);
const
CGRect
aRefreshRect
=
CGContextConvertRectToDeviceSpace
(
rAquaGraphics
.
mrC
ontext
,
aInkRect
);
const
CGRect
aRefreshRect
=
CGContextConvertRectToDeviceSpace
(
c
ontext
,
aInkRect
);
rAquaGraphics
.
RefreshRect
(
aRefreshRect
);
rAquaGraphics
.
RefreshRect
(
aRefreshRect
);
}
}
#endif
#endif
// set the text color as fill color (see kCTForegroundColorFromContextAttributeName)
// set the text color as fill color (see kCTForegroundColorFromContextAttributeName)
CGContextSetFillColor
(
rAquaGraphics
.
mrC
ontext
,
rAquaGraphics
.
maTextColor
.
AsArray
()
);
CGContextSetFillColor
(
c
ontext
,
rAquaGraphics
.
maTextColor
.
AsArray
()
);
SAL_INFO
(
"vcl.ct"
,
"CTLineDraw("
<<
ctline
<<
","
<<
rAquaGraphics
.
mrC
ontext
<<
")"
);
SAL_INFO
(
"vcl.ct"
,
"CTLineDraw("
<<
ctline
<<
","
<<
c
ontext
<<
")"
);
// draw the text
// draw the text
CTLineDraw
(
ctline
,
rAquaGraphics
.
mrC
ontext
);
CTLineDraw
(
ctline
,
c
ontext
);
if
(
mnLayoutFlags
&
SAL_LAYOUT_DRAW_BULLET
)
if
(
mnLayoutFlags
&
SAL_LAYOUT_DRAW_BULLET
)
{
{
CFArrayRef
runArray
=
CTLineGetGlyphRuns
(
ctline
);
CFArrayRef
runArray
=
CTLineGetGlyphRuns
(
ctline
);
CFIndex
runCount
=
CFArrayGetCount
(
runArray
);
CFIndex
runCount
=
CFArrayGetCount
(
runArray
);
CFIndex
runIndex
=
0
;
for
(
CFIndex
runIndex
=
0
;
runIndex
<
runCount
;
runIndex
++
)
CTLineRef
ctlinebullet
=
0
;
OUString
sBullet
((
sal_Unicode
)
0xb7
);
// centered bullet
for
(;
runIndex
<
runCount
;
runIndex
++
)
{
{
CTRunRef
run
=
(
CTRunRef
)
CFArrayGetValueAtIndex
(
runArray
,
runIndex
);
CTRunRef
run
=
(
CTRunRef
)
CFArrayGetValueAtIndex
(
runArray
,
runIndex
);
CFIndex
runGlyphCount
=
CTRunGetGlyphCount
(
run
);
CFIndex
runGlyphCount
=
CTRunGetGlyphCount
(
run
);
CGPoint
position
;
CGPoint
position
;
CGSize
advance
;
CFIndex
runGlyphIndex
=
0
;
CFIndex
runGlyphIndex
=
0
;
CFIndex
stringIndice
=
0
;
CFIndex
stringIndice
=
0
;
...
@@ -407,36 +405,32 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons
...
@@ -407,36 +405,32 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons
UniChar
curChar
=
CFStringGetCharacterAtIndex
(
CFAttributedStringGetString
(
mpAttrString
),
stringIndice
);
UniChar
curChar
=
CFStringGetCharacterAtIndex
(
CFAttributedStringGetString
(
mpAttrString
),
stringIndice
);
if
(
curChar
==
' '
)
if
(
curChar
==
' '
)
{
{
CGFloat
ascent
;
CGFloat
descent
;
CGFloat
leading
;
double
fWidth
=
CTRunGetTypographicBounds
(
run
,
glyphRange
,
&
ascent
,
&
descent
,
&
leading
);
CTRunGetPositions
(
run
,
glyphRange
,
&
position
);
CTRunGetPositions
(
run
,
glyphRange
,
&
position
);
// print a dot
CTRunGetAdvances
(
run
,
glyphRange
,
&
advance
);
if
(
!
ctlinebullet
)
CGRect
bulletRect
=
NSMakeRect
(
aTextPos
.
x
+
position
.
x
+
advance
.
width
/
4
,
{
aTextPos
.
y
+
position
.
y
+
ascent
/
3
-
fWidth
/
2
,
fWidth
/
2
,
fWidth
/
2
);
CFStringRef
aCFText
=
CFStringCreateWithCharactersNoCopy
(
NULL
,
CGContextSaveGState
(
context
);
sBullet
.
getStr
(),
RGBAColor
bulletColor
(
MAKE_SALCOLOR
(
0x26
,
0x8b
,
0xd2
));
// NON_PRINTING_CHARACTER_COLOR
1
,
CGContextSetFillColor
(
context
,
bulletColor
.
AsArray
()
);
kCFAllocatorNull
);
CGContextSetStrokeColor
(
context
,
bulletColor
.
AsArray
());
// CFAttributedStringCreate copies the attribues parameter
CFAttributedStringRef
bulletAttrString
=
CFAttributedStringCreate
(
NULL
,
aCFText
,
mpTextStyle
->
GetStyleDict
()
);
CGContextBeginPath
(
context
);
ctlinebullet
=
CTLineCreateWithAttributedString
(
bulletAttrString
);
CGContextAddEllipseInRect
(
context
,
bulletRect
);
CFRelease
(
aCFText
);
CGContextDrawPath
(
context
,
kCGPathFillStroke
);
// Or kCGPathFill
CFRelease
(
bulletAttrString
);
CGContextRestoreGState
(
context
);
RGBAColor
bulletColor
(
MAKE_SALCOLOR
(
0x26
,
0x8b
,
0xd2
));
// NON_PRINTING_CHARACTER_COLOR
CGContextSetFillColor
(
rAquaGraphics
.
mrContext
,
bulletColor
.
AsArray
()
);
}
CGContextSetTextPosition
(
rAquaGraphics
.
mrContext
,
aTextPos
.
x
+
position
.
x
,
position
.
y
+
aTextPos
.
y
);
CTLineDraw
(
ctlinebullet
,
rAquaGraphics
.
mrContext
);
}
}
}
}
}
}
if
(
ctlinebullet
)
{
CFRelease
(
ctlinebullet
);
}
}
}
// restore the original graphic context transformations
// restore the original graphic context transformations
SAL_INFO
(
"vcl.ct"
,
"CGContextRestoreGState("
<<
rAquaGraphics
.
mrC
ontext
<<
")"
);
SAL_INFO
(
"vcl.ct"
,
"CGContextRestoreGState("
<<
c
ontext
<<
")"
);
CGContextRestoreGState
(
rAquaGraphics
.
mrC
ontext
);
CGContextRestoreGState
(
c
ontext
);
}
}
void
CTLayout
::
DrawText
(
SalGraphics
&
rGraphics
)
const
void
CTLayout
::
DrawText
(
SalGraphics
&
rGraphics
)
const
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment