Preserve original image in wxImageFileProperty
Rescale only the copy of the original image to preserve image quality.
This commit is contained in:
@@ -297,7 +297,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxBitmap m_bitmap; // final thumbnail area
|
wxBitmap m_bitmap; // final thumbnail area
|
||||||
wxImage m_image; // intermediate thumbnail area
|
wxImage m_image; // original thumbnail area
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Initialize m_image using the current file name.
|
// Initialize m_image using the current file name.
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxBitmap m_bitmap; // final thumbnail area
|
wxBitmap m_bitmap; // final thumbnail area
|
||||||
wxImage m_image; // intermediate thumbnail area
|
wxImage m_image; // original thumbnail area
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1876,7 +1876,7 @@ void wxImageFileProperty::OnCustomPaint( wxDC& dc,
|
|||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
wxPGPaintData& )
|
wxPGPaintData& )
|
||||||
{
|
{
|
||||||
if ( m_bitmap.IsOk() || m_image.IsOk() )
|
if ( m_image.IsOk() )
|
||||||
{
|
{
|
||||||
// Draw the thumbnail
|
// Draw the thumbnail
|
||||||
// Create the bitmap here because required size is not known in OnSetValue().
|
// Create the bitmap here because required size is not known in OnSetValue().
|
||||||
@@ -1889,10 +1889,14 @@ void wxImageFileProperty::OnCustomPaint( wxDC& dc,
|
|||||||
|
|
||||||
if ( !m_bitmap.IsOk() )
|
if ( !m_bitmap.IsOk() )
|
||||||
{
|
{
|
||||||
m_image.Rescale( rect.width, rect.height );
|
wxImage imgScaled = m_image;
|
||||||
m_bitmap = wxBitmap(m_image, dc);
|
imgScaled.Rescale(rect.width, rect.height);
|
||||||
|
m_bitmap = wxBitmap(imgScaled, dc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( m_bitmap.IsOk() )
|
||||||
|
{
|
||||||
dc.DrawBitmap(m_bitmap, rect.x, rect.y, false);
|
dc.DrawBitmap(m_bitmap, rect.x, rect.y, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user