Changeset 221


Ignore:
Timestamp:
Aug 5, 2007, 2:18:17 PM (14 years ago)
Author:
Eugene Romanenko
Message:

improve JPEG plugin

Location:
trunk/Lucide/SOURCE
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/SOURCE/gui/makefile

    r218 r221  
    11.autodepend
    22
    3 TEST=0
     3TEST=1
    44VERSION=1.02
    55
  • trunk/Lucide/SOURCE/plugins/ludoc/lupixbuf.cpp

    r171 r221  
    7474        }
    7575    somThis->dlen = somThis->rowsize * somThis->height;
     76    //somPrintf( "LuPixbufInit: allocating %d bytes\n", somThis->dlen );
    7677    somThis->data = (char *)SOMMalloc( somThis->dlen );
    7778    memset( somThis->data, 0xff, somThis->dlen );
  • trunk/Lucide/SOURCE/plugins/lujpeg/jpscale.cpp

    r214 r221  
    287287    for (k = 0; k < tmp_m_height; ++k)
    288288    {
    289         get_row( ev, raster, in, int(floorf(in_x0)), in_window_w, k );
     289        get_row( ev, raster, in, int(floorf(in_x0)), in_window_w, k+in_y0 );
    290290        for (i = 0; i < tmp_m_width; ++i)
    291291        {
  • trunk/Lucide/SOURCE/plugins/lujpeg/lujpeg.cpp

    r217 r221  
    9595extern "C" LuSignatureCheck * EXPENTRY getSignatureCheck()
    9696{
    97         return &lsc;
     97    return &lsc;
    9898}
    9999
     
    192192        i--;
    193193        jpeg_read_scanlines( &cinfo, buffer, 1 );
    194         dst = pixbuf_data + i * pixbuf_rowstride;
     194        dst = pixbuf_data + ( i * pixbuf_rowstride );
    195195        for ( j = 0; j < pixbuf_rowstride; j += bpp )
    196196        {
     
    264264    //            src_x, src_y, src_width, src_height, scale );
    265265
    266     long real_src_x = ( (double)src_x / scale );
    267     long real_src_y = ( (double)src_y / scale );
    268     long real_src_width = ( (double)src_width / scale );
    269     long real_src_height = ( (double)src_height / scale );
     266    float real_src_x = (float)src_x / scale;
     267    float real_src_y = (float)src_y / scale;
     268    float real_src_width = (float)src_width / scale;
     269    float real_src_height = (float)src_height / scale;
     270
     271    //somPrintf( "real_src_x: %f  real_src_y: %f  real_src_width: %f  real_src_height: %f\n",
     272    //            real_src_x, real_src_y, real_src_width, real_src_height );
    270273
    271274    short bpp = getBpp( somSelf, ev );
     
    276279    char *pb_data    = (char *)d->pb->getDataPtr( ev );
    277280
    278     real_src_width   = __min( real_src_width, pb_width );
    279     real_src_height  = __min( real_src_height, pb_height );
    280 
    281     LuPixbuf *tmp = new LuPixbuf( ev, real_src_width, real_src_height, bpp );
    282     int pixbuf_rowstride = tmp->getRowSize( ev );
    283     char *pixbuf_data = (char *)tmp->getDataPtr( ev );
    284     char *src, *dst;
    285     int i, y;
    286     //somPrintf( "0: %d | %d | %d\n", pb_height, real_src_y, real_src_height );
    287     for ( y = pb_height-(real_src_y+real_src_height), i = 0; i < real_src_height; y++, i++ )
    288     {
    289         //somPrintf( "1: %x | %d | %d | %d | %d\n", pb_data, y, pb_rowstride, real_src_x, bpp );
    290         src = pb_data + (y * pb_rowstride) + (real_src_x * bpp);
    291         dst = pixbuf_data + (i * pixbuf_rowstride);
    292         memcpy( dst, src, real_src_width * bpp );
    293     }
    294 
    295     char *dt = (char *)pixbuf->getDataPtr( ev );
    296281    if ( scale == 1.0 )
    297282    {
    298         memcpy( dt, pixbuf_data, pixbuf->getDataLen( ev ) );
     283        int pixbuf_rowstride = pixbuf->getRowSize( ev );
     284        char *pixbuf_data = (char *)pixbuf->getDataPtr( ev );
     285        char *src, *dst;
     286        int i, y;
     287        for ( y = pb_height-(src_y+src_height), i = 0; i < src_height; y++, i++ )
     288        {
     289            src = pb_data + (y * pb_rowstride) + (src_x * bpp);
     290            dst = pixbuf_data + (i * pixbuf_rowstride);
     291            memcpy( dst, src, src_width * bpp );
     292        }
    299293    }
    300294    else
    301295    {
    302         if ( ( real_src_width > 0 ) && ( real_src_height > 0 ) )
    303         {
    304             resample( ev, pixbuf, 0, 0, src_width-1, src_height-1,
    305                           tmp, 0, 0, real_src_width, real_src_height );
    306         }
    307     }
    308     delete tmp;
     296        float y = (float)pb_height - ( real_src_y + real_src_height );
     297        resample( ev, pixbuf, 0, 0, src_width - 1, src_height - 1,
     298                  d->pb, real_src_x, y, real_src_width + real_src_x, real_src_height + y );
     299    }
    309300
    310301    return TRUE;
Note: See TracChangeset for help on using the changeset viewer.