void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo& updateInfo)
{
    if (!m_backend)
        m_backend = createBackend();

    scroll(updateInfo.scrollRect, updateInfo.scrollOffset);

    // Paint all update rects.
    IntPoint updateRectLocation = updateInfo.updateRectBounds.location();
    RefPtr<cairo_t> context = adoptRef(cairo_create(m_backend->surface()));
    GraphicsContext graphicsContext(context.get());
    for (const auto& updateRect : updateInfo.updateRects) {
        IntRect srcRect = updateRect;
        srcRect.move(-updateRectLocation.x(), -updateRectLocation.y());
#if PLATFORM(GTK)
        if (!m_webPageProxy.drawsBackground()) {
            const WebCore::Color color = m_webPageProxy.backgroundColor();
            if (color.hasAlpha())
                graphicsContext.clearRect(srcRect);
            if (color.alpha() > 0)
                graphicsContext.fillRect(srcRect, color, ColorSpaceDeviceRGB);
        }
#endif
        bitmap->paint(graphicsContext, deviceScaleFactor(), updateRect.location(), srcRect);
    }
}
Exemplo n.º 2
0
int Slang::compile() {
  if (mDiagnostics->hasErrorOccurred())
    return 1;
  if (mOS.get() == NULL)
    return 1;

  // Here is per-compilation needed initialization
  createPreprocessor();
  createASTContext();

  mBackend.reset(createBackend(CodeGenOpts, &mOS->os(), mOT));

  // Inform the diagnostic client we are processing a source file
  mDiagClient->BeginSourceFile(LangOpts, mPP.get());

  // The core of the slang compiler
  ParseAST(*mPP, mBackend.get(), *mASTContext);

  // Inform the diagnostic client we are done with previous source file
  mDiagClient->EndSourceFile();

  // Declare success if no error
  if (!mDiagnostics->hasErrorOccurred())
    mOS->keep();

  // The compilation ended, clear
  mBackend.reset();
  mASTContext.reset();
  mPP.reset();
  mOS.reset();

  return mDiagnostics->hasErrorOccurred() ? 1 : 0;
}
void FactoryPrivate::phononBackendChanged()
{
    if (m_backendObject) {
        for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
            mediaNodePrivateList.at(i)->deleteBackendObject();
        }
        if (objects.size() > 0) {
            pDebug() << "WARNING: we were asked to change the backend but the application did\n"
                "not free all references to objects created by the factory. Therefore we can not\n"
                "change the backend without crashing. Now we have to wait for a restart to make\n"
                "backendswitching possible.";
            // in case there were objects deleted give 'em a chance to recreate
            // them now
            for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
                mediaNodePrivateList.at(i)->createBackendObject();
            }
            return;
        }
        delete m_backendObject;
        m_backendObject = 0;
    }
    createBackend();
    for (int i = 0; i < mediaNodePrivateList.count(); ++i) {
        mediaNodePrivateList.at(i)->createBackendObject();
    }
    emit backendChanged();
}
Exemplo n.º 4
0
SymmetricCipher::SymmetricCipher(SymmetricCipher::Algorithm algo, SymmetricCipher::Mode mode,
                                 SymmetricCipher::Direction direction, const QByteArray& key, const QByteArray& iv)
    : m_backend(createBackend(algo, mode, direction))
{
    m_backend->setKey(key);
    m_backend->setIv(iv);
}
Exemplo n.º 5
0
SimpleCCodeGenerator* CodeGeneratorTest::getCodeGenerator() {
  if (!codeGen) {
    backend = createBackend();
    codeGen.reset(new SimpleCCodeGenerator(backend));

    configureCodeGenerator();
  }

  return codeGen.get();
}
Exemplo n.º 6
0
HttpBackend* HttpDirector::createBackend(const std::string& name, const std::string& url)
{
	std::string protocol, hostname, path, query;
	int port = 0;

	if (!parseUrl(url, protocol, hostname, port, path, query)) {
		TRACE("invalid URL: %s", url.c_str());
		return false;
	}

	return createBackend(name, protocol, hostname, port, path, query);
}
Exemplo n.º 7
0
//==============================================================================
Error GrManagerImpl::init(GrManagerInitInfo& init)
{
	// Init the backend of the backend
	ANKI_CHECK(createBackend(init));

	// Create thread
	m_thread =
		m_manager->getAllocator().newInstance<RenderingThread>(m_manager);

	// Start it
	m_thread->start(init.m_debugContext, *init.m_config);
	m_thread->syncClientServer();

	return ErrorCode::NONE;
}
Exemplo n.º 8
0
      bool TestRender::option( const std::vector<std::string>& optionString )
      {
        options::options_description od("Usage: DPTApp");
        od.add_options()
          ( "width", options::value<unsigned int>()->default_value(1024), "Width of the render window" )
          ( "height", options::value<unsigned int>()->default_value(768), "Height of the render window" )
          ( "renderer", options::value<std::string>(), "The renderer that will be used" )
          ( "backend", options::value<std::string>(), "The backend to use" )
          ;

        options::basic_parsed_options<char> parsedOpts = options::basic_command_line_parser<char>( optionString ).options( od ).allow_unregistered().run();

        options::variables_map optsMap;
        options::store( parsedOpts, optsMap );

        // Width
        m_width = optsMap["width"].as<unsigned int>();

        // Height
        m_height = optsMap["height"].as<unsigned int>();

        // All additional options

        std::vector<std::string> possibleRendererOptions = options::collect_unrecognized( parsedOpts.options, options::include_positional );

        // Backend

        if( !optsMap["backend"].empty() )
        {
          m_backendName = optsMap["backend"].as<std::string>();
        }

        // Renderer

        if( optsMap["renderer"].empty() )
        {
          std::cerr << "Error: A renderer must be specified\n";
          return false;
        }
        else
        {
          m_backend = createBackend( optsMap["renderer"].as<std::string>(), possibleRendererOptions );
          m_rendererSpecified = true;
        }

        return !!m_backend;
      }
Exemplo n.º 9
0
MainWindow::MainWindow(Arguments *args)
    : QMainWindow(),
      ui(new Ui::MainWindow),
      _hasPlaylist(false),
      _isLite(false),
      _select(0),
      _locale(new LocaleManager()),
      _model(new PlaylistModel(this)),
      _modelUpdate(new PlaylistUpdate(_model)),
      _channel(0),
      _xmltv(new XmltvManager()),
      _previewTimer(new QTimer(this)),
      _udpxy(new NetworkUdpxy()),
      _osdFloat(0),
      _playlistEditor(0),
      _trayIcon(0)
{
    _arguments = args;

    ui->setupUi(this);

#if defined(Q_OS_LINUX)
    ui->menuAbout->removeAction(ui->actionUpdate);
#else
    ui->actionUpdate->setMenuRole(QAction::ApplicationSpecificRole);
#endif

    createDesktopStartup();
    createBackend();
    createMenus();
    createSettings();
    createGui();
    createShortcuts();
    createConnections();
    _mediaPlayer->createSession(_hasPlaylist && _model->validate());

    qApp->installEventFilter(this);

    tooltip();
}