~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/blenkernel/intern/image.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
{
196
196
        ImBuf *ibuf;
197
197
 
198
 
        while ((ibuf = ima->ibufs.first)) {
199
 
                BLI_remlink(&ima->ibufs, ibuf);
200
 
 
 
198
        while ((ibuf = BLI_pophead(&ima->ibufs))) {
201
199
                if (ibuf->userdata) {
202
200
                        MEM_freeN(ibuf->userdata);
203
201
                        ibuf->userdata = NULL;
524
522
        /* sanity check */
525
523
        if (dest && source && dest != source) {
526
524
 
527
 
                while ((ibuf = source->ibufs.first)) {
528
 
                        BLI_remlink(&source->ibufs, ibuf);
 
525
                while ((ibuf = BLI_pophead(&source->ibufs))) {
529
526
                        image_assign_ibuf(dest, ibuf, IMA_INDEX_PASS(ibuf->index), IMA_INDEX_FRAME(ibuf->index));
530
527
                }
531
528
 
597
594
 
598
595
        /* exists? */
599
596
        file = BLI_open(str, O_BINARY | O_RDONLY, 0);
600
 
        if (file == -1) return NULL;
 
597
        if (file < 0)
 
598
                return NULL;
601
599
        close(file);
602
600
 
603
601
        /* create a short library name */
652
650
}
653
651
 
654
652
static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type,
655
 
                            float color[4], ColorManagedColorspaceSettings *colorspace_settings)
 
653
                            const float color[4], ColorManagedColorspaceSettings *colorspace_settings)
656
654
{
657
655
        ImBuf *ibuf;
658
656
        unsigned char *rect = NULL;
695
693
                        break;
696
694
                default:
697
695
                        BKE_image_buf_fill_color(rect, rect_float, width, height, color);
 
696
                        break;
698
697
        }
699
698
 
700
699
        if (rect_float) {
708
707
}
709
708
 
710
709
/* adds new image block, creates ImBuf and initializes color */
711
 
Image *BKE_image_add_generated(Main *bmain, unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, float color[4])
 
710
Image *BKE_image_add_generated(Main *bmain, unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, const float color[4])
712
711
{
713
712
        /* on save, type is changed to FILE in editsima.c */
714
713
        Image *ima = image_alloc(bmain, name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST);
721
720
                ima->gen_y = height;
722
721
                ima->gen_type = gen_type;
723
722
                ima->gen_flag |= (floatbuf ? IMA_GEN_FLOAT : 0);
 
723
                ima->gen_depth = depth;
724
724
 
725
725
                ibuf = add_ibuf_size(width, height, ima->name, depth, floatbuf, gen_type, color, &ima->colorspace_settings);
726
726
                image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
1120
1120
                case R_IMF_IMTYPE_QUICKTIME:
1121
1121
                case R_IMF_IMTYPE_DPX:
1122
1122
                        chan_flag |= IMA_CHAN_FLAG_ALPHA;
 
1123
                        break;
1123
1124
        }
1124
1125
 
1125
1126
        /* bw */
1131
1132
                case R_IMF_IMTYPE_TIFF:
1132
1133
                case R_IMF_IMTYPE_IRIS:
1133
1134
                        chan_flag |= IMA_CHAN_FLAG_BW;
 
1135
                        break;
1134
1136
        }
1135
1137
 
1136
1138
        return chan_flag;
1324
1326
void BKE_imformat_defaults(ImageFormatData *im_format)
1325
1327
{
1326
1328
        memset(im_format, 0, sizeof(*im_format));
1327
 
        im_format->planes = R_IMF_PLANES_RGB;
 
1329
        im_format->planes = R_IMF_PLANES_RGBA;
1328
1330
        im_format->imtype = R_IMF_IMTYPE_PNG;
1329
1331
        im_format->depth = R_IMF_CHAN_DEPTH_8;
1330
1332
        im_format->quality = 90;
2147
2149
        /* texture users */
2148
2150
        for (tex = mainp->tex.first; tex; tex = tex->id.next) {
2149
2151
                if (tex->type == TEX_IMAGE && tex->ima) {
2150
 
                        if (ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
2151
 
                                callback(tex->ima, &tex->iuser, customdata);
2152
 
                        }
 
2152
                        callback(tex->ima, &tex->iuser, customdata);
2153
2153
                }
2154
2154
        }
2155
2155
 
2191
2191
{
2192
2192
        Image *changed_image = customdata;
2193
2193
 
2194
 
        if (ima == changed_image) {
 
2194
        if (ima == changed_image && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
2195
2195
                iuser->flag |= IMA_NEED_FRAME_RECALC;
2196
2196
        }
2197
2197
}
2992
2992
                        /* UV testgrid or black or solid etc */
2993
2993
                        if (ima->gen_x == 0) ima->gen_x = 1024;
2994
2994
                        if (ima->gen_y == 0) ima->gen_y = 1024;
2995
 
                        ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 24, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type,
 
2995
                        if (ima->gen_depth == 0) ima->gen_depth = 24;
 
2996
                        ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, ima->gen_depth, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type,
2996
2997
                                             color, &ima->colorspace_settings);
2997
2998
                        image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
2998
2999
                        ima->ok = IMA_OK_LOADED;