summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2013-07-02 14:48:11 +0100
committerJon TURNEY <jon.turney@dronecode.org.uk>2013-07-03 15:29:20 +0100
commit66a2e3e5e51ce936970de5f2cef1e32dd3144386 (patch)
tree8ad703745b0265ba21551e79271b954514dcbe18
parent9a8a966e8b7deb9ef18ce7745759535163a2a927 (diff)
Use xcwm_image_copy_partial() in WM_PAINT
Perhaps a bit more efficent that using xcwm_image_copy_full()
-rw-r--r--src/wndproc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/wndproc.c b/src/wndproc.c
index 2466cd6..ec68b04 100644
--- a/src/wndproc.c
+++ b/src/wndproc.c
@@ -1209,8 +1209,14 @@ winTopLevelWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
else
{
- /* XXX: would be more efficient if we could just ask for the part we need */
- xcwm_image_t *image = xcwm_image_copy_full(window);
+ /* Ask for an image of the part of the window we need to repaint */
+ xcwm_rect_t area;
+ area.x = ps.rcPaint.left;
+ area.y = ps.rcPaint.top;
+ area.width = ps.rcPaint.right - ps.rcPaint.left;
+ area.height = ps.rcPaint.bottom - ps.rcPaint.top;
+
+ xcwm_image_t *image = xcwm_image_copy_partial(window, &area);
if (image)
{
CheckForAlpha(hWnd, image);
@@ -1219,7 +1225,7 @@ winTopLevelWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
BitBltFromImage(image, hdcUpdate,
ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top,
- ps.rcPaint.left, ps.rcPaint.top);
+ 0, 0);
xcwm_image_destroy(image);
}