Esempio n. 1
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;
    }
}
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
// 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;
    }

}