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
bebe347c
Kaydet (Commit)
bebe347c
authored
May 08, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
refactor "workben" classes to use RenderContext
Change-Id: I9363d4d90df7c74cf7462494ceda2e2f47607dc9
üst
3d9edac6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
106 deletions
+112
-106
outdevgrind.cxx
vcl/workben/outdevgrind.cxx
+4
-4
svptest.cxx
vcl/workben/svptest.cxx
+94
-93
vcldemo.cxx
vcl/workben/vcldemo.cxx
+14
-9
No files found.
vcl/workben/outdevgrind.cxx
Dosyayı görüntüle @
bebe347c
...
...
@@ -820,7 +820,7 @@ void grindFunc( OutputDevice& rTarget,
/** Call OutputDevice render methods repeatedly, and output elapsed
time to stdout
*/
void
outDevGrind
(
OutputDevice
&
rTarget
,
sal_Int32
nTurns
=
100
)
void
outDevGrind
(
vcl
::
RenderContext
&
rTarget
,
sal_Int32
nTurns
=
100
)
{
// TODO(F1): also profile pure complex clip setup times!
...
...
@@ -879,10 +879,10 @@ void outDevGrind( OutputDevice& rTarget, sal_Int32 nTurns=100 )
}
}
void
TestWindow
::
Paint
(
vcl
::
RenderContext
&
/*rRenderContext*/
,
const
Rectangle
&
)
void
TestWindow
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
)
{
outDevGrind
(
*
this
);
fflush
(
stdout
);
outDevGrind
(
rRenderContext
);
fflush
(
stdout
);
}
sal_uInt16
GrindApp
::
Exception
(
sal_uInt16
nError
)
...
...
vcl/workben/svptest.cxx
Dosyayı görüntüle @
bebe347c
...
...
@@ -220,122 +220,123 @@ static Color approachColor( const Color& rFrom, const Color& rTo )
}
#define DELTA 5.0
void
MyWin
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
rRect
)
void
MyWin
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
rRect
)
{
WorkWindow
::
Paint
(
rRenderContext
,
rRect
);
Push
(
PushFlags
::
ALL
);
MapMode
aMapMode
(
MAP_100TH_MM
);
SetMapMode
(
aMapMode
);
Size
aPaperSize
=
GetOutputSize
();
Point
aCenter
(
aPaperSize
.
Width
()
/
2
-
300
,
(
aPaperSize
.
Height
()
-
8400
)
/
2
+
8400
);
Point
aP1
(
aPaperSize
.
Width
()
/
48
,
0
),
aP2
(
aPaperSize
.
Width
()
/
40
,
0
),
aPoint
;
DrawRect
(
Rectangle
(
Point
(
0
,
0
),
aPaperSize
)
);
DrawRect
(
Rectangle
(
Point
(
100
,
100
),
Size
(
aPaperSize
.
Width
()
-
200
,
aPaperSize
.
Height
()
-
200
)
)
);
DrawRect
(
Rectangle
(
Point
(
200
,
200
),
Size
(
aPaperSize
.
Width
()
-
400
,
aPaperSize
.
Height
()
-
400
)
)
);
DrawRect
(
Rectangle
(
Point
(
300
,
300
),
Size
(
aPaperSize
.
Width
()
-
600
,
aPaperSize
.
Height
()
-
600
)
)
);
const
int
nFontCount
=
GetDevFontCount
();
const
int
nFontSamples
=
(
nFontCount
<
15
)
?
nFontCount
:
15
;
for
(
int
i
=
0
;
i
<
nFontSamples
;
++
i
)
rRenderContext
.
Push
(
PushFlags
::
ALL
);
MapMode
aMapMode
(
MAP_100TH_MM
);
rRenderContext
.
SetMapMode
(
aMapMode
);
Size
aPaperSize
=
rRenderContext
.
GetOutputSize
();
Point
aCenter
(
aPaperSize
.
Width
()
/
2
-
300
,
(
aPaperSize
.
Height
()
-
8400
)
/
2
+
8400
);
Point
aP1
(
aPaperSize
.
Width
()
/
48
,
0
),
aP2
(
aPaperSize
.
Width
()
/
40
,
0
);
Point
aPoint
;
rRenderContext
.
DrawRect
(
Rectangle
(
Point
(
0
,
0
),
aPaperSize
));
rRenderContext
.
DrawRect
(
Rectangle
(
Point
(
100
,
100
),
Size
(
aPaperSize
.
Width
()
-
200
,
aPaperSize
.
Height
()
-
200
)));
rRenderContext
.
DrawRect
(
Rectangle
(
Point
(
200
,
200
),
Size
(
aPaperSize
.
Width
()
-
400
,
aPaperSize
.
Height
()
-
400
)));
rRenderContext
.
DrawRect
(
Rectangle
(
Point
(
300
,
300
),
Size
(
aPaperSize
.
Width
()
-
600
,
aPaperSize
.
Height
()
-
600
)));
const
int
nFontCount
=
rRenderContext
.
GetDevFontCount
();
const
int
nFontSamples
=
(
nFontCount
<
15
)
?
nFontCount
:
15
;
for
(
int
i
=
0
;
i
<
nFontSamples
;
++
i
)
{
vcl
::
FontInfo
aFont
=
GetDevFont
(
(
i
*
nFontCount
)
/
nFontSamples
);
aFont
.
SetHeight
(
400
+
(
i
%
7
)
*
100
);
aFont
.
SetOrientation
(
i
*
(
3600
/
nFontSamples
)
);
SetFont
(
aFont
);
vcl
::
FontInfo
aFont
=
rRenderContext
.
GetDevFont
((
i
*
nFontCount
)
/
nFontSamples
);
aFont
.
SetHeight
(
400
+
(
i
%
7
)
*
100
);
aFont
.
SetOrientation
(
i
*
(
3600
/
nFontSamples
)
);
rRenderContext
.
SetFont
(
aFont
);
sal_uInt8
nRed
=
(
i
<<
6
)
&
0xC0
;
sal_uInt8
nGreen
=
(
i
<<
4
)
&
0xC0
;
sal_uInt8
nBlue
=
(
i
<<
2
)
&
0xC0
;
SetTextColor
(
Color
(
nRed
,
nGreen
,
nBlue
)
);
rRenderContext
.
SetTextColor
(
Color
(
nRed
,
nGreen
,
nBlue
)
);
OUStringBuffer
aPrintText
(
1024
);
long
nMaxWidth
=
0
;
aPrintText
.
appendAscii
(
"SVP test program"
);
DrawText
(
Rectangle
(
Point
(
(
aPaperSize
.
Width
()
-
4000
)
/
2
,
2000
),
Size
(
aPaperSize
.
Width
()
-
2100
-
nMaxWidth
,
aPaperSize
.
Height
()
-
4000
)
),
aPrintText
.
makeStringAndClear
(),
TEXT_DRAW_MULTILINE
);
rRenderContext
.
DrawText
(
Rectangle
(
Point
((
aPaperSize
.
Width
()
-
4000
)
/
2
,
2000
),
Size
(
aPaperSize
.
Width
()
-
2100
-
nMaxWidth
,
aPaperSize
.
Height
()
-
4000
)),
aPrintText
.
makeStringAndClear
(),
TEXT_DRAW_MULTILINE
);
}
SetFillColor
();
DrawRect
(
Rectangle
(
Point
(
aPaperSize
.
Width
()
-
4000
,
1000
),
Size
(
3000
,
3000
)
)
);
DrawBitmap
(
Point
(
aPaperSize
.
Width
()
-
4000
,
1000
),
Size
(
3000
,
3000
),
m_aBitmap
);
Color
aWhite
(
0xff
,
0xff
,
0xff
);
Color
aBlack
(
0
,
0
,
0
);
Color
aLightRed
(
0xff
,
0
,
0
);
Color
aDarkRed
(
0x40
,
0
,
0
);
Color
aLightBlue
(
0
,
0
,
0xff
);
Color
aDarkBlue
(
0
,
0
,
0x40
);
Color
aLightGreen
(
0
,
0xff
,
0
);
Color
aDarkGreen
(
0
,
0x40
,
0
);
Gradient
aGradient
(
GradientStyle_LINEAR
,
aBlack
,
aWhite
);
aGradient
.
SetAngle
(
900
);
DrawGradient
(
Rectangle
(
Point
(
1000
,
4500
),
Size
(
aPaperSize
.
Width
()
-
2000
,
500
)
),
aGradient
);
aGradient
.
SetStartColor
(
aDarkRed
);
aGradient
.
SetEndColor
(
aLightBlue
);
DrawGradient
(
Rectangle
(
Point
(
1000
,
5300
),
Size
(
aPaperSize
.
Width
()
-
2000
,
500
)
),
aGradient
);
aGradient
.
SetStartColor
(
aDarkBlue
);
aGradient
.
SetEndColor
(
aLightGreen
);
DrawGradient
(
Rectangle
(
Point
(
1000
,
6100
),
Size
(
aPaperSize
.
Width
()
-
2000
,
500
)
),
aGradient
);
aGradient
.
SetStartColor
(
aDarkGreen
);
aGradient
.
SetEndColor
(
aLightRed
);
DrawGradient
(
Rectangle
(
Point
(
1000
,
6900
),
Size
(
aPaperSize
.
Width
()
-
2000
,
500
)
),
aGradient
);
LineInfo
aLineInfo
(
LINE_SOLID
,
200
);
double
sind
=
sin
(
DELTA
*
M_PI
/
180.0
);
double
cosd
=
cos
(
DELTA
*
M_PI
/
180.0
);
double
factor
=
1
+
(
DELTA
/
1000.0
);
int
n
=
0
;
Color
aLineColor
(
0
,
0
,
0
);
Color
aApproachColor
(
0
,
0
,
200
);
while
(
aP2
.
X
()
<
aCenter
.
X
()
&&
n
++
<
680
)
rRenderContext
.
SetFillColor
();
DrawRect
(
Rectangle
(
Point
(
aPaperSize
.
Width
()
-
4000
,
1000
),
Size
(
3000
,
3000
)));
rRenderContext
.
DrawBitmap
(
Point
(
aPaperSize
.
Width
()
-
4000
,
1000
),
Size
(
3000
,
3000
),
m_aBitmap
);
Color
aWhite
(
0xff
,
0xff
,
0xff
);
Color
aBlack
(
0
,
0
,
0
);
Color
aLightRed
(
0xff
,
0
,
0
);
Color
aDarkRed
(
0x40
,
0
,
0
);
Color
aLightBlue
(
0
,
0
,
0xff
);
Color
aDarkBlue
(
0
,
0
,
0x40
);
Color
aLightGreen
(
0
,
0xff
,
0
);
Color
aDarkGreen
(
0
,
0x40
,
0
);
Gradient
aGradient
(
GradientStyle_LINEAR
,
aBlack
,
aWhite
);
aGradient
.
SetAngle
(
900
);
rRenderContext
.
DrawGradient
(
Rectangle
(
Point
(
1000
,
4500
),
Size
(
aPaperSize
.
Width
()
-
2000
,
500
)),
aGradient
);
aGradient
.
SetStartColor
(
aDarkRed
);
aGradient
.
SetEndColor
(
aLightBlue
);
rRenderContext
.
DrawGradient
(
Rectangle
(
Point
(
1000
,
5300
),
Size
(
aPaperSize
.
Width
()
-
2000
,
500
)),
aGradient
);
aGradient
.
SetStartColor
(
aDarkBlue
);
aGradient
.
SetEndColor
(
aLightGreen
);
rRenderContext
.
DrawGradient
(
Rectangle
(
Point
(
1000
,
6100
),
Size
(
aPaperSize
.
Width
()
-
2000
,
500
)),
aGradient
);
aGradient
.
SetStartColor
(
aDarkGreen
);
aGradient
.
SetEndColor
(
aLightRed
);
rRenderContext
.
DrawGradient
(
Rectangle
(
Point
(
1000
,
6900
),
Size
(
aPaperSize
.
Width
()
-
2000
,
500
)),
aGradient
);
LineInfo
aLineInfo
(
LINE_SOLID
,
200
);
double
sind
=
sin
(
DELTA
*
M_PI
/
180.0
);
double
cosd
=
cos
(
DELTA
*
M_PI
/
180.0
);
double
factor
=
1
+
(
DELTA
/
1000.0
);
int
n
=
0
;
Color
aLineColor
(
0
,
0
,
0
);
Color
aApproachColor
(
0
,
0
,
200
);
while
(
aP2
.
X
()
<
aCenter
.
X
()
&&
n
++
<
680
)
{
aLineInfo
.
SetWidth
(
n
/
3
);
aLineColor
=
approachColor
(
aLineColor
,
aApproachColor
);
SetLineColor
(
aLineColor
);
aLineInfo
.
SetWidth
(
n
/
3
);
aLineColor
=
approachColor
(
aLineColor
,
aApproachColor
);
rRenderContext
.
SetLineColor
(
aLineColor
);
// switch aproach color
if
(
aApproachColor
.
IsRGBEqual
(
aLineColor
)
)
if
(
aApproachColor
.
IsRGBEqual
(
aLineColor
)
)
{
if
(
aApproachColor
.
GetRed
()
)
aApproachColor
=
Color
(
0
,
0
,
200
);
else
if
(
aApproachColor
.
GetGreen
()
)
aApproachColor
=
Color
(
200
,
0
,
0
);
if
(
aApproachColor
.
GetRed
()
)
aApproachColor
=
Color
(
0
,
0
,
200
);
else
if
(
aApproachColor
.
GetGreen
()
)
aApproachColor
=
Color
(
200
,
0
,
0
);
else
aApproachColor
=
Color
(
0
,
200
,
0
);
aApproachColor
=
Color
(
0
,
200
,
0
);
}
DrawLine
(
project
(
aP1
)
+
aCenter
,
project
(
aP2
)
+
aCenter
,
aLineInfo
);
rRenderContext
.
DrawLine
(
project
(
aP1
)
+
aCenter
,
project
(
aP2
)
+
aCenter
,
aLineInfo
);
aPoint
.
X
()
=
(
int
)((((
double
)
aP1
.
X
())
*
cosd
-
((
double
)
aP1
.
Y
())
*
sind
)
*
factor
);
aPoint
.
Y
()
=
(
int
)((((
double
)
aP1
.
Y
())
*
cosd
+
((
double
)
aP1
.
X
())
*
sind
)
*
factor
);
aP1
=
aPoint
;
...
...
@@ -343,7 +344,7 @@ void MyWin::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect )
aPoint
.
Y
()
=
(
int
)((((
double
)
aP2
.
Y
())
*
cosd
+
((
double
)
aP2
.
X
())
*
sind
)
*
factor
);
aP2
=
aPoint
;
}
Pop
();
rRenderContext
.
Pop
();
}
void
MyWin
::
Resize
()
...
...
vcl/workben/vcldemo.cxx
Dosyayı görüntüle @
bebe347c
...
...
@@ -1074,7 +1074,7 @@ public:
}
};
void
drawToDevice
(
OutputDevice
&
rDev
,
Size
aSize
,
bool
bVDev
)
void
drawToDevice
(
vcl
::
RenderContext
&
rDev
,
Size
aSize
,
bool
bVDev
)
{
RenderContext
aCtx
;
double
mnStartTime
;
...
...
@@ -1417,28 +1417,33 @@ public:
mrRenderer
.
SetSizePixel
(
GetSizePixel
());
mrRenderer
.
KeyInput
(
rKEvt
);
}
virtual
void
Paint
(
vcl
::
RenderContext
&
/*rRenderContext*/
,
const
Rectangle
&
rRect
)
SAL_OVERRIDE
virtual
void
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
rRect
)
SAL_OVERRIDE
{
mrRenderer
.
SetSizePixel
(
GetSizePixel
());
fprintf
(
stderr
,
"DemoWin::Paint(%ld,%ld,%ld,%ld)
\n
"
,
rRect
.
getX
(),
rRect
.
getY
(),
rRect
.
getWidth
(),
rRect
.
getHeight
());
if
(
mrRenderer
.
getIterCount
()
==
0
)
mrRenderer
.
drawToDevice
(
*
this
,
GetSizePixel
(),
false
);
mrRenderer
.
drawToDevice
(
rRenderContext
,
GetSizePixel
(),
false
);
else
TestAndQuit
();
TestAndQuit
(
rRenderContext
);
}
void
TestAndQuit
()
void
TestAndQuit
(
vcl
::
RenderContext
&
rRenderContext
)
{
if
(
underTesting
)
return
;
underTesting
=
true
;
if
(
underTesting
)
return
;
underTesting
=
true
;
for
(
sal_Int32
i
=
0
;
i
<
mrRenderer
.
getIterCount
();
i
++
)
{
while
(
mrRenderer
.
selectNextRenderer
()
>
-
1
)
mrRenderer
.
drawToDevice
(
*
this
,
GetSizePixel
(),
false
);
{
mrRenderer
.
drawToDevice
(
rRenderContext
,
GetSizePixel
(),
false
);
}
}
double
expandedGEOMEAN
=
mrRenderer
.
getAndResetBenchmark
(
RENDER_EXPANDED
);
for
(
sal_Int32
i
=
0
;
i
<
mrRenderer
.
getIterCount
();
i
++
)
mrRenderer
.
drawToDevice
(
*
this
,
GetSizePixel
(),
false
);
mrRenderer
.
drawToDevice
(
rRenderContext
,
GetSizePixel
(),
false
);
double
thumbGEOMEAN
=
mrRenderer
.
getAndResetBenchmark
(
RENDER_THUMB
);
...
...
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