diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/wndmgr/animate.cpp | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/Wasabi/api/wndmgr/animate.cpp')
-rw-r--r-- | Src/Wasabi/api/wndmgr/animate.cpp | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/Src/Wasabi/api/wndmgr/animate.cpp b/Src/Wasabi/api/wndmgr/animate.cpp new file mode 100644 index 00000000..c5f789b7 --- /dev/null +++ b/Src/Wasabi/api/wndmgr/animate.cpp @@ -0,0 +1,96 @@ +#include <precomp.h> +#include <wasabicfg.h> +#include "animate.h" + +#include <api/config/items/cfgitem.h> + +//--------------------------------------------------------------------------- +void AnimatedRects::draw(const RECT *source, const RECT *dest, int steps) +{ +#ifdef WASABI_COMPILE_CONFIG + // {280876CF-48C0-40bc-8E86-73CE6BB462E5} + const GUID options_guid = + { 0x280876cf, 0x48c0, 0x40bc, { 0x8e, 0x86, 0x73, 0xce, 0x6b, 0xb4, 0x62, 0xe5 } }; + if (!_intVal(WASABI_API_CONFIG->config_getCfgItemByGuid(options_guid), L"Animated rects")) return; +#else + if (!WASABI_WNDMGR_ANIMATEDRECTS) return; +#endif + + //FG> Not anymore, old code, old bugs + //BU you're so cool, Francis + //FG> thank you, you're not too bad either :) + int sizex=source->right-source->left-(dest->right-dest->left); + int sizey=source->bottom-source->top-(dest->bottom-dest->top); + int diffx=source->left-dest->left; + int diffy=(source->top)-dest->top; + +#ifdef WIN32 + HDC dc; + dc=GetDC(0); + HBRUSH brush = CreateSolidBrush(0xFFFFFF); + HPEN pen = CreatePen(PS_SOLID,0,0xFFFFFF); + HBRUSH obrush = (HBRUSH)SelectObject(dc, brush); + HPEN open = (HPEN)SelectObject(dc, pen); + int oldrop = SetROP2(dc,R2_XORPEN); +#endif +#ifdef LINUX + HDC dc = (HDC)MALLOC( sizeof( hdc_typ ) ); + XGCValues gcv; + gcv.foreground = 0xffffff; + gcv.function = GXxor; + gcv.subwindow_mode = IncludeInferiors; + dc->gc = XCreateGC( Linux::getDisplay(), Linux::RootWin(), GCForeground | GCFunction | GCSubwindowMode, &gcv ); +#endif +//PORTME + + for(int i=0;i<steps;i++) { + int x=dest->left+diffx-((diffx*i)/steps); + int y=dest->top+diffy-((diffy*i)/steps); + int maxx=(source->right-source->left)-((sizex*i)/steps); + int maxy=(source->bottom-source->top)-((sizey*i)/steps); + +#ifdef WIN32 + int p1x=x,p1y=y; + int p2x=x+maxx,p2y=y; + int p3x=x+maxx,p3y=y+maxy; + int p4x=x,p4y=y+maxy; + MoveToEx(dc,p1x,p1y,NULL); + LineTo(dc,p2x,p2y); + LineTo(dc,p3x,p3y); + LineTo(dc,p4x,p4y); + LineTo(dc,p1x,p1y); +#endif +#ifdef LINUX + XDrawRectangle( Linux::getDisplay(), Linux::RootWin(), dc->gc, + x, y, maxx, maxy ); +#endif +//PORTME + Wasabi::Std::usleep(5); +#ifdef WIN32 + MoveToEx(dc,p1x,p1y,NULL); + LineTo(dc,p2x,p2y); + LineTo(dc,p3x,p3y); + LineTo(dc,p4x,p4y); + LineTo(dc,p1x,p1y); +#endif +#ifdef LINUX + XDrawRectangle( Linux::getDisplay(), Linux::RootWin(), dc->gc, + x, y, maxx, maxy ); +#endif +//PORTME + } +#ifdef WIN32 + SetROP2(dc, oldrop); + SelectObject(dc, open); + SelectObject(dc, obrush); + DeleteObject(brush); + DeleteObject(pen); + ReleaseDC(0,dc); +#endif +#ifdef LINUX + XFreeGC( Linux::getDisplay(), dc->gc ); + FREE( dc ); +#endif +//PORTME +} + |