NxWidgets::CImage: Allow NULL bitmaps. From Petteri Aimonen
This commit is contained in:
parent
d69d3cd080
commit
1e7b43629a
@ -347,25 +347,28 @@
|
|||||||
|
|
||||||
1.8 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
1.8 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
|
||||||
* NxWM::CMediaPlayer: shell application for an MP3 Media Player with
|
* NxWM::CMediaPlayer: shell application for an MP3 Media Player with
|
||||||
Kconfig settings to enable it. I plan to write this app to help
|
Kconfig settings to enable it. I plan to write this app to help
|
||||||
develop and test the MP3 codec chip driver. It really doesn't do
|
develop and test the MP3 codec chip driver. It really doesn't do
|
||||||
anything yet except display a text box saying "Coming soon", and I
|
anything yet except display a text box saying "Coming soon", and I
|
||||||
need to minimize the icon size a bit. From Ken Pettit (2013-5-11).
|
need to minimize the icon size a bit. From Ken Pettit (2013-5-11).
|
||||||
* NxWidgets/nxwm/src/glyph_mediaplayer.cxx: Smaller version of the
|
* NxWidgets/nxwm/src/glyph_mediaplayer.cxx: Smaller version of the
|
||||||
media player glyph. From Ken Pettit (2013-5-12).
|
media player glyph. From Ken Pettit (2013-5-12).
|
||||||
* NxWidgets/nxwm/include/ccalibration.hxx and src/ccalibration.cxx:
|
* NxWidgets/nxwm/include/ccalibration.hxx and src/ccalibration.cxx:
|
||||||
Fix a race condition that would cause the calibration screen
|
Fix a race condition that would cause the calibration screen
|
||||||
to fail to come up when its icon was touched (From Ken Pettit,
|
to fail to come up when its icon was touched (From Ken Pettit,
|
||||||
2013-5-12).
|
2013-5-12).
|
||||||
* Kconfig: Default priorities for NxWidget and NxWM threads
|
* Kconfig: Default priorities for NxWidget and NxWM threads
|
||||||
should be 100, not 50, to be consistent with other default priorities.
|
should be 100, not 50, to be consistent with other default priorities.
|
||||||
* NxWidgets::CGlyphSliderHorizontal and NxWidgets::CGlyphSliderHorizontalGrip:
|
* NxWidgets::CGlyphSliderHorizontal and NxWidgets::CGlyphSliderHorizontalGrip:
|
||||||
New widgets added by Ken Pettit (2013-5-15).
|
New widgets added by Ken Pettit (2013-5-15).
|
||||||
* NxWidgets/UnitTests/CGlyphSliderHorizontal: Addes a unit test for the
|
* NxWidgets/UnitTests/CGlyphSliderHorizontal: Addes a unit test for the
|
||||||
NxWidgets::CGlyphSliderHorizontal class. From Ken Pettit (2013-5-17) .
|
NxWidgets::CGlyphSliderHorizontal class. From Ken Pettit (2013-5-17) .
|
||||||
* NxWidgets::CGlyphSliderHorizontal: Fix a drawing error. From Ken
|
* NxWidgets::CGlyphSliderHorizontal: Fix a drawing error. From Ken
|
||||||
Pettit (2013-5-17).
|
Pettit (2013-5-17).
|
||||||
* UnitTests/*/Makefile and .gitignore: Update the way that NSH
|
* UnitTests/*/Makefile and .gitignore: Update the way that NSH
|
||||||
the Unit Tests are registered as built-in NSH applications (2013-5-30).
|
the Unit Tests are registered as built-in NSH applications (2013-5-30).
|
||||||
|
* NxWidgets::CImage: Allow a NULL pointer for a bitmap. Add protection
|
||||||
|
to prevent dereferencing the NULL pointer. From Petteri Aimonen
|
||||||
|
(2013-6-3).
|
||||||
|
|
||||||
|
@ -138,19 +138,29 @@ CImage::CImage(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
|
|||||||
|
|
||||||
void CImage::getPreferredDimensions(CRect &rect) const
|
void CImage::getPreferredDimensions(CRect &rect) const
|
||||||
{
|
{
|
||||||
nxgl_coord_t width = m_bitmap->getWidth();
|
if (!m_bitmap)
|
||||||
nxgl_coord_t height = m_bitmap->getHeight();
|
|
||||||
|
|
||||||
if (!m_flags.borderless)
|
|
||||||
{
|
{
|
||||||
width += (m_borderSize.left + m_borderSize.right);
|
rect.setX(m_rect.getX());
|
||||||
height += (m_borderSize.top + m_borderSize.bottom);
|
rect.setY(m_rect.getY());
|
||||||
|
rect.setWidth(0);
|
||||||
|
rect.setHeight(0);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nxgl_coord_t width = m_bitmap->getWidth();
|
||||||
|
nxgl_coord_t height = m_bitmap->getHeight();
|
||||||
|
|
||||||
rect.setX(m_rect.getX());
|
if (!m_flags.borderless)
|
||||||
rect.setY(m_rect.getY());
|
{
|
||||||
rect.setWidth(width);
|
width += (m_borderSize.left + m_borderSize.right);
|
||||||
rect.setHeight(height);
|
height += (m_borderSize.top + m_borderSize.bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.setX(m_rect.getX());
|
||||||
|
rect.setY(m_rect.getY());
|
||||||
|
rect.setWidth(width);
|
||||||
|
rect.setHeight(height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -440,7 +450,7 @@ void CImage::onReleaseOutside(nxgl_coord_t x, nxgl_coord_t y)
|
|||||||
|
|
||||||
void CImage::setImageLeft(nxgl_coord_t column)
|
void CImage::setImageLeft(nxgl_coord_t column)
|
||||||
{
|
{
|
||||||
if (column > 0 && column <= m_bitmap->getWidth())
|
if (m_bitmap && column > 0 && column <= m_bitmap->getWidth())
|
||||||
{
|
{
|
||||||
m_origin.x = column;
|
m_origin.x = column;
|
||||||
}
|
}
|
||||||
@ -455,7 +465,7 @@ void CImage::setImageLeft(nxgl_coord_t column)
|
|||||||
|
|
||||||
void CImage::setImageTop(nxgl_coord_t row)
|
void CImage::setImageTop(nxgl_coord_t row)
|
||||||
{
|
{
|
||||||
if (row > 0 && row <= m_bitmap->getHeight())
|
if (m_bitmap && row > 0 && row <= m_bitmap->getHeight())
|
||||||
{
|
{
|
||||||
m_origin.x = row;
|
m_origin.x = row;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user