コード例 #1
0
ファイル: ShareableBitmapQt.cpp プロジェクト: Moondee/Artemis
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();
}
コード例 #2
0
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();
}
コード例 #3
0
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();
}
コード例 #4
0
void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect)
{
    QImage image = createQImage();
    QPainter* painter = context.platformContext();
    painter->drawImage(dstPoint, image, QRect(srcRect));
}
コード例 #5
0
PassRefPtr<Image> ShareableBitmap::createImage()
{
    QPixmap* pixmap = new QPixmap(QPixmap::fromImage(createQImage()));
    return BitmapImage::create(pixmap);
}