Example #1
0
void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRectIn, ColorSpace styleColorSpace, CompositeOperator compositeOp, BlendMode blendMode, ImageOrientationDescription)
{
    if (!m_source.initialized())
        return;

    if (mayFillWithSolidColor())
        fillWithSolidColor(ctxt, dstRect, solidColor(), styleColorSpace, compositeOp);
    else {
        IntRect intSrcRect(srcRectIn);
        RefPtr<SharedBitmap> bmp = frameAtIndex(m_currentFrame);
        if (bmp) {
            if (bmp->width() != m_source.size().width()) {
                double scaleFactor = static_cast<double>(bmp->width()) / m_source.size().width();

                intSrcRect.setX(stableRound(srcRectIn.x() * scaleFactor));
                intSrcRect.setWidth(stableRound(srcRectIn.width() * scaleFactor));
                intSrcRect.setY(stableRound(srcRectIn.y() * scaleFactor));
                intSrcRect.setHeight(stableRound(srcRectIn.height() * scaleFactor));
            }
            bmp->draw(ctxt, enclosingIntRect(dstRect), intSrcRect, styleColorSpace, compositeOp, blendMode);
        }
    }

    startAnimation();
}
Example #2
0
void BufferedImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator compositeOp, BlendMode blendMode)
{
    IntRect intDstRect = enclosingIntRect(dstRect);
    IntRect intSrcRect(srcRect);
    m_data->m_bitmap->draw(ctxt, intDstRect, intSrcRect, styleColorSpace, compositeOp, blendMode);
}
void BufferedImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp)
{
    IntRect intDstRect = enclosingIntRect(dstRect);
    IntRect intSrcRect(srcRect);
    m_data->m_bitmap->draw(ctxt, intDstRect, intSrcRect, compositeOp);
}