From 22d1ac9eb5757ec5a51ec377d3ed31bf520f4ae0 Mon Sep 17 00:00:00 2001 From: Izik Eidus Date: Fri, 9 Apr 2010 05:06:32 +0300 Subject: spice: win32 client: fix gdi locking While the fix could have been more effective, it seems like this patch stream better with the coding logic that was there..., maybe later we will want to change the locking into more effective way. (There is just the primary surface to protect in reiality) Signed-off-by: Izik Eidus --- client/red_pixmap_gdi.h | 4 ++-- client/windows/pixels_source.cpp | 2 +- client/windows/pixels_source_p.h | 4 ++-- client/windows/red_drawable.cpp | 14 +++++++------- client/windows/red_pixmap_gdi.cpp | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'client') diff --git a/client/red_pixmap_gdi.h b/client/red_pixmap_gdi.h index d5a028a8..6bf28fd0 100644 --- a/client/red_pixmap_gdi.h +++ b/client/red_pixmap_gdi.h @@ -20,7 +20,7 @@ #include "red_pixmap.h" -class Mutex; +class RecurciveMutex; class RedPixmapGdi: public RedPixmap { public: @@ -29,7 +29,7 @@ public: HDC get_dc(); void *get_memptr(); ~RedPixmapGdi(); - Mutex& get_mutex(); + RecurciveMutex& get_mutex(); }; #endif diff --git a/client/windows/pixels_source.cpp b/client/windows/pixels_source.cpp index 178b88fd..7b6fe813 100644 --- a/client/windows/pixels_source.cpp +++ b/client/windows/pixels_source.cpp @@ -41,7 +41,7 @@ PixelsSource::PixelsSource() _origin.x = _origin.y = 0; memset(_opaque, 0, sizeof(_opaque)); PixelsSource_p* p_data = (PixelsSource_p*)_opaque; - p_data->_mutex = new Mutex(); + p_data->_mutex = new RecurciveMutex(); } PixelsSource::~PixelsSource() diff --git a/client/windows/pixels_source_p.h b/client/windows/pixels_source_p.h index eb646395..0f59f2d7 100644 --- a/client/windows/pixels_source_p.h +++ b/client/windows/pixels_source_p.h @@ -18,11 +18,11 @@ #ifndef _H_PIXELE_SOURSR_P #define _H_PIXELE_SOURSR_P -class Mutex; +class RecurciveMutex; struct PixelsSource_p { HDC dc; - Mutex* _mutex; + RecurciveMutex* _mutex; }; #endif diff --git a/client/windows/red_drawable.cpp b/client/windows/red_drawable.cpp index cac7299e..bc01adec 100644 --- a/client/windows/red_drawable.cpp +++ b/client/windows/red_drawable.cpp @@ -51,8 +51,8 @@ void RedDrawable::blend_pixels(const PixelsSource& src, int src_x, int src_y, co PixelsSource_p* dest_p_data = (PixelsSource_p*)get_opaque(); PixelsSource_p* src_p_data = (PixelsSource_p*)src.get_opaque(); for (;;) { - Lock lock(*dest_p_data->_mutex); - Lock timed_lock(*src_p_data->_mutex, lock_timout); + RecurciveLock lock(*dest_p_data->_mutex); + RecurciveLock timed_lock(*src_p_data->_mutex, lock_timout); if (!timed_lock.is_locked()) { continue; } @@ -84,8 +84,8 @@ void RedDrawable::combine_pixels(const PixelsSource& src, int src_x, int src_y, PixelsSource_p* dest_p_data = (PixelsSource_p*)get_opaque(); PixelsSource_p* src_p_data = (PixelsSource_p*)src.get_opaque(); for (;;) { - Lock lock(*dest_p_data->_mutex); - Lock timed_lock(*src_p_data->_mutex, lock_timout); + RecurciveLock lock(*dest_p_data->_mutex); + RecurciveLock timed_lock(*src_p_data->_mutex, lock_timout); if (!timed_lock.is_locked()) { continue; } @@ -106,7 +106,7 @@ void RedDrawable::erase_rect(const SpiceRect& rect, rgb32_t color) r.bottom = rect.bottom + _origin.y; PixelsSource_p* dest_p_data = (PixelsSource_p*)get_opaque(); - Lock lock(*dest_p_data->_mutex); + RecurciveLock lock(*dest_p_data->_mutex); FillRect(dest_p_data->dc, &r, (HBRUSH)GetStockObject(BLACK_BRUSH)); } @@ -123,7 +123,7 @@ void RedDrawable::fill_rect(const SpiceRect& rect, rgb32_t color) rgb32_get_blue(color))); for (;;) { PixelsSource_p* dest_p_data = (PixelsSource_p*)get_opaque(); - Lock lock(*dest_p_data->_mutex); + RecurciveLock lock(*dest_p_data->_mutex); FillRect(dest_p_data->dc, &r, brush); break; } @@ -142,7 +142,7 @@ void RedDrawable::frame_rect(const SpiceRect& rect, rgb32_t color) rgb32_get_blue(color))); for (;;) { PixelsSource_p* dest_p_data = (PixelsSource_p*)get_opaque(); - Lock lock(*dest_p_data->_mutex); + RecurciveLock lock(*dest_p_data->_mutex); FrameRect(dest_p_data->dc, &r, brush); break; } diff --git a/client/windows/red_pixmap_gdi.cpp b/client/windows/red_pixmap_gdi.cpp index adb21da8..860c90c0 100644 --- a/client/windows/red_pixmap_gdi.cpp +++ b/client/windows/red_pixmap_gdi.cpp @@ -94,7 +94,7 @@ RedPixmapGdi::~RedPixmapGdi() } } -Mutex& RedPixmapGdi::get_mutex() +RecurciveMutex& RedPixmapGdi::get_mutex() { RedPixmap_p* p_data = (RedPixmap_p*)get_opaque(); return *p_data->pixels_source_p._mutex; -- cgit