Mercurial > dwindows
comparison mac/dw.m @ 827:dc094750d284
Fixed leak in dw_draw_text() not releasing the dictionary which was also pulling the NSColor along.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 26 Mar 2011 20:59:54 +0000 |
parents | 6bb8bff36548 |
children | 14c9f4a8839e |
comparison
equal
deleted
inserted
replaced
826:6bb8bff36548 | 827:dc094750d284 |
---|---|
4143 { | 4143 { |
4144 [dict setValue:font forKey:NSFontAttributeName]; | 4144 [dict setValue:font forKey:NSFontAttributeName]; |
4145 } | 4145 } |
4146 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict]; | 4146 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict]; |
4147 [image unlockFocus]; | 4147 [image unlockFocus]; |
4148 [dict release]; | |
4148 } | 4149 } |
4149 _DWLastDrawable = handle; | 4150 _DWLastDrawable = handle; |
4150 } | 4151 } |
4151 if(pixmap) | 4152 if(pixmap) |
4152 { | 4153 { |
4164 { | 4165 { |
4165 [dict setValue:font forKey:NSFontAttributeName]; | 4166 [dict setValue:font forKey:NSFontAttributeName]; |
4166 } | 4167 } |
4167 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict]; | 4168 [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict]; |
4168 [image unlockFocus]; | 4169 [image unlockFocus]; |
4170 [dict release]; | |
4169 } | 4171 } |
4170 DW_MUTEX_UNLOCK; | 4172 DW_MUTEX_UNLOCK; |
4171 } | 4173 } |
4172 | 4174 |
4173 /* Query the width and height of a text string. | 4175 /* Query the width and height of a text string. |
4178 * width: Pointer to a variable to be filled in with the width. | 4180 * width: Pointer to a variable to be filled in with the width. |
4179 * height Pointer to a variable to be filled in with the height. | 4181 * height Pointer to a variable to be filled in with the height. |
4180 */ | 4182 */ |
4181 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height) | 4183 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height) |
4182 { | 4184 { |
4183 id image = handle; | |
4184 id object = handle; | 4185 id object = handle; |
4185 NSString *nstr = [NSString stringWithUTF8String:text]; | 4186 NSString *nstr = [NSString stringWithUTF8String:text]; |
4186 if(pixmap) | 4187 if(pixmap) |
4187 { | 4188 { |
4188 image = (id)pixmap->image; | |
4189 object = pixmap->handle; | 4189 object = pixmap->handle; |
4190 } | 4190 } |
4191 NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; | 4191 NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; |
4192 if([object isMemberOfClass:[DWRender class]]) | 4192 if([object isMemberOfClass:[DWRender class]]) |
4193 { | 4193 { |