mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
simplification
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21752 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d971afe2aa
commit
b89d0e2eb7
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user