2 * AxWin4 Interface Library
3 * - By John Hodge (thePowersGang)
6 * - Window drawing code
8 #include <axwin4/axwin.h>
9 #include "include/common.hpp"
10 #include <ipc_proto.hpp>
11 #include <algorithm> // min
15 void _push_data(tAxWin4_Window *Window, int X, int Y, unsigned int W, unsigned int H, const void *Data)
18 message.WriteU8(IPCMSG_PUSHDATA);
19 message.WriteU16(Window->m_id);
24 message.WriteBuffer(H*W*4, Data);
25 ::AxWin::SendMessage(message);
28 extern "C" void AxWin4_DrawBitmap(tAxWin4_Window *Window, int X, int Y, unsigned int W, unsigned int H, void *Data)
30 // TODO: Split message up into blocks such that it can be dispatched
33 const uint32_t* data32 = static_cast<uint32_t*>(Data);
34 const unsigned int rows_per_message = 1; // 2048 / W;
35 for( unsigned int row = 0; row < H; row += rows_per_message )
37 _push_data(Window, X, Y+row, W, ::std::min(rows_per_message,H-row), data32);
38 data32 += W*rows_per_message;
43 _push_data(Window, X, Y, W, H, Data);