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
16068663
Kaydet (Commit)
16068663
authored
Kas 10, 2014
tarafından
Michael Meeks
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
vcldemo: load and render some icons
Change-Id: I4a4567d43e4c5c8a7ce7ba2764d2f9668fed291f
üst
2ca7304c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
26 deletions
+58
-26
vcldemo.cxx
vcl/workben/vcldemo.cxx
+58
-26
No files found.
vcl/workben/vcldemo.cxx
Dosyayı görüntüle @
16068663
...
@@ -25,10 +25,9 @@
...
@@ -25,10 +25,9 @@
#include <vcl/virdev.hxx>
#include <vcl/virdev.hxx>
#include <vcl/graphicfilter.hxx>
#include <vcl/graphicfilter.hxx>
# define FIXME_ALPHA_WORKING
# define FIXME_ROUNDED_RECT_WORKING
# define FIXME_DRAW_TRANSPARENT_WORKING
#if 0
#if 0
# define FIXME_SELF_INTERSECTING_WORKING
# define FIXME_DRAW_BITMAPEX
#endif
#endif
using
namespace
css
;
using
namespace
css
;
...
@@ -99,7 +98,6 @@ public:
...
@@ -99,7 +98,6 @@ public:
rDev
.
SetLineColor
(
Color
(
COL_BLACK
));
rDev
.
SetLineColor
(
Color
(
COL_BLACK
));
rDev
.
DrawRect
(
r
);
rDev
.
DrawRect
(
r
);
// FIXME: notice these appear reflected at the bottom not the top.
for
(
int
i
=
0
;
i
<
r
.
GetHeight
();
i
+=
15
)
for
(
int
i
=
0
;
i
<
r
.
GetHeight
();
i
+=
15
)
rDev
.
DrawLine
(
Point
(
r
.
Left
(),
r
.
Top
()
+
i
),
Point
(
r
.
Right
(),
r
.
Bottom
()
-
i
)
);
rDev
.
DrawLine
(
Point
(
r
.
Left
(),
r
.
Top
()
+
i
),
Point
(
r
.
Right
(),
r
.
Bottom
()
-
i
)
);
for
(
int
i
=
0
;
i
<
r
.
GetWidth
();
i
+=
15
)
for
(
int
i
=
0
;
i
<
r
.
GetWidth
();
i
+=
15
)
...
@@ -126,8 +124,7 @@ public:
...
@@ -126,8 +124,7 @@ public:
rDev
.
DrawText
(
r
,
OUString
(
"Just a simple text"
)
);
rDev
.
DrawText
(
r
,
OUString
(
"Just a simple text"
)
);
}
}
void
drawPoly
(
OutputDevice
&
rDev
,
Rectangle
r
)
void
drawPoly
(
OutputDevice
&
rDev
,
Rectangle
r
)
// pretty
// pretty
{
{
drawCheckered
(
rDev
,
r
);
drawCheckered
(
rDev
,
r
);
...
@@ -181,14 +178,10 @@ public:
...
@@ -181,14 +178,10 @@ public:
BitmapEx
aBitmap
(
maIntro
);
BitmapEx
aBitmap
(
maIntro
);
aBitmap
.
Scale
(
r
.
GetSize
(),
BMP_SCALE_BESTQUALITY
);
aBitmap
.
Scale
(
r
.
GetSize
(),
BMP_SCALE_BESTQUALITY
);
#ifdef FIXME_ALPHA_WORKING
AlphaMask
aSemiTransp
(
aBitmap
.
GetSizePixel
());
AlphaMask
aSemiTransp
(
aBitmap
.
GetSizePixel
());
aSemiTransp
.
Erase
(
64
);
aSemiTransp
.
Erase
(
64
);
rDev
.
DrawBitmapEx
(
r
.
TopLeft
(),
BitmapEx
(
aBitmap
.
GetBitmap
(),
rDev
.
DrawBitmapEx
(
r
.
TopLeft
(),
BitmapEx
(
aBitmap
.
GetBitmap
(),
aSemiTransp
));
aSemiTransp
));
#else
rDev
.
DrawBitmapEx
(
r
.
TopLeft
(),
aBitmap
);
#endif
}
}
void
drawPolyPolgons
(
OutputDevice
&
rDev
,
Rectangle
r
)
void
drawPolyPolgons
(
OutputDevice
&
rDev
,
Rectangle
r
)
...
@@ -196,8 +189,13 @@ public:
...
@@ -196,8 +189,13 @@ public:
struct
{
struct
{
double
nX
,
nY
;
double
nX
,
nY
;
}
aPoints
[]
=
{
{
0.1
,
0.1
},
{
0.9
,
0.9
},
}
aPoints
[]
=
{
{
0.1
,
0.1
},
{
0.9
,
0.9
},
#ifdef FIXME_SELF_INTERSECTING_WORKING
{
0.9
,
0.1
},
{
0.1
,
0.9
},
{
0.9
,
0.1
},
{
0.1
,
0.9
},
{
0.1
,
0.1
}
};
{
0.1
,
0.1
}
};
#else
{
0.1
,
0.9
},
{
0.5
,
0.5
},
{
0.9
,
0.1
},
{
0.1
,
0.1
}
};
#endif
tools
::
PolyPolygon
aPolyPoly
;
tools
::
PolyPolygon
aPolyPoly
;
// Render 4x polygons & aggregate into another PolyPolygon
// Render 4x polygons & aggregate into another PolyPolygon
...
@@ -228,16 +226,12 @@ public:
...
@@ -228,16 +226,12 @@ public:
}
}
rDev
.
SetLineColor
(
Color
(
COL_LIGHTRED
));
rDev
.
SetLineColor
(
Color
(
COL_LIGHTRED
));
rDev
.
SetFillColor
(
Color
(
COL_GREEN
));
rDev
.
SetFillColor
(
Color
(
COL_GREEN
));
#ifdef FIXME_DRAW_TRANSPARENT_WORKING
rDev
.
DrawTransparent
(
aPolyPoly
,
50
);
rDev
.
DrawTransparent
(
aPolyPoly
,
50
);
#else
rDev
.
DrawPolyPolygon
(
aPolyPoly
);
#endif
}
}
void
drawToVirtualDevice
(
OutputDevice
&
rDev
,
Rectangle
r
)
void
drawToVirtualDevice
(
OutputDevice
&
rDev
,
Rectangle
r
)
{
{
VirtualDevice
aNested
;
VirtualDevice
aNested
(
rDev
)
;
aNested
.
SetOutputSize
(
r
.
GetSize
());
aNested
.
SetOutputSize
Pixel
(
r
.
GetSize
());
Rectangle
aWhole
(
Point
(
0
,
0
),
r
.
GetSize
());
Rectangle
aWhole
(
Point
(
0
,
0
),
r
.
GetSize
());
// mini me
// mini me
drawToDevice
(
aNested
,
true
);
drawToDevice
(
aNested
,
true
);
...
@@ -246,9 +240,52 @@ public:
...
@@ -246,9 +240,52 @@ public:
rDev
.
DrawBitmap
(
r
.
TopLeft
(),
aBitmap
);
rDev
.
DrawBitmap
(
r
.
TopLeft
(),
aBitmap
);
}
}
std
::
vector
<
BitmapEx
>
maIcons
;
void
initIcons
()
{
if
(
maIcons
.
size
())
return
;
const
char
*
pNames
[]
=
{
"cmd/lc_openurl.png"
,
"cmd/lc_newdoc.png"
,
"cmd/lc_save.png"
,
"cmd/lc_saveas.png"
,
"cmd/lc_sendmail.png"
,
"cmd/lc_editdoc.png"
,
"cmd/lc_print.png"
,
"cmd/lc_printpreview.png"
,
"cmd/lc_cut.png"
,
"cmd/lc_copy.png"
,
"cmd/lc_paste.png"
,
"cmd/lc_formatpaintbrush.png"
,
"cmd/lc_undo.png"
,
"cmd/lc_redo.png"
,
};
for
(
size_t
i
=
0
;
i
<
SAL_N_ELEMENTS
(
pNames
);
i
++
)
maIcons
.
push_back
(
BitmapEx
(
OUString
::
createFromAscii
(
pNames
[
i
])));
}
void
drawIcons
(
OutputDevice
&
rDev
,
Rectangle
r
)
{
initIcons
();
Rectangle
p
(
r
);
for
(
size_t
i
=
0
;
i
<
maIcons
.
size
();
i
++
)
{
Size
aSize
(
maIcons
[
i
].
GetSizePixel
());
#ifdef FIXME_DRAW_BITMAPEX
rDev
.
DrawBitmapEx
(
p
.
TopLeft
(),
maIcons
[
i
]);
#else
rDev
.
DrawBitmap
(
p
.
TopLeft
(),
maIcons
[
i
].
GetBitmap
());
#endif
p
.
Move
(
aSize
.
Width
(),
0
);
if
(
p
.
Left
()
>=
r
.
Right
())
break
;
}
}
void
fetchDrawBitmap
(
OutputDevice
&
rDev
,
Rectangle
r
)
void
fetchDrawBitmap
(
OutputDevice
&
rDev
,
Rectangle
r
)
{
{
// FIXME: should work ...
Bitmap
aBitmap
(
GetBitmap
(
Point
(
0
,
0
),
rDev
.
GetOutputSizePixel
()));
Bitmap
aBitmap
(
GetBitmap
(
Point
(
0
,
0
),
rDev
.
GetOutputSizePixel
()));
aBitmap
.
Scale
(
r
.
GetSize
(),
BMP_SCALE_BESTQUALITY
);
aBitmap
.
Scale
(
r
.
GetSize
(),
BMP_SCALE_BESTQUALITY
);
rDev
.
DrawBitmap
(
r
.
TopLeft
(),
aBitmap
);
rDev
.
DrawBitmap
(
r
.
TopLeft
(),
aBitmap
);
...
@@ -277,15 +314,9 @@ std::vector<Rectangle> DemoWin::partitionAndClear(OutputDevice &rDev, int nX, in
...
@@ -277,15 +314,9 @@ std::vector<Rectangle> DemoWin::partitionAndClear(OutputDevice &rDev, int nX, in
rDev
.
SetLineColor
(
COL_GRAY
);
rDev
.
SetLineColor
(
COL_GRAY
);
rDev
.
SetFillColor
(
COL_LIGHTGRAY
);
rDev
.
SetFillColor
(
COL_LIGHTGRAY
);
if
((
x
+
y
)
%
2
)
if
((
x
+
y
)
%
2
)
rDev
.
DrawRect
(
r
);
else
{
#ifdef FIXME_ROUNDED_RECT_WORKING
rDev
.
DrawRect
(
r
,
nBorderSize
,
nBorderSize
);
rDev
.
DrawRect
(
r
,
nBorderSize
,
nBorderSize
);
#
else
else
rDev
.
DrawRect
(
r
);
rDev
.
DrawRect
(
r
);
#endif
}
aRegions
.
push_back
(
r
);
aRegions
.
push_back
(
r
);
}
}
...
@@ -311,8 +342,9 @@ void DemoWin::drawToDevice(OutputDevice &rDev, bool bVdev)
...
@@ -311,8 +342,9 @@ void DemoWin::drawToDevice(OutputDevice &rDev, bool bVdev)
drawPolyPolgons
(
rDev
,
aRegions
[
8
]);
drawPolyPolgons
(
rDev
,
aRegions
[
8
]);
if
(
!
bVdev
)
if
(
!
bVdev
)
drawToVirtualDevice
(
rDev
,
aRegions
[
9
]);
drawToVirtualDevice
(
rDev
,
aRegions
[
9
]);
drawIcons
(
rDev
,
aRegions
[
10
]);
// last - thumbnail all the above
// last - thumbnail all the above
fetchDrawBitmap
(
rDev
,
aRegions
[
1
0
]);
fetchDrawBitmap
(
rDev
,
aRegions
[
1
1
]);
}
}
class
DemoApp
:
public
Application
class
DemoApp
:
public
Application
...
...
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