~ubuntu-branches/ubuntu/maverick/wxwidgets2.8/maverick-proposed

« back to all changes in this revision

Viewing changes to src/common/image.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Devid Filoni
  • Date: 2007-11-06 18:25:13 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20071106182513-809agqds6igh7mqo
Tags: 2.8.6.1-0ubuntu1
* New upstream version, based on the upstream tarball
  wxPython-src-2.8.6.1.tar.bz2, renamed debian to debian-upstream.
* Provide a get-orig-source target to do the repackaging.
* Fix "substvar-source-version-is-deprecated" lintian warnings.
* Remove duplicate Description field in debian/control.
* Add "\" at the end of line 8 in debian/python-wxtools.menu to fix
  "bad-test-in-menu-item" lintian error.
* Provide .xpm icons to fix "menu-icon-not-in-xpm-format" lintian errors,
  changed Icon field in debian/python-wxtools.menu.
* Fix "wrong-name-for-upstream-changelog" lintian warnings.
* Remove "Application;" from Categories field in debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Switch "Apps" to "Applications" in debian/python-wxtools.menu to fix
  "menu-item-uses-apps-section" lintian warnings.
* Drop the icon extension from debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Add dpatch support.
* Add "WX_CONFIG" patch.
* debian/rules:
  - added .xpm icons to install-gtk-py-tools target
  - added "docs/changes.txt" to dh_installchangelogs in binary-common target
  - added "\" at the end of "install-examples install-msw-dev
    install-msw-dbg install-headers-msw" line in .PHONY

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
// Name:        src/common/image.cpp
3
3
// Purpose:     wxImage
4
4
// Author:      Robert Roebling
5
 
// RCS-ID:      $Id: image.cpp,v 1.239.4.2 2007/04/16 13:02:25 VZ Exp $
 
5
// RCS-ID:      $Id: image.cpp 46549 2007-06-20 00:13:57Z VZ $
6
6
// Copyright:   (c) Robert Roebling
7
7
// Licence:     wxWindows licence
8
8
/////////////////////////////////////////////////////////////////////////////
39
39
#define HAS_FILE_STREAMS (wxUSE_STREAMS && (wxUSE_FILE || wxUSE_FFILE))
40
40
 
41
41
#if HAS_FILE_STREAMS
42
 
    #if wxUSE_FILE
 
42
    #if wxUSE_FFILE
 
43
        typedef wxFFileInputStream wxImageFileInputStream;
 
44
        typedef wxFFileOutputStream wxImageFileOutputStream;
 
45
    #elif wxUSE_FILE
43
46
        typedef wxFileInputStream wxImageFileInputStream;
44
47
        typedef wxFileOutputStream wxImageFileOutputStream;
45
 
    #elif wxUSE_FFILE
46
 
        typedef wxFFileInputStream wxImageFileInputStream;
47
 
        typedef wxFFileOutputStream wxImageFileOutputStream;
48
48
    #endif // wxUSE_FILE/wxUSE_FFILE
49
49
#endif // HAS_FILE_STREAMS
50
50
 
675
675
    for ( int dsty = 0; dsty < height; dsty++ )
676
676
    {
677
677
        // We need to calculate the source pixel to interpolate from - Y-axis
678
 
        double srcpixy = dsty * M_IMGDATA->m_height / height;
 
678
        double srcpixy = double(dsty * M_IMGDATA->m_height) / height;
679
679
        double dy = srcpixy - (int)srcpixy;
680
680
 
681
681
        for ( int dstx = 0; dstx < width; dstx++ )
682
682
        {
683
683
            // X-axis of pixel to interpolate from
684
 
            double srcpixx = dstx * M_IMGDATA->m_width / width;
 
684
            double srcpixx = double(dstx * M_IMGDATA->m_width) / width;
685
685
            double dx = srcpixx - (int)srcpixx;
686
686
 
687
687
            // Sums for each color channel
1671
1671
        alpha = (unsigned char *)malloc(M_IMGDATA->m_width*M_IMGDATA->m_height);
1672
1672
    }
1673
1673
 
1674
 
    free(M_IMGDATA->m_alpha);
 
1674
    if( !M_IMGDATA->m_staticAlpha )
 
1675
        free(M_IMGDATA->m_alpha);
 
1676
 
1675
1677
    M_IMGDATA->m_alpha = alpha;
1676
1678
    M_IMGDATA->m_staticAlpha = static_data;
1677
1679
}
1904
1906
        }
1905
1907
    }
1906
1908
 
1907
 
    free(M_IMGDATA->m_alpha);
 
1909
    if( !M_IMGDATA->m_staticAlpha )
 
1910
        free(M_IMGDATA->m_alpha);
 
1911
 
1908
1912
    M_IMGDATA->m_alpha = NULL;
 
1913
    M_IMGDATA->m_staticAlpha = false;
1909
1914
 
1910
1915
    return true;
1911
1916
}