Changeset 663


Ignore:
Timestamp:
May 15, 2011, 5:32:22 PM (9 years ago)
Author:
Sam Hocevar
Message:

imlib: replace image::PutImage? with a shortcut to image::PutPart?.

File:
1 edited

Legend:

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

    r662 r663  
    4646void image::DeletePage()
    4747{
    48     if(!m_special || !m_special->static_mem)
     48    if (!m_special || !m_special->static_mem)
    4949        free(m_data);
    5050}
     
    321321void image::PutImage(image *im, vec2i pos, int transparent)
    322322{
    323     int16_t i, j, xl, yl;
    324     uint8_t *pg1, *pg2, *source, *dest;
    325 
    326     // the screen is clipped then we only want to put part of the image
    327     if(m_special)
    328     {
    329         PutPart(im, pos, vec2i(0), im->m_size, transparent);
    330         return;
    331     }
    332 
    333     if(pos.x < m_size.x && pos.y < m_size.y)
    334     {
    335         xl = im->m_size.x;
    336         if(pos.x + xl > m_size.x) // clip to the border of the screen
    337             xl = m_size.x - pos.x;
    338         yl = im->m_size.y;
    339         if(pos.y + yl > m_size.y)
    340             yl = m_size.y - pos.y;
    341 
    342         int startx = 0, starty = 0;
    343         if(pos.x < 0)
    344         {
    345             startx = -pos.x;
    346             pos.x = 0;
    347         }
    348         if(pos.y < 0)
    349         {
    350             starty = -pos.y;
    351             pos.y = 0;
    352         }
    353 
    354         if(xl < 0 || yl < 0)
    355             return;
    356 
    357         AddDirty(pos.x, pos.y, pos.x + xl, pos.y + yl);
    358         Lock();
    359         im->Lock();
    360         for(j = starty; j < yl; j++, pos.y++)
    361         {
    362             pg1 = scan_line(pos.y);
    363             pg2 = im->scan_line(j);
    364             if(transparent)
    365             {
    366                 for(i = startx, source = pg2+startx, dest = pg1 + pos.x;
    367                     i < xl;
    368                     i++, source++, dest++)
    369                 {
    370                     if (*source)
    371                         *dest = *source;
    372                 }
    373             }
    374             else
    375                 memcpy(&pg1[pos.x], pg2, xl); // straight copy
    376         }
    377         im->Unlock();
    378         Unlock();
    379     }
     323    PutPart(im, pos, vec2i(0), im->m_size, transparent);
    380324}
    381325
     
    502446    // If the image does not already have an Image descriptor, allocate one
    503447    // with no dirty rectangle keeping.
    504     if(!m_special)
     448    if (!m_special)
    505449        m_special = new image_descriptor(m_size.x, m_size.y, 0);
    506450
Note: See TracChangeset for help on using the changeset viewer.