From 16068663e2aa984388be5f774b8f1917c12bf6f3 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Mon, 10 Nov 2014 12:16:15 +0000 Subject: vcldemo: load and render some icons Change-Id: I4a4567d43e4c5c8a7ce7ba2764d2f9668fed291f --- vcl/workben/vcldemo.cxx | 84 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 26 deletions(-) (limited to 'vcl/workben') diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index daa877f95385..1142e370064d 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -25,10 +25,9 @@ #include #include -# define FIXME_ALPHA_WORKING -# define FIXME_ROUNDED_RECT_WORKING -# define FIXME_DRAW_TRANSPARENT_WORKING #if 0 +# define FIXME_SELF_INTERSECTING_WORKING +# define FIXME_DRAW_BITMAPEX #endif using namespace css; @@ -99,7 +98,6 @@ public: rDev.SetLineColor(Color(COL_BLACK)); rDev.DrawRect( r ); - // FIXME: notice these appear reflected at the bottom not the top. for(int i=0; i 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) { - // FIXME: should work ... Bitmap aBitmap(GetBitmap(Point(0,0),rDev.GetOutputSizePixel())); aBitmap.Scale(r.GetSize(), BMP_SCALE_BESTQUALITY); rDev.DrawBitmap(r.TopLeft(), aBitmap); @@ -277,15 +314,9 @@ std::vector DemoWin::partitionAndClear(OutputDevice &rDev, int nX, in rDev.SetLineColor(COL_GRAY); rDev.SetFillColor(COL_LIGHTGRAY); if ((x + y) % 2) - rDev.DrawRect(r); - else - { -#ifdef FIXME_ROUNDED_RECT_WORKING rDev.DrawRect(r, nBorderSize, nBorderSize); -#else + else rDev.DrawRect(r); -#endif - } aRegions.push_back(r); } @@ -311,8 +342,9 @@ void DemoWin::drawToDevice(OutputDevice &rDev, bool bVdev) drawPolyPolgons(rDev, aRegions[8]); if (!bVdev) drawToVirtualDevice(rDev, aRegions[9]); + drawIcons(rDev, aRegions[10]); // last - thumbnail all the above - fetchDrawBitmap(rDev, aRegions[10]); + fetchDrawBitmap(rDev, aRegions[11]); } class DemoApp : public Application -- cgit