merge with trunk at r31523
[blender.git] / source / blender / makesrna / intern / rna_image_api.c
index 263603cbd3618ad1349d988af5a067e31bba0e30..e53d4a3f137324b7b8ac506c4b9f865dcf3f33ad 100644 (file)
@@ -77,6 +77,8 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
                if (!BKE_write_ibuf(NULL, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality)) {
                        BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path);
                }
+
+               BKE_image_release_ibuf(image, lock);
        } else {
                BKE_reportf(reports, RPT_ERROR, "Scene not in context, couldn't get save parameters");
        }
@@ -153,10 +155,12 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int
                error = (int)gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_INT, ibuf->rect);
 
        if (!error) {
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, image->tpageflag & IMA_CLAMP_U ? GL_CLAMP : GL_REPEAT);
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, image->tpageflag & IMA_CLAMP_V ? GL_CLAMP : GL_REPEAT);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint)mag);
                glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_INT, ibuf->rect); 
+               glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); 
                error = (int)glGetError();
        }