~ubuntu-branches/ubuntu/utopic/blender/utopic-proposed

« back to all changes in this revision

Viewing changes to source/blender/blenlib/intern/boxpack2d.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:
27
27
#include <stdlib.h> /* for qsort */
28
28
 
29
29
#include "MEM_guardedalloc.h"
30
 
#include "BLI_boxpack2d.h"
 
30
#include "BLI_strict_flags.h"
 
31
 
 
32
#include "BLI_boxpack2d.h"  /* own include */
31
33
 
32
34
/* BoxPacker for backing 2D rectangles into a square
33
35
 * 
154
156
 *  len - the number of boxes in the array.
155
157
 *      tot_width and tot_height are set so you can normalize the data.
156
158
 *  */
157
 
void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float *tot_height)
 
159
void BLI_box_pack_2d(BoxPack *boxarray, const int len, float *tot_width, float *tot_height)
158
160
{
159
161
        BoxVert *vert; /* the current vert */
160
162
        int box_index, verts_pack_len, i, j, k, isect;
169
171
        }
170
172
 
171
173
        /* Sort boxes, biggest first */
172
 
        qsort(boxarray, len, sizeof(BoxPack), box_areasort);
 
174
        qsort(boxarray, (size_t)len, sizeof(BoxPack), box_areasort);
173
175
 
174
176
        /* add verts to the boxes, these are only used internally  */
175
 
        vert = vertarray = MEM_mallocN(len * 4 * sizeof(BoxVert), "BoxPack Verts");
176
 
        vertex_pack_indices = MEM_mallocN(len * 3 * sizeof(int), "BoxPack Indices");
 
177
        vert = vertarray = MEM_mallocN((size_t)len * 4 * sizeof(BoxVert), "BoxPack Verts");
 
178
        vertex_pack_indices = MEM_mallocN((size_t)len * 3 * sizeof(int), "BoxPack Indices");
177
179
 
178
180
        for (box = boxarray, box_index = 0, i = 0; box_index < len; box_index++, box++) {
179
181
 
241
243
                box_width = box->w;
242
244
                box_height = box->h;
243
245
 
244
 
                qsort(vertex_pack_indices, verts_pack_len, sizeof(int), vertex_sort);
 
246
                qsort(vertex_pack_indices, (size_t)verts_pack_len, sizeof(int), vertex_sort);
245
247
 
246
248
                /* Pack the box in with the others */
247
249
                /* sort the verts */
318
320
                                                (*tot_height) = max_ff(BOXTOP(box), (*tot_height));
319
321
 
320
322
                                                /* Place the box */
321
 
                                                vert->free &= ~quad_flags[j];
 
323
                                                vert->free &= (short)~quad_flags[j];
322
324
 
323
325
                                                switch (j) {
324
326
                                                        case TR: