Exemple #1
0
Renderer*
HaikuAggGlue::createRenderHandler(int bpp)
{
    _bpp = bpp;

    assert(_bpp == 32); // XXX

    const char *pixelformat = "";

    switch (_bpp) {
        case 32:
            pixelformat = "BGRA32";
            // other choices include RGBA32
            break;
        case 24:
            pixelformat = "RGB24";
            break;
        case 16:
            pixelformat = "RGBA16";
            break;
      default:
            log_error (_("AGG's bit depth must be 16, 24 or 32 bits, not %d."), _bpp);
            abort();
    }
    _agg_renderer = create_Renderer_agg(pixelformat);
    if ( ! _agg_renderer )
    {
        boost::format fmt = boost::format(
                    _("Could not create AGG renderer with pixelformat %s")
                ) % pixelformat;
        throw GnashException(fmt.str());
    }
    return _agg_renderer;
}
Exemple #2
0
Renderer*
GtkAggGlue::createRenderHandler()
{
    GdkVisual* wvisual = gdk_drawable_get_visual(_drawing_area->window);

    GdkImage* tmpimage = gdk_image_new (GDK_IMAGE_FASTEST, wvisual, 1, 1);

    const GdkVisual* visual = tmpimage->visual;

    // FIXME: we use bpp instead of depth, because depth doesn't appear to
    // include the padding byte(s) the GdkImage actually has.
    const char *pixelformat = agg_detect_pixel_format(
        visual->red_shift, visual->red_prec,
        visual->green_shift, visual->green_prec,
        visual->blue_shift, visual->blue_prec,
        tmpimage->bpp * 8);

    gdk_image_destroy(tmpimage);

    _agg_renderer = create_Renderer_agg(pixelformat);
    if (! _agg_renderer) {
        boost::format fmt = boost::format(
            _("Could not create AGG renderer with pixelformat %s")
            ) % pixelformat;
        throw GnashException(fmt.str());
    }

    return _agg_renderer;
}
Exemple #3
0
Renderer*
GtkAggVaapiGlue::createRenderHandler()
{
    dprintf("GtkAggVaapiGlue::createRenderHandler()\n");

    VaapiGlobalContext * const gvactx = VaapiGlobalContext::get();
    if (!gvactx)
        return NULL;

    std::vector<VaapiImageFormat> formats = gvactx->getSubpictureFormats();
    for (unsigned int i = 0; i < formats.size(); i++) {
        if (vaapi_image_format_is_rgb(formats[i])) {
            _vaapi_image_format = formats[i];
            break;
        }
    }
    if (_vaapi_image_format == VAAPI_IMAGE_NONE)
        return NULL;

    const char *agg_pixel_format;
    agg_pixel_format = find_pixel_format(_vaapi_image_format);
    if (!agg_pixel_format) {
        log_debug("GTK-AGG: Unknown RGB format %s reported by VA-API."
                  "  Please report this to the gnash-dev "
                  "mailing list.", string_of_FOURCC(_vaapi_image_format));
        return NULL;
    }

    Renderer * const renderer = create_Renderer_agg(agg_pixel_format);
    _agg_renderer = static_cast<Renderer_agg_base *>(renderer);
    return renderer;
}
Exemple #4
0
Renderer*
FltkAggGlue::createRenderHandler()
{
    _renderer = create_Renderer_agg("RGB24");
    if (_renderer == NULL)
        throw GnashException(_("Could not create AGG renderer with pixelformat RGB24"));
    return _renderer;
}
Exemple #5
0
Renderer*
Qt4AggGlue::createRenderHandler()
{
    _renderer = create_Renderer_agg("BGRA32");

    if ( ! _renderer )
    {
        throw GnashException(_("Could not create AGG renderer with pixelformat ABGR32"));
    }
    return _renderer;
}
Exemple #6
0
bool
DumpGui::init(int argc, char **argv[])
{
    int origopterr = opterr;

    if (_xid) {
        log_error(_("Ignoring request to display in X11 window"));
    }

    optind = 0;
    opterr = 0;
    char c;
    while ((c = getopt(argc, *argv, "D:S:T:")) != -1) {
        if (c == 'D') {
            // Terminate if no filename is given.
            if (!optarg) {
                std::cout << 
                    _("# FATAL:  No filename given with -D argument.") <<
                    std::endl;      
                return false;
            }      
            std::vector<std::string> file_fps;
            boost::split(file_fps, optarg,
                boost::is_any_of("@"), boost::token_compress_on);
            _fileOutput = file_fps[0];
            if ( file_fps.size() > 1 ) {
                _fileOutputFPS = boost::lexical_cast<unsigned int>(file_fps[1]);
            }
        }
        else if (c == 'S') {
            // Terminate if no filename is given.
            if (!optarg) {
                std::cout << 
                    _("# FATAL:  No sleep ms value given with -S argument.") <<
                    std::endl;
                return false;
            }      
            // we take milliseconds
            _sleepUS = std::atoi(optarg) * 1000;
        }
        else if (c == 'T') {
            // Terminate if no filename is given.
            if (!optarg) {
                std::cerr << 
                    _("# FATAL:  No trigger value given with -T argument.\n");
                return false;
            }      
            // we take milliseconds
            _startTrigger = optarg;
        }
    }
    opterr = origopterr;

    std::signal(SIGINT, terminate_signal);
    std::signal(SIGTERM, terminate_signal);

    init_dumpfile();

    if (_startTrigger.empty()) _started = true;

    _renderer.reset(create_Renderer_agg(_pixelformat.c_str()));
    _runResources.setRenderer(_renderer);

    sound::sound_handler* mixer = _runResources.soundHandler();
    media::MediaHandler* mh = _runResources.mediaHandler();
    _soundHandler.reset(new sound::NullSoundHandler(mh, mixer));
    _runResources.setSoundHandler(_soundHandler);

    // We know what type of renderer it is.
    _agg_renderer = static_cast<Renderer_agg_base*>(_renderer.get());
    
    return true;
}
Exemple #7
0
Renderer *
FBAggGlue::createRenderHandler()
{
//    GNASH_REPORT_FUNCTION;

    if (!_device) {
        log_error(_("No Device layer initialized yet!"));
        return 0;
    }
    
    const int width     = _device->getWidth();
    const int height    = _device->getHeight();
    
    _validbounds.setTo(0, 0, width - 1, height - 1);
    
    // choose apropriate pixel format

    renderer::rawfb::RawFBDevice *rawfb = reinterpret_cast
        <renderer::rawfb::RawFBDevice *>(_device.get());
    log_debug("red channel: %d / %d", rawfb->getRedOffset(), 
	      rawfb->getRedSize());
    log_debug("green channel: %d / %d", rawfb->getGreenOffset(), 
	      rawfb->getGreenSize());
    log_debug("blue channel: %d / %d", rawfb->getBlueOffset(), 
              rawfb->getBlueSize());
    log_debug("Total bits per pixel: %d",  rawfb->getDepth());
    
    const char* pixelformat = agg_detect_pixel_format(
        rawfb->getRedOffset(),   rawfb->getRedSize(),
        rawfb->getGreenOffset(), rawfb->getGreenSize(),
        rawfb->getBlueOffset(),  rawfb->getBlueSize(),
        rawfb->getDepth());

    Renderer_agg_base *agg_handler = 0;
    if (pixelformat) {
	agg_handler = create_Renderer_agg(pixelformat);
    } else {
	log_error(_("The pixel format of your framebuffer could not be detected."));
	return false;
    }
    
    assert(agg_handler != NULL);

    // Get the memory buffer to have AGG render into.
    boost::uint8_t *mem = 0;
    if (rawfb->isSingleBuffered()) {
        log_debug(_("Double buffering disabled"));
        mem = rawfb->getFBMemory();
    } else {
        log_debug(_("Double buffering enabled"));
        mem = rawfb->getOffscreenBuffer();
    }

    // This attaches the memory from the device to the AGG renderer
    agg_handler->init_buffer((unsigned char *)mem, rawfb->getFBMemSize(),
                             width, height, rawfb->getStride());

    _renderer.reset(agg_handler);
    
    return (Renderer *)agg_handler;
}