From 5852a1dcbbadb7fd0d5a9d7851aaa67f2370f3cf Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 4 Jan 2009 02:42:03 +0000 Subject: [PATCH] remove Rescale(), it is no longer used git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57822 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/bitmap.h | 4 --- src/gtk/bitmap.cpp | 64 ----------------------------------------- 2 files changed, 68 deletions(-) diff --git a/include/wx/gtk/bitmap.h b/include/wx/gtk/bitmap.h index c1eee5ca50..0469a707f0 100644 --- a/include/wx/gtk/bitmap.h +++ b/include/wx/gtk/bitmap.h @@ -110,10 +110,6 @@ public: bool HasPixbuf() const; GdkPixbuf *GetPixbuf() const; - // Basically, this corresponds to Win32 StretchBlt() - wxBitmap Rescale(int clipx, int clipy, int clipwidth, int clipheight, - int width, int height) const; - // raw bitmap access support functions void *GetRawData(wxPixelDataBase& data, int bpp); void UngetRawData(wxPixelDataBase& data); diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 1be0bb94a4..9076d3c0ac 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -309,70 +309,6 @@ bool wxBitmap::Create( int width, int height, int depth ) return Ok(); } -wxBitmap wxBitmap::Rescale(int clipx, int clipy, int clipwidth, int clipheight, - int width, int height) const -{ - wxBitmap bmp; - - wxCHECK_MSG(Ok(), bmp, wxT("invalid bitmap")); - - width = wxMax(width, 1); - height = wxMax(height, 1); - - const double scale_x = double(width) / clipwidth; - const double scale_y = double(height) / clipheight; - - // Converting to pixbuf, scaling with gdk_pixbuf_scale, and converting - // back, is faster than scaling pixmap ourselves. - - // use pixbuf if already available, - // otherwise create temporary pixbuf from pixmap - GdkPixbuf* pixbuf = M_BMPDATA->m_pixbuf; - if (pixbuf) - g_object_ref(pixbuf); - else - pixbuf = gdk_pixbuf_get_from_drawable( - NULL, M_BMPDATA->m_pixmap, NULL, - 0, 0, 0, 0, M_BMPDATA->m_width, M_BMPDATA->m_height); - - // new pixbuf for scaled wxBitmap - GdkPixbuf* pixbuf_scaled = gdk_pixbuf_new( - GDK_COLORSPACE_RGB, gdk_pixbuf_get_has_alpha(pixbuf), 8, width, height); - - // GDK_INTERP_NEAREST is the lowest-quality method for continuous-tone - // images, but the only one which preserves sharp edges - gdk_pixbuf_scale( - pixbuf, pixbuf_scaled, - 0, 0, width, height, -clipx*scale_x, -clipy*scale_y, scale_x, scale_y, - GDK_INTERP_NEAREST); - - g_object_unref(pixbuf); - bmp.SetPixbuf(pixbuf_scaled, M_BMPDATA->m_bpp); - - if (M_BMPDATA->m_mask) - { - pixbuf = gdk_pixbuf_get_from_drawable( - NULL, M_BMPDATA->m_mask->m_bitmap, NULL, - 0, 0, 0, 0, M_BMPDATA->m_width, M_BMPDATA->m_height); - - pixbuf_scaled = gdk_pixbuf_new( - GDK_COLORSPACE_RGB, false, 8, width, height); - - gdk_pixbuf_scale( - pixbuf, pixbuf_scaled, - 0, 0, width, height, -clipx, -clipy, scale_x, scale_y, - GDK_INTERP_NEAREST); - - g_object_unref(pixbuf); - - // use existing functionality to create mask from scaled pixbuf - wxBitmap maskbmp; - maskbmp.SetPixbuf(pixbuf_scaled); - bmp.SetMask(new wxMask(maskbmp, *wxBLACK)); - } - return bmp; -} - #if wxUSE_IMAGE bool wxBitmap::CreateFromImage(const wxImage& image, int depth) -- 2.45.2