Ignore:
Timestamp:
Apr 20, 2011, 12:39:27 AM (11 years ago)
Author:
Sam Hocevar
Message:

imlib: use vec2i for image::size and unroll all necessary changes
everywhere else in the code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/timage.cpp

    r494 r512  
    1111#include "config.h"
    1212
     13#include "common.h"
     14
    1315#include "timage.h"
    1416
     
    7072  int size=0,x,y;
    7173  uint8_t *sl,*datap,*marker;
    72   w=im->width();
    73   h=im->height();
     74  w=im->Size().x;
     75  h=im->Size().y;
    7476
    7577  im->lock();
    7678
    7779  // first we must find out how much data to allocate
    78   for (y=0; y<im->height(); y++)
     80  for (y=0; y<im->Size().y; y++)
    7981  {
    8082    sl=im->scan_line(y);
     
    99101
    100102  data=(uint8_t *)malloc(size);
    101   int ww=im->width(),hh=im->height();
     103  int ww=im->Size().x,hh=im->Size().y;
    102104  datap=data;
    103105  if (!datap)
    104   { printf("size = %d %d (%d)\n",im->width(),im->height(),size);  }
     106  { printf("size = %d %d (%d)\n",im->Size().x,im->Size().y,size);  }
    105107  CONDITION(datap,"malloc error for trans_image::data");
    106108
     
    112114    {
    113115      *datap=0;  // start the skip at 0
    114       while (x<im->width() && (*sl)==0)
     116      while (x<im->Size().x && (*sl)==0)
    115117      { sl++; x++; (*datap)++; }
    116118      datap++;
     
    121123    *marker=0;
    122124    datap++;    // skip over this spot
    123         while (x<im->width() && (*sl)!=0)
     125        while (x<im->Size().x && (*sl)!=0)
    124126        {
    125127          (*marker)++;
     
    274276
    275277  screen_line=screen->scan_line(y)+x;
    276   int sw=screen->width()-w;
     278  int sw=screen->Size().x-w;
    277279  x1-=x; x2-=x;
    278280  for (; ysteps>0; ysteps--)
     
    343345
    344346  screen->lock();
    345   screen_skip = screen->width() - w;
     347  screen_skip = screen->Size().x - w;
    346348  for (; ysteps; ysteps--)
    347349  {
     
    366368    ix+=skip;
    367369
    368     if (s_off>=screen->scan_line(screen->height()+1))
     370    if (s_off>=screen->scan_line(screen->Size().y+1))
    369371            printf("bad write in trans_image::put_image_offseted");
    370372      }
     
    386388  screen->lock();
    387389  screen_line=screen->scan_line(y)+x;
    388   int sw=screen->width();
     390  int sw=screen->Size().x;
    389391  x1-=x; x2-=x;
    390392  for (; ysteps>0; ysteps--)
     
    451453  screen->lock();
    452454  screen_line=screen->scan_line(y)+x;
    453   int sw=screen->width();
     455  int sw=screen->Size().x;
    454456  x1-=x; x2-=x;
    455457  for (; ysteps>0; ysteps--)
     
    529531  screen->lock();
    530532  screen_line=screen->scan_line(y)+x;
    531   int sw=screen->width();
     533  int sw=screen->Size().x;
    532534  x1-=x; x2-=x;
    533535  for (; ysteps>0; ysteps--)
     
    857859                *blend_line,*screen_line;
    858860  if (!datap) return ;
    859   CONDITION(y>=blendy && y+ysteps<blendy+blend->height()+1,"Blend doesn't fit on trans_image");
     861  CONDITION(y>=blendy && y+ysteps<blendy+blend->Size().y+1,"Blend doesn't fit on trans_image");
    860862
    861863  blend_amount=16-blend_amount;
     
    979981  screen->lock();
    980982  screen_line=screen->scan_line(y)+x;
    981   int sw=screen->width();
     983  int sw=screen->Size().x;
    982984  x1-=x; x2-=x;
    983985  for (; ysteps>0; ysteps--)
Note: See TracChangeset for help on using the changeset viewer.