performance - Buffere write becomes slow after CGBitmapContextCreate -
i have code this...
cgcolorspaceref colorspace = cgcolorspacecreatedevicergb(); cgcontextref ctx = cgbitmapcontextcreate(pixelarray, width, height, 8, 4 * width, colorspace, kcgimagealphanoneskiplast);  cgimageref createdimage = cgbitmapcontextcreateimage (ctx);  uiimage = [[uiimage imagewithcgimage:createdimage] retain];   the problem that, once create cgimage , uiimage buffer (pixelarray), write operations buffer becomes @ least 4x slower. happens on ipad device not on iphone. has anyones face same problem? going on here?
here write operation code, , call these in loops (setpixel)...
- (rgba*) getpixel:(nsinteger)x  y:(nsinteger)y {     // bound co-cordinates.     x = min(max(x, 0), width - 1);     y = min(max(y, 0), height - 1);      // yindexes pre populated     return (rgba*)(&pixelarray[(x + yindexes[y]) << 2]); }  - (void) setpixel:(rgba*)color x:(nsinteger)x  y:(nsinteger)y {     // bound co-cordinates.     x = min(max(x, 0), _width);     y = min(max(y, 0), _height);      memcpy([self getpixel:x y:y], color, 3);      colordirtybit = yes; }      
i not sure going wrong, believe might write operation code differ in speed. try raw-writing operation without using functions instead? e.g.
for(int = 0; < bufferlen; i++) {     pixelarray[i] = i; // or arbitrary value }      
Comments
Post a Comment