Esempio n. 1
0
void GnashImage::update(const GnashImage& from)
{
    assert(from._pitch == _pitch);
    assert(_size <= from._size);
    assert(_type == from._type);
    assert(_location == from._location);
    std::memcpy(data(), from.data(), _size);
}
Esempio n. 2
0
// Write the given image to the given out stream, in jpeg format.
void
ImageOutput::writeImageData(FileType type,
    boost::shared_ptr<IOChannel> out, const GnashImage& image, int quality)
{
    
    const size_t width = image.width();
    const size_t height = image.height();
            
    std::auto_ptr<ImageOutput> outChannel;

    switch (type)
    {
#ifdef USE_PNG
        case GNASH_FILETYPE_PNG:
            outChannel = PngImageOutput::create(out, width,
                    height, quality);
            break;
#endif
        case GNASH_FILETYPE_JPEG:
            outChannel = JpegImageOutput::create(out, width,
                    height, quality);
            break;
        default:
            log_error("Requested to write image as unsupported filetype");
            break;
    }

    switch (image.type())
    {
        case GNASH_IMAGE_RGB:
            outChannel->writeImageRGB(image.data());
            break;
        case GNASH_IMAGE_RGBA:
            outChannel->writeImageRGBA(image.data());
            break;
        default:
            break;
    }

}
Esempio n. 3
0
void GnashVaapiImage::update(const GnashImage& from)
{
    assert(_pitch == from.pitch());
    assert(_size <= from.size());
    assert(_type == from.type());

    switch (from.location()) {
    case GNASH_IMAGE_CPU:
        this->update(const_cast<boost::uint8_t *>(from.data()));
        break;
    case GNASH_IMAGE_GPU:
        this->update(static_cast<const GnashVaapiImage &>(from).surface());
        break;
    default:
        assert(0);
        break;
    }
}