};
-//static int s_numimages_ = 5;
-//static int s_millisecs_ = 500;
-static int s_numimages_ = 10;
-static int s_millisecs_ = 500;
+//static int const s_numimages_ = 5;
+static int const s_numimages_ = 10;
+static int const s_millisecs_ = 500;
+
+// FIXME THREAD
LoaderQueue & LoaderQueue::get()
{
static LoaderQueue singleton;
LYXERR(Debug::GRAPHICS, "LoaderQueue: "
<< cache_queue_.size() << " items in the queue");
int counter = s_numimages_;
- while (cache_queue_.size() && counter--) {
+ while (!cache_queue_.empty() && counter--) {
Cache::ItemPtr ptr = cache_queue_.front();
cache_set_.erase(ptr);
cache_queue_.pop_front();
/// The connection of the signal StatusChanged
boost::signals::connection sc_;
+ double displayPixelRatio() const
+ {
+ return params_.pixel_ratio;
+ }
+ void setDisplayPixelRatio(double scale)
+ {
+ params_.pixel_ratio = scale;
+ }
+
private:
///
void statusChanged();
}
+double Loader::displayPixelRatio() const
+{
+ return pimpl_->displayPixelRatio();
+}
+
+
+void Loader::setDisplayPixelRatio(double scale)
+{
+ pimpl_->setDisplayPixelRatio(scale);
+}
+
+
boost::signals::connection Loader::connect(slot_type const & slot) const
{
return pimpl_->signal_.connect(slot);
image_.reset(cached_item_->image()->clone());
+ if (params_.pixel_ratio == 1.0) {
+ string filename = cached_item_->filename().absFileName();
+ size_t idx = filename.find_last_of('.');
+ if (idx != string::npos && idx > 3) {
+ if (filename.substr(idx - 3, 3) == "@2x") {
+ params_.pixel_ratio = 2.0;
+ } else if (cached_item_->filename().extension() == "svgz") {
+ params_.pixel_ratio = 4.0;
+ } else if (cached_item_->filename().extension() == "svg") {
+ params_.pixel_ratio = 4.0;
+ }
+ }
+ }
+
bool const success = image_->setPixmap(params_);
if (success) {