Esempio n. 1
0
void
GnashImage::update(const GnashImage& from)
{
    assert(size() <= from.size());
    assert(width() == from.width());
    assert(_type == from._type);
    assert(_location == from._location);
    std::copy(from.begin(), from.begin() + size(), begin());
}
Esempio n. 2
0
// Write the given image to the given out stream, in jpeg format.
void
Output::writeImageData(FileType type,
    std::shared_ptr<IOChannel> out, const GnashImage& image, int quality)
{
    
    const size_t width = image.width();
    const size_t height = image.height();
    
    quality = clamp<int>(quality, 0, 100);    

    std::unique_ptr<Output> outChannel;

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

    switch (image.type()) {
        case TYPE_RGB:
            outChannel->writeImageRGB(image.begin());
            break;
        case TYPE_RGBA:
            outChannel->writeImageRGBA(image.begin());
            break;
        default:
            break;
    }

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

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