QImage KritaShape::convertToQImage() { if (m_d->doc && m_d->doc->image()) { KisImageSP img = m_d->doc->image(); return img->convertToQImage(0, 0, img->width(), img->height(), m_d->displayProfile); } return QImage(); }
void KritaShape::paint(QPainter& painter, const KoViewConverter& converter) { if (m_d && m_d->doc && m_d->doc->image()) { // XXX: Only convert the bit the painter needs for painting? // Or should we keep a converted qimage in readiness, // just as with KisCanvas2? KisImageSP kimage = m_d->doc->image(); QImage qimg = kimage->convertToQImage(0, 0, kimage->width(), kimage->height(), m_d->displayProfile); // XXX: How about exposure? const QRectF paintRect = QRectF(QPointF(0.0, 0.0), size()); applyConversion(painter, converter); painter.drawImage(paintRect.toRect(), qimg); } else if (m_d->doc == 0) tryLoadFromImageData(dynamic_cast<KoImageData*>(KoShape::userData())); }