diff --git a/ChangeLog b/ChangeLog index 1e1f034..5db4044 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-03-28 Fred Kiefer + + * Source/x11/XWindowBuffer.m (+windowBufferForWindow:depthInfo:): + Return an autorelease instance. + * Source/cairo/XGCairoXImageSurface.m (-initWithDevice:), + * Source/art/ARTGState.m (-GSSetDevice:): Adopt callers. + 2009-03-12 Fred Kiefer * Source/x11/XGServerEvent.m: Correct formatting. diff --git a/Source/art/ARTGState.m b/Source/art/ARTGState.m index c15f2c4..8d33d81 100644 --- a/Source/art/ARTGState.m +++ b/Source/art/ARTGState.m @@ -618,7 +618,6 @@ draw_info_t ART_DI; -(void) GSSetDevice: (gswindow_device_t *)window : (int)x : (int)y { struct XWindowBuffer_depth_info_s di; - XWindowBuffer *new_wi; [self setOffset: NSMakePoint(x, y)]; @@ -628,16 +627,8 @@ draw_info_t ART_DI; di.bytes_per_pixel = DI.bytes_per_pixel; di.inline_alpha = DI.inline_alpha; di.inline_alpha_ofs = DI.inline_alpha_ofs; - new_wi = [XWindowBuffer windowBufferForWindow: window depthInfo: &di]; - if (new_wi != wi) - { - DESTROY(wi); - wi = new_wi; - } - else - { - DESTROY(new_wi); - } + + ASSIGN(wi, [XWindowBuffer windowBufferForWindow: window depthInfo: &di]); } -(void) GSCurrentDevice: (void **)device : (int *)x : (int *)y @@ -652,9 +643,9 @@ draw_info_t ART_DI; if (device) { if (wi) - *device = wi->window; + *device = wi->window; else - *device = NULL; + *device = NULL; } } diff --git a/Source/cairo/XGCairoXImageSurface.m b/Source/cairo/XGCairoXImageSurface.m index 82dfa46..39894a7 100644 --- a/Source/cairo/XGCairoXImageSurface.m +++ b/Source/cairo/XGCairoXImageSurface.m @@ -48,13 +48,13 @@ } di.drawing_depth = GSWINDEVICE->depth; - // FIXME: The next four lines may be wrong for depth <> 32. + // FIXME: The next lines may be wrong for depth <> 32. // But then art uses a depth of 24 for 32 bit modes. Strange! di.bytes_per_pixel = 4; di.inline_alpha = YES; di.inline_alpha_ofs = 0; - // FIXME: This method is somewhat special as it does not return an autoreleased object - wi = [XWindowBuffer windowBufferForWindow: GSWINDEVICE depthInfo: &di]; + + ASSIGN(wi, [XWindowBuffer windowBufferForWindow: GSWINDEVICE depthInfo: &di]); _surface = cairo_image_surface_create_for_data((unsigned char*)wi->data, CAIRO_FORMAT_ARGB32, diff --git a/Source/x11/XWindowBuffer.m b/Source/x11/XWindowBuffer.m index 460d322..1d781d3 100644 --- a/Source/x11/XWindowBuffer.m +++ b/Source/x11/XWindowBuffer.m @@ -412,7 +412,7 @@ no_xshm: wi->data = NULL; } - return wi; + return AUTORELEASE(wi); }