X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/80bd086077555c0c0e379c5467cbce413cfd77a0..993da3969b28e4f80b492cc26114fb0e151163cb:/src/html/m_image.cpp diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp index 3a24f08ecb..58aaa45e23 100644 --- a/src/html/m_image.cpp +++ b/src/html/m_image.cpp @@ -7,7 +7,7 @@ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation #endif @@ -71,6 +71,9 @@ class wxHtmlImageMapAreaCell : public wxHtmlCell int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(view_y1), int WXUNUSED(view_y2), wxHtmlRenderingInfo& WXUNUSED(info)) {} + + + DECLARE_NO_COPY_CLASS(wxHtmlImageMapAreaCell) }; @@ -247,6 +250,8 @@ class wxHtmlImageMapCell : public wxHtmlCell int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(view_y1), int WXUNUSED(view_y2), wxHtmlRenderingInfo& WXUNUSED(info)) {} + + DECLARE_NO_COPY_CLASS(wxHtmlImageMapCell) }; @@ -459,12 +464,16 @@ void wxHtmlImageCell::SetImage(const wxImage& img) if ( m_bmpH == -1 ) m_bmpH = hh; + // Only scale the bitmap at the rendering stage, + // so we don't lose quality twice +/* if ((m_bmpW != ww) || (m_bmpH != hh)) { wxImage img2 = img.Scale(m_bmpW, m_bmpH); m_bitmap = new wxBitmap(img2); } else +*/ m_bitmap = new wxBitmap(img); } } @@ -542,12 +551,21 @@ void wxHtmlImageCell::Draw(wxDC& dc, int x, int y, } if ( m_bitmap ) { + // We add in the scaling from the desired bitmap width + // and height, so we only do the scaling once. + double imageScaleX = 1.0; + double imageScaleY = 1.0; + if (m_bmpW != m_bitmap->GetWidth()) + imageScaleX = (double) m_bmpW / (double) m_bitmap->GetWidth(); + if (m_bmpH != m_bitmap->GetHeight()) + imageScaleY = (double) m_bmpH / (double) m_bitmap->GetHeight(); + double us_x, us_y; dc.GetUserScale(&us_x, &us_y); - dc.SetUserScale(us_x * m_scale, us_y * m_scale); + dc.SetUserScale(us_x * m_scale * imageScaleX, us_y * m_scale * imageScaleY); - dc.DrawBitmap(*m_bitmap, (int) ((x + m_PosX) / m_scale), - (int) ((y + m_PosY) / m_scale), TRUE); + dc.DrawBitmap(*m_bitmap, (int) ((x + m_PosX) / (m_scale*imageScaleX)), + (int) ((y + m_PosY) / (m_scale*imageScaleY)), TRUE); dc.SetUserScale(us_x, us_y); } } @@ -589,6 +607,7 @@ wxHtmlLinkInfo *wxHtmlImageCell::GetLink( int x, int y ) const //-------------------------------------------------------------------------------- TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA") + TAG_HANDLER_CONSTR(IMG) { } TAG_HANDLER_PROC(tag) {