Manual merge of soc-2009-kazanbas branch:
[blender.git] / source / blender / blenkernel / intern / image.c
index 1af0d37..9953540 100644 (file)
 
 #include <time.h>
 
+#ifdef _WIN32
+#define open _open
+#define close _close
+#endif
+
 #include "MEM_guardedalloc.h"
 
 #include "IMB_imbuf_types.h"
@@ -272,7 +277,7 @@ static Image *image_alloc(const char *name, short source, short type)
                
                ima->xrep= ima->yrep= 1;
                ima->aspx= ima->aspy= 1.0;
-               ima->gen_x= 256; ima->gen_y= 256;
+               ima->gen_x= 1024; ima->gen_y= 1024;
                ima->gen_type= 1;       /* no defines yet? */
                
                ima->source= source;
@@ -1467,9 +1472,11 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
                        iuser->ok= 1;
                break;
        case IMA_SIGNAL_SRC_CHANGE:
-               if(ima->type==IMA_TYPE_MULTILAYER)
-                       image_free_buffers(ima);
-               else if(ima->source==IMA_SRC_GENERATED) {
+               if(ima->type == IMA_TYPE_UV_TEST)
+                       if(ima->source != IMA_SRC_GENERATED)
+                               ima->type= IMA_TYPE_IMAGE;
+
+               if(ima->source==IMA_SRC_GENERATED) {
                        if(ima->gen_x==0 || ima->gen_y==0) {
                                ImBuf *ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
                                if(ibuf) {
@@ -1478,6 +1485,9 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
                                }
                        }
                }
+
+               image_free_buffers(ima);
+
                ima->ok= 1;
                if(iuser)
                        iuser->ok= 1;
@@ -2085,8 +2095,8 @@ ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser)
                        else if(ima->source == IMA_SRC_GENERATED) {
                                /* generated is: ibuf is allocated dynamically */
                                /* UV testgrid or black or solid etc */
-                               if(ima->gen_x==0) ima->gen_x= 256;
-                               if(ima->gen_y==0) ima->gen_y= 256;
+                               if(ima->gen_x==0) ima->gen_x= 1024;
+                               if(ima->gen_y==0) ima->gen_y= 1024;
                                ibuf= add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 0, ima->gen_type, color);
                                image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
                                ima->ok= IMA_OK_LOADED;
@@ -2264,3 +2274,4 @@ int BKE_get_image_export_path(struct Image *im, const char *dest_dir, char *abs,
 
        return 1;
 }
+