simplification

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21752 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-11-23 22:57:11 +00:00
parent d971afe2aa
commit b89d0e2eb7
2 changed files with 10 additions and 26 deletions

View File

@ -74,31 +74,17 @@ string const & PreviewImage::snippet() const
}
int PreviewImage::ascent() const
Dimension PreviewImage::dim() const
{
Dimension dim;
Image const * const image = pimpl_->iloader_.image();
if (!image)
return 0;
return dim;
return int(pimpl_->ascent_frac_ * double(image->height()));
}
int PreviewImage::descent() const
{
Image const * const image = pimpl_->iloader_.image();
if (!image)
return 0;
// Avoids rounding errors.
return image->height() - ascent();
}
int PreviewImage::width() const
{
Image const * const image = pimpl_->iloader_.image();
return image ? image->width() : 0;
dim.asc = int(pimpl_->ascent_frac_ * double(image->height()));
dim.des = image->height() - dim.asc;
dim.wid = image->width();
return dim;
}

View File

@ -18,6 +18,8 @@ namespace lyx {
namespace support { class FileName; }
class Dimension;
namespace graphics {
class PreviewLoader;
@ -38,11 +40,7 @@ public:
///
std::string const & snippet() const;
///
int ascent() const;
///
int descent() const;
///
int width() const;
Dimension dim() const;
/** If the image is not yet loaded (WaitingToLoad), then this method
* triggers that.