comparison ios/dw.m @ 2436:ab36fbb50fe5

iOS: Fixes to get cachedImage functionality working.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 06 Apr 2021 08:54:57 +0000
parents 7d6c8b7f41d9
children 929ce3cd18ea
comparison
equal deleted inserted replaced
2435:7d6c8b7f41d9 2436:ab36fbb50fe5
806 -(CGContextRef)cgcontext; 806 -(CGContextRef)cgcontext;
807 -(void)dealloc; 807 -(void)dealloc;
808 @end 808 @end
809 809
810 /* Subclass for a render area type */ 810 /* Subclass for a render area type */
811 @interface DWRender : UIControl 811 @interface DWRender : UIView
812 { 812 {
813 void *userdata; 813 void *userdata;
814 UIFont *font; 814 UIFont *font;
815 CGSize size; 815 CGSize size;
816 DWImage *cachedImage; 816 DWImage *cachedImage;
1200 DWRender *rend; 1200 DWRender *rend;
1201 1201
1202 while(rend = [enumerator nextObject]) 1202 while(rend = [enumerator nextObject])
1203 [rend setNeedsDisplay]; 1203 [rend setNeedsDisplay];
1204 [_DWDirtyDrawables removeAllObjects]; 1204 [_DWDirtyDrawables removeAllObjects];
1205 UIGraphicsEndImageContext();
1206 } 1205 }
1207 -(void)doWindowFunc:(id)param 1206 -(void)doWindowFunc:(id)param
1208 { 1207 {
1209 NSValue *v = (NSValue *)param; 1208 NSValue *v = (NSValue *)param;
1210 void **params = (void **)[v pointerValue]; 1209 void **params = (void **)[v pointerValue];
5227 { 5226 {
5228 DWImage *image = source; 5227 DWImage *image = source;
5229 5228
5230 context = [image cgcontext]; 5229 context = [image cgcontext];
5231 } 5230 }
5232 else if([source isMemberOfClass:[DWRender class]])
5233 {
5234 DWRender *render = source;
5235
5236 UIGraphicsBeginImageContext([render frame].size);
5237 context = UIGraphicsGetCurrentContext();
5238 }
5239 if(context) 5231 if(context)
5240 CGContextSetAllowsAntialiasing(context, antialiased); 5232 CGContextSetAllowsAntialiasing(context, antialiased);
5241 return context; 5233 return context;
5242 } 5234 }
5243 5235
7075 7067
7076 bltinfo = calloc(1, sizeof(DWBitBlt)); 7068 bltinfo = calloc(1, sizeof(DWBitBlt));
7077 bi = [NSValue valueWithPointer:bltinfo]; 7069 bi = [NSValue valueWithPointer:bltinfo];
7078 7070
7079 /* Fill in the information */ 7071 /* Fill in the information */
7080 bltinfo->dest = dest; 7072 bltinfo->dest = _dw_dest_image(destp, dest);
7081 bltinfo->src = src; 7073 bltinfo->src = src;
7082 bltinfo->xdest = xdest; 7074 bltinfo->xdest = xdest;
7083 bltinfo->ydest = ydest; 7075 bltinfo->ydest = ydest;
7084 bltinfo->width = width; 7076 bltinfo->width = width;
7085 bltinfo->height = height; 7077 bltinfo->height = height;
7086 bltinfo->xsrc = xsrc; 7078 bltinfo->xsrc = xsrc;
7087 bltinfo->ysrc = ysrc; 7079 bltinfo->ysrc = ysrc;
7088 bltinfo->srcwidth = srcwidth; 7080 bltinfo->srcwidth = srcwidth;
7089 bltinfo->srcheight = srcheight; 7081 bltinfo->srcheight = srcheight;
7090 7082
7091 if(destp)
7092 {
7093 bltinfo->dest = (id)destp->image;
7094 }
7095 if(srcp) 7083 if(srcp)
7096 { 7084 {
7097 id object = bltinfo->src = (id)srcp->image; 7085 id object = bltinfo->src = (id)srcp->image;
7098 [object retain]; 7086 [object retain];
7099 } 7087 }