Basic changes for clearer code review

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/gnustep_testplant_branch@36651 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2013-05-19 22:46:35 +00:00
parent 09301e648c
commit 95a8e8d68f

View file

@ -31,7 +31,6 @@
#include "win32/WIN32Server.h" #include "win32/WIN32Server.h"
#include <cairo-win32.h> #include <cairo-win32.h>
#define GSWINDEVICE ((HWND)gsDevice)
@implementation WIN32Server (ScreenCapture) @implementation WIN32Server (ScreenCapture)
- (NSImage *) contentsOfScreen: (int)screen inRect: (NSRect)rect - (NSImage *) contentsOfScreen: (int)screen inRect: (NSRect)rect
@ -143,6 +142,10 @@
@implementation Win32CairoSurface @implementation Win32CairoSurface
- (HWND)gsDevice
{
return (HWND)gsDevice;
}
- (id) initWithDevice: (void *)device - (id) initWithDevice: (void *)device
{ {
@ -185,6 +188,9 @@
// And deallocate ourselves... // And deallocate ourselves...
DESTROY(self); DESTROY(self);
// Release the device context...
ReleaseDC(device, hDC);
} }
} }
else else
@ -262,7 +268,7 @@
} }
else else
{ {
ReleaseDC(GSWINDEVICE, cairo_win32_surface_get_dc(_surface)); ReleaseDC([self gsDevice], cairo_win32_surface_get_dc(_surface));
} }
} }
[super dealloc]; [super dealloc];
@ -286,7 +292,7 @@
{ {
RECT csize; RECT csize;
GetClientRect(GSWINDEVICE, &csize); GetClientRect([self gsDevice], &csize);
return NSMakeSize(csize.right - csize.left, csize.bottom - csize.top); return NSMakeSize(csize.right - csize.left, csize.bottom - csize.top);
} }
@ -298,7 +304,7 @@
- (void) handleExposeRect: (NSRect)rect - (void) handleExposeRect: (NSRect)rect
{ {
// If the surface is buffered then we will have been invoked... // If the surface is buffered then we will have been invoked...
HDC hdc = GetDC(GSWINDEVICE); HDC hdc = GetDC([self gsDevice]);
// Make sure we got a HDC... // Make sure we got a HDC...
if (hdc == NULL) if (hdc == NULL)
@ -338,7 +344,7 @@
{ {
double backupOffsetX = 0; double backupOffsetX = 0;
double backupOffsetY = 0; double backupOffsetY = 0;
RECT msRect = GSWindowRectToMS((WIN32Server*)GSCurrentServer(), GSWINDEVICE, rect); RECT msRect = GSWindowRectToMS((WIN32Server*)GSCurrentServer(), [self gsDevice], rect);
// Need to save the device offset context... // Need to save the device offset context...
cairo_surface_get_device_offset(_surface, &backupOffsetX, &backupOffsetY); cairo_surface_get_device_offset(_surface, &backupOffsetX, &backupOffsetY);
@ -371,7 +377,7 @@
} }
// Release the aquired HDC... // Release the aquired HDC...
ReleaseDC(GSWINDEVICE, hdc); ReleaseDC([self gsDevice], hdc);
} }
} }