Lines Matching refs:image

12 #include "android/skin/image.h"
207 SKIN_IMAGE_CLONE = (1 << 0) /* this image is a clone */
233 skin_image_free( SkinImage* image )
235 if (image && image != _no_image)
237 if (image->surface) {
238 SDL_FreeSurface(image->surface);
239 image->surface = NULL;
242 if (image->pixels) {
243 free( image->pixels );
244 image->pixels = NULL;
247 free(image);
256 SkinImage* image = calloc(1, sizeof(*image) + len + 1);
258 if (image) {
259 image->desc = desc[0];
260 image->desc.path = (const char*)(image + 1);
261 memcpy( (char*)image->desc.path, desc->path, len );
262 ((char*)image->desc.path)[len] = 0;
264 image->hash = hash;
265 image->next = image->prev = image;
266 image->ref_count = 1;
268 return image;
276 skin_image_load( SkinImage* image )
280 const char* path = image->desc.path;
291 fprintf(stderr, "failed to locate built-in image file '%s'\n", path );
297 fprintf(stderr, "failed to load built-in image file '%s'\n", path );
303 fprintf(stderr, "failed to load image file '%s'\n", path );
329 image->pixels = data;
330 image->w = w;
331 image->h = h;
333 image->surface = sdl_surface_from_argb32( image->pixels, w, h );
334 if (image->surface == NULL) {
335 fprintf(stderr, "failed to create SDL surface for '%s' image\n", path);
363 cache->max_pixels = 4*1024*1024; /* limit image cache to 4 MB */
371 SkinImage* image )
374 SkinImage** pnode = cache->buckets + (image->hash & (NUM_BUCKETS-1));
382 if (node == image) {
393 image->prev->next = image->next;
394 image->next->prev = image->prev;
396 cache->total_pixels -= image->w*image->h;
403 SkinImage* image )
405 if (image != cache->mru_head.next) {
406 SkinImage* prev = image->prev;
407 SkinImage* next = image->next;
414 image->prev = &cache->mru_head;
415 image->next = image->prev->next;
416 image->prev->next = image;
417 image->next->prev = image;
419 return image;
426 SkinImage* image = cache->mru_head.prev;
431 image != &cache->mru_head)
433 SkinImage* prev = image->prev;
435 if (image->ref_count == 0) {
436 skin_image_cache_remove(cache, image);
439 image = prev;
587 skin_image_ref( SkinImage* image )
589 if (image && image != _no_image)
590 image->ref_count += 1;
592 return image;
599 SkinImage* image = *pimage;
601 if (image) {
602 if (image != _no_image && --image->ref_count == 0) {
603 if ((image->flags & SKIN_IMAGE_CLONE) != 0) {
604 skin_image_free(image);
616 SkinImage* image;
623 image = skin_image_find( &desc );
625 return image;
632 SkinImage* image;
637 image = calloc(1,sizeof(*image));
638 if (image == NULL)
641 image->desc = source->desc;
642 image->hash = source->hash;
643 image->flags = SKIN_IMAGE_CLONE;
644 image->w = source->w;
645 image->h = source->h;
646 image->pixels = rotate_image( source->pixels, source->w, source->h,
648 if (image->pixels == NULL)
651 image->surface = sdl_surface_from_argb32( image->pixels, image->w, image->h );
652 if (image->surface == NULL)
655 return image;
657 if (image != NULL)
658 skin_image_free(image);
690 /* apply blending to a source skin image and copy the result to a target clone image */
701 skin_image_w( SkinImage* image )
703 return image ? image->w : 0;
707 skin_image_h( SkinImage* image )
709 return image ? image->h : 0;
713 skin_image_org_w( SkinImage* image )
715 if (image) {
716 if (image->desc.rotation == SKIN_ROTATION_90 ||
717 image->desc.rotation == SKIN_ROTATION_270)
718 return image->h;
720 return image->w;
726 skin_image_org_h( SkinImage* image )
728 if (image) {
729 if (image->desc.rotation == SKIN_ROTATION_90 ||
730 image->desc.rotation == SKIN_ROTATION_270)
731 return image->w;
733 return image->h;
739 skin_image_surface( SkinImage* image )
741 return image ? image->surface : NULL;