Переглянути джерело

* CoreImage loader fails cleanly when specified image doesn't exist

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3020 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
jylam 16 роки тому
джерело
коміт
2303855238
1 змінених файлів з 10 додано та 6 видалено
  1. +10
    -6
      pipi/codec/coreimage.m

+ 10
- 6
pipi/codec/coreimage.m Переглянути файл

@@ -31,7 +31,11 @@ pipi_image_t *pipi_load_coreimage(const char *name)
NSString *n = [NSString stringWithCString: name];
CIImage *source;
NSURL *url = [NSURL fileURLWithPath:n];
source = [CIImage imageWithContentsOfURL:url];
if(source == NULL) return NULL;
CGRect extent = [source extent];
size_t w = (size_t)extent.size.width;
size_t h = (size_t)extent.size.height;
@@ -43,12 +47,12 @@ pipi_image_t *pipi_load_coreimage(const char *name)
pipi_image_t *img;
img = pipi_new(w, h);
img->p[PIPI_PIXELS_RGBA_C].pixels = [myImage bitmapData];
img->p[PIPI_PIXELS_RGBA_C].w = w;
img->p[PIPI_PIXELS_RGBA_C].h = h;
img->p[PIPI_PIXELS_RGBA_C].pitch = ([myImage bytesPerRow]/8) * img->w;
img->p[PIPI_PIXELS_RGBA_C].bpp = [myImage bitsPerPixel];
img->p[PIPI_PIXELS_RGBA_C].bytes = ([myImage bitsPerPixel]/8) * img->w * img->h;
img->last_modified = PIPI_PIXELS_RGBA_C;
img->p[PIPI_PIXELS_RGBA_C].w = w;
img->p[PIPI_PIXELS_RGBA_C].h = h;
img->p[PIPI_PIXELS_RGBA_C].pitch = ([myImage bytesPerRow]/8) * img->w;
img->p[PIPI_PIXELS_RGBA_C].bpp = [myImage bitsPerPixel];
img->p[PIPI_PIXELS_RGBA_C].bytes = ([myImage bitsPerPixel]/8) * img->w * img->h;
img->last_modified = PIPI_PIXELS_RGBA_C;

img->codec_priv = (struct pipi_codec_coreimage *) malloc(sizeof(struct pipi_codec_coreimage *));
struct pipi_codec_coreimage *infos = (struct pipi_codec_coreimage *) img->codec_priv;


Завантаження…
Відмінити
Зберегти