PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext() { // FIXME: Should this be OwnPtr<QImage>? QImage* image = new QImage(createQImage()); OwnPtr<GraphicsContext> context = adoptPtr(new GraphicsContext(new QPainter(image))); context->takeOwnershipOfPlatformContext(); return context.release(); }
PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext() { // FIXME: Should this be OwnPtr<QImage>? QImage* image = new QImage(createQImage()); QPainter* painter = new QPainter(image); painter->setRenderHint(QPainter::SmoothPixmapTransform, true); OwnPtr<GraphicsContext> context = adoptPtr(new GraphicsContext(painter)); context->takeOwnershipOfPlatformContext(); return context.release(); }
void ShareableBitmap::paint(GraphicsContext& context, float scaleFactor, const IntPoint& dstPoint, const IntRect& srcRect) { if (qFuzzyCompare(scaleFactor, 1)) { paint(context, dstPoint, srcRect); return; } QImage image = createQImage(); QPainter* painter = context.platformContext(); painter->save(); painter->scale(scaleFactor, scaleFactor); painter->drawImage(dstPoint, image, QRect(srcRect)); painter->restore(); }
void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect) { QImage image = createQImage(); QPainter* painter = context.platformContext(); painter->drawImage(dstPoint, image, QRect(srcRect)); }
PassRefPtr<Image> ShareableBitmap::createImage() { QPixmap* pixmap = new QPixmap(QPixmap::fromImage(createQImage())); return BitmapImage::create(pixmap); }