void PictureImage::draw(QPainter& painter, int x, int y, int width, int height, int sx, int sy, int sw, int sh, bool fastMode) { //kDebug(30508) <<"KoImage::draw currentSize:" << currentSize.width() <<"x" << currentSize.height(); if (!width || !height) return; QSize origSize = getOriginalSize(); const bool scaleImage = dynamic_cast<QPrinter*>(painter.device()) != 0 // we are printing && ((width <= origSize.width()) || (height <= origSize.height())); if (scaleImage) { // use full resolution of image qreal xScale = qreal(width) / qreal(origSize.width()); qreal yScale = qreal(height) / qreal(origSize.height()); painter.save(); painter.translate(x, y); painter.scale(xScale, yScale); // Note that sx, sy, sw and sh are unused in this case. Not a problem, since it's about printing. // Note 2: we do not cache the QPixmap. As we are printing, the next time we will probably // need again the screen version. painter.drawImage(0, 0, m_originalImage); painter.restore(); } else { QSize screenSize(width, height); //kDebug(30508) <<"PictureImage::draw screenSize=" << screenSize.width() <<"x" << screenSize.height(); scaleAndCreatePixmap(screenSize, fastMode); // sx,sy,sw,sh is meant to be used as a cliprect on the pixmap, but drawPixmap // translates it to the (x,y) point -> we need (x+sx, y+sy). painter.drawPixmap(x + sx, y + sy, m_cachedPixmap, sx, sy, sw, sh); } }
GmDirInfo GmRestFileNode::getDirectoryInfo () const { GmDirInfo subInfo; ++subInfo.totalFiles; subInfo.totalSize = getOriginalSize (_pFileNode); return subInfo; }
QMimeData* PictureBase::dragObject(QWidget * dragSource, const char * name) { Q_UNUSED(dragSource); QImage image(generateImage(getOriginalSize())); if (image.isNull()) return 0; else { QMimeData* mimeData = new QMimeData(); mimeData->setImageData(image); mimeData->setObjectName(name); return mimeData; // XXX: Qt3 use dragsource here? } }