Esempio n. 1
0
FontConverter::FontConverter(const Arguments& arguments): Platform::WindowlessApplication(arguments, nullptr) {
    args.addArgument("input").setHelp("input", "input font")
        .addArgument("output").setHelp("output", "output filename prefix")
        .addNamedArgument("font").setHelp("font", "font plugin")
        .addNamedArgument("converter").setHelp("converter", "font converter plugin")
        .addOption("plugin-dir", MAGNUM_PLUGINS_DIR).setHelpKey("plugin-dir", "DIR").setHelp("plugin-dir", "base plugin dir")
        .addOption("characters", "abcdefghijklmnopqrstuvwxyz"
                                 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                                 "0123456789?!:;,. ").setHelp("characters", "characters to include in the output")
        .addOption("font-size", "128").setHelpKey("font-size", "N").setHelp("font-size", "input font size")
        .addOption("atlas-size", "2048 2048").setHelpKey("atlas-size", "\"X Y\"").setHelp("atlas-size", "glyph atlas size")
        .addOption("output-size", "256 256").setHelpKey("output-size", "\"X Y\"").setHelp("output-size", "output atlas size. If set to zero size, distance field computation will not be used.")
        .addOption("radius", "24").setHelpKey("radius", "N").setHelp("radius", "distance field computation radius")
        .setHelp("Converts font to raster one of given atlas size.")
        .parse(arguments.argc, arguments.argv);

    createContext();
}
Esempio n. 2
0
bool JSAPITest::init()
{
    rt = createRuntime();
    if (!rt)
        return false;
    cx = createContext();
    if (!cx)
        return false;
#ifdef JS_GC_ZEAL
    JS_SetGCZeal(cx, 0, 0);
#endif
    JS_BeginRequest(cx);
    js::RootedObject global(cx, createGlobal());
    if (!global)
        return false;
    oldCompartment = JS_EnterCompartment(cx, global);
    return oldCompartment != NULL;
}
Esempio n. 3
0
GLC_Context* GLC_ContextManager::currentContext()
{
    QOpenGLContext* pFromContext= QOpenGLContext::currentContext();
    GLC_Context* pSubject= NULL;
    if (NULL != pFromContext)
    {
        if (m_OpenGLContextToGLCContext.contains(pFromContext))
        {
            pSubject= m_OpenGLContextToGLCContext.value(pFromContext);
        }
        else
        {
            pSubject= createContext(pFromContext, pFromContext->surface());
        }
        pSubject->setCurrent();
    }

    return pSubject;
}
Esempio n. 4
0
GlContext::GlContext(const ContextSettings& settings, const priv::WindowImplWin32* owner, unsigned int bitsPerPixel)
:
m_window(NULL),
m_deviceContext(NULL),
m_context(NULL),
m_ownsWindow(false)
{
	// Get the owner window and its device context
	m_window = owner->getSystemHandle();
	m_deviceContext = GetDC(m_window);

	// Create the context
	if (m_deviceContext)
	{
		createContext(bitsPerPixel, settings);
	}

	makeCurrent();
}
Esempio n. 5
0
void QQuickCanvasItem::setContextType(const QString &contextType)
{
    Q_D(QQuickCanvasItem);

    if (contextType.compare(d->contextType, Qt::CaseInsensitive) == 0)
        return;

    if (d->context) {
        qmlInfo(this) << "Canvas already initialized with a different context type";
        return;
    }

    d->contextType = contextType;

    if (d->available)
        createContext(contextType);

    emit contextTypeChanged();
}
Esempio n. 6
0
int main (int argc, char **argv)
{
  ini_sContext *cp;
  pwr_tStatus sts;

  cp = createContext(argc, argv);

  ver_WriteVersionInfo("Proview/R Storage Environment");

  if (cp->flags.b.stop) {
    sts = stop(argc, argv, cp);
  } else {
    sts = start(cp);
    sts = events(cp);
    errh_LogInfo(&cp->log, "Ich sterbe!!");
  }

  exit(sts);
}
Esempio n. 7
0
WglContext::WglContext(WglContext* shared) :
m_window       (NULL),
m_deviceContext(NULL),
m_context      (NULL),
m_ownsWindow   (true)
{
    // Creating a dummy window is mandatory: we could create a memory DC but then
    // its pixel format wouldn't match the regular contexts' format, and thus
    // wglShareLists would always fail. Too bad...

    // Create a dummy window (disabled and hidden)
    m_window = CreateWindowA("STATIC", "", WS_POPUP | WS_DISABLED, 0, 0, 1, 1, NULL, NULL, GetModuleHandle(NULL), NULL);
    ShowWindow(m_window, SW_HIDE);
    m_deviceContext = GetDC(m_window);

    // Create the context
    if (m_deviceContext)
        createContext(shared, VideoMode::getDesktopMode().bitsPerPixel, ContextSettings());
}
Esempio n. 8
0
void QgsLocatorWidget::updateResults( const QString &text )
{
  if ( mLocator->isRunning() )
  {
    // can't do anything while a query is running, and can't block
    // here waiting for the current query to cancel
    // so we queue up this string until cancel has happened
    mLocator->cancelWithoutBlocking();
    mNextRequestedString = text;
    mHasQueuedRequest = true;
    return;
  }
  else
  {
    mHasSelectedResult = false;
    mLocatorModel->deferredClear();
    mLocator->fetchResults( text, createContext() );
  }
}
Esempio n. 9
0
static void processFunction (tokenInfo *const token)
{
	int c;
	tokenInfo *classType;

	/* Search for function name
	 * Last identifier found before a '(' or a ';' is the function name */
	c = skipWhite (vGetc ());
	do
	{
		readIdentifier (token, c);
		c = skipWhite (vGetc ());
		/* Identify class type prefixes and create respective context*/
		if (isLanguage (Lang_systemverilog) && c == ':')
		{
			c = vGetc ();
			if (c == ':')
			{
				verbose ("Found function declaration with class type %s\n", vStringValue (token->name));
				classType = newToken ();
				vStringCopy (classType->name, token->name);
				classType->kind = K_CLASS;
				createContext (classType);
				currentContext->classScope = TRUE;
			}
			else
			{
				vUngetc (c);
			}
		}
	} while (c != '(' && c != ';' && c != EOF);

	if ( vStringLength (token->name) > 0 )
	{
		verbose ("Found function: %s\n", vStringValue (token->name));

		/* Create tag */
		createTag (token);

		/* Get port list from function */
		processPortList (c);
	}
}
Esempio n. 10
0
bool EglHwcomposerBackend::initRenderingContext()
{
    if (!initBufferConfigs()) {
        return false;
    }

    if (!createContext()) {
        return false;
    }

    m_nativeSurface = m_backend->createSurface();
    EGLSurface surface = eglCreateWindowSurface(eglDisplay(), config(), (EGLNativeWindowType)static_cast<ANativeWindow*>(m_nativeSurface), nullptr);
    if (surface == EGL_NO_SURFACE) {
        qCCritical(KWIN_HWCOMPOSER) << "Create surface failed";
        return false;
    }
    setSurface(surface);

    return makeContextCurrent();
}
Esempio n. 11
0
WglContext::WglContext(WglContext* shared, const ContextSettings& settings, unsigned int width, unsigned int height) :
m_window       (NULL),
m_deviceContext(NULL),
m_context      (NULL),
m_ownsWindow   (true)
{
    // The target of the context is a hidden window.
    // We can't create a memory DC (the resulting context wouldn't be compatible
    // with other contexts), and we don't add the extra complexity of P-Buffers;
    // we can still support them in the future if this solution is not good enough.

    // Create the hidden window
    m_window = CreateWindowA("STATIC", "", WS_POPUP | WS_DISABLED, 0, 0, width, height, NULL, NULL, GetModuleHandle(NULL), NULL);
    ShowWindow(m_window, SW_HIDE);
    m_deviceContext = GetDC(m_window);

    // Create the context
    if (m_deviceContext)
        createContext(shared, VideoMode::getDesktopMode().bitsPerPixel, settings);
}
Esempio n. 12
0
int main(int argc, char** argv)
{
  ini_sContext* cp;
  pwr_tStatus sts;

  set_valid_time();

  cp = createContext(argc, argv);

  ver_WriteVersionInfo("ProviewR Runtime Environment");

  if (cp->flags.b.restart)
  {
    sts = interactive(argc, argv, cp);
  }
  else if (cp->flags.b.stop)
  {
    sts = stop(cp);
  }
  else
  {
    // Now lets daemonize if asked to
    if (cp->flags.b.daemonize)
    {
      daemonize();
    }

    sts = start(cp);

    // Now lets create the pid file before starting our endless event loop
    if (cp->flags.b.daemonize)
    {
      create_pidfile();
    }

    sts = events(cp);
    errh_LogInfo(&cp->log, "Ich sterbe!!");
  }

  exit(sts);
}
Esempio n. 13
0
GlxContext::GlxContext(GlxContext* shared) :
m_display   (NULL),
m_window    (0),
m_context   (NULL),
m_pbuffer   (0),
m_ownsWindow(false)
{
    // Save the creation settings
    m_settings = ContextSettings();

    // Make sure that extensions are initialized if this is not the shared context
    // The shared context is the context used to initialize the extensions
    if (shared && shared->m_display)
        ensureExtensionsInit(shared->m_display, DefaultScreen(shared->m_display));

    // Create the rendering surface (window or pbuffer if supported)
    createSurface(shared, 1, 1, VideoMode::getDesktopMode().bitsPerPixel);

    // Create the context
    createContext(shared);
}
Esempio n. 14
0
GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, const WindowImpl* owner, unsigned int bitsPerPixel) :
m_display   (NULL),
m_window    (0),
m_context   (NULL),
m_pbuffer   (0),
m_ownsWindow(false)
{
    // Save the creation settings
    m_settings = settings;

    // Make sure that extensions are initialized if this is not the shared context
    // The shared context is the context used to initialize the extensions
    if (shared && shared->m_display)
        ensureExtensionsInit(shared->m_display, DefaultScreen(shared->m_display));

    // Create the rendering surface from the owner window
    createSurface(static_cast< ::Window>(owner->getSystemHandle()));

    // Create the context
    createContext(shared);
}
Esempio n. 15
0
GlContext::GlContext()
:
m_window(NULL),
m_deviceContext(NULL),
m_context(NULL),
m_ownsWindow(true)
{
	m_window = CreateWindowA("STATIC", "", WS_POPUP | WS_DISABLED, 0, 0, 1, 1, NULL, NULL, GetModuleHandle(NULL), NULL);
	ShowWindow(m_window, SW_HIDE);
	m_deviceContext = GetDC(m_window);

	if (m_deviceContext)
	{
		createContext(VideoMode::getDesktopMode().bitsPerPixel, ContextSettings());
	}

	makeCurrent();

	//now that we have a dummy context we can initialize glew
	initGlew();
}
Esempio n. 16
0
int _glfwCreateContext(_GLFWwindow* window,
                       const _GLFWwndconfig* wndconfig,
                       const _GLFWfbconfig* fbconfig)
{
    _GLFWfbconfig closest;

    window->WGL.DC = GetDC(window->Win32.handle);
    if (!window->WGL.DC)
    {
        _glfwSetError(GLFW_PLATFORM_ERROR,
                      "Win32: Failed to retrieve DC for window");
        return GL_FALSE;
    }

    // Choose the best available fbconfig
    {
        unsigned int fbcount;
        _GLFWfbconfig* fbconfigs;
        const _GLFWfbconfig* result;

        fbconfigs = getFBConfigs(window, &fbcount);
        if (!fbconfigs)
            return GL_FALSE;

        result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount);
        if (!result)
        {
            _glfwSetError(GLFW_FORMAT_UNAVAILABLE,
                          "Win32/WGL: No pixel format matched the criteria");

            free(fbconfigs);
            return GL_FALSE;
        }

        closest = *result;
        free(fbconfigs);
    }

    return createContext(window, wndconfig, (int) closest.platformID);
}
Esempio n. 17
0
GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, unsigned int width, unsigned int height) :
m_window    (0),
m_context   (NULL),
m_ownsWindow(true)
{
    // Open a connection with the X server
    m_display = OpenDisplay();

    // Create the hidden window
    int screen = DefaultScreen(m_display);
    m_window = XCreateWindow(m_display,
                             RootWindow(m_display, screen),
                             0, 0,
                             width, height,
                             0,
                             DefaultDepth(m_display, screen),
                             InputOutput,
                             DefaultVisual(m_display, screen),
                             0, NULL);

    // Create the context
    createContext(shared, VideoMode::getDesktopMode().bitsPerPixel, settings);
}
Esempio n. 18
0
void Window::windowed()
{
    if (FullScreenMode != m_mode)
        return;

    int w = m_windowedModeSize.x;
    int h = m_windowedModeSize.y;

    ContextFormat format = m_context->format();

    finalizeEventHandler();
    WindowEventDispatcher::deregisterWindow(this);
    destroyContext();


    if (createContext(format, w, h, nullptr))
    {
        WindowEventDispatcher::registerWindow(this);
        initializeEventHandler();

        m_mode = WindowMode;
    }
}
Esempio n. 19
0
GlxContext::GlxContext(GlxContext* shared) :
m_window    (0),
m_context   (NULL),
m_ownsWindow(true)
{
    // Open a connection with the X server
    m_display = OpenDisplay();

    // Create a dummy window (disabled and hidden)
    int screen = DefaultScreen(m_display);
    m_window = XCreateWindow(m_display,
                             RootWindow(m_display, screen),
                             0, 0,
                             1, 1,
                             0,
                             DefaultDepth(m_display, screen),
                             InputOutput,
                             DefaultVisual(m_display, screen),
                             0, NULL);

    // Create the context
    createContext(shared, VideoMode::getDesktopMode().bitsPerPixel, ContextSettings());
}
Esempio n. 20
0
int main (int argc, char **argv)
{
  ini_sContext *cp;
  pwr_tStatus sts;

  set_valid_time();

  cp = createContext(argc, argv);

  ver_WriteVersionInfo("Proview Runtime Environment");

  if (cp->flags.b.restart) {
    sts = interactive(argc, argv, cp);
  } else if (cp->flags.b.stop) {
    sts = stop(argc, argv, cp);
  } else {
    sts = start(cp);
    sts = events(cp);
    errh_LogInfo(&cp->log, "Ich sterbe!!");
  }

  exit(sts);
}
Esempio n. 21
0
GlContext::GlContext(ContextSettings& settings, GlContext* share) :
	_window(0),
	_ownWindow(true),
	_context(0),
	_active(false) {

	_display = XOpenDisplay(0);

	// create a dummy window to associate this context with
	int screen = DefaultScreen(_display);
	_window = XCreateWindow(
			_display,
			RootWindow(_display, screen),
			0, 0, 1, 1,
			0,
			DefaultDepth(_display, screen),
			InputOutput,
			DefaultVisual(_display, screen),
			0, NULL);

	// initialize the context
	createContext(settings, share);
}
void HeadlessView::activate() {
    active = true;

    if (!glContext) {
        if (!display) {
            throw std::runtime_error("Display is not set");
        }
        createContext();
    }

    activateContext();

    if (!extensionsLoaded) {
        gl::InitializeExtensions(initializeExtension);
        extensionsLoaded = true;
    }

    if (needsResize) {
        clearBuffers();
        resizeFramebuffer();
        needsResize = false;
    }
}
Esempio n. 23
0
//------------------------------------------------------------------------------
GLContextImpl::GLContextImpl(GLContext & context, GLContextSettings & settings, GLContextImpl * sharedContext) :
	r_context(context),
    m_hrc(nullptr),
    m_dc(nullptr),
    m_ownHwnd(nullptr)
{
    // Get the HWND from either the passed window or an internal one
    HWND hwnd = nullptr;
	const Window * win = r_context.getWindow();
    if (win)
    {
        // A window was given, go with it
    	hwnd = (HWND)win->getHandle();
    }
    else
    {
        // No window was given...
        // On Windows, we still have to create a dummy window to get a valid DC
        m_ownHwnd = ::CreateWindow("STATIC", "", WS_POPUP | WS_DISABLED, 0, 0, 1, 1, NULL, NULL, GetModuleHandle(NULL), NULL);
        ShowWindow(m_ownHwnd, SW_HIDE);
        hwnd = m_ownHwnd;
    }

	m_dc = GetDC(hwnd);

	if (m_dc)
	{
        GLContextSettings initialSettings = settings;
		createContext(sharedContext ? sharedContext->m_hrc : nullptr, settings, hwnd);
		if (settings != initialSettings)
		{
			SN_WARNING("ContextSettings have been changed for compatibility.");
			SN_LOG("Requested: " << r_context.getSettings().toString());
			SN_LOG("Changed to: " << settings.toString());
		}
	}
}
/**
 * \brief Sends a notification to Growl.
 *
 * \param name the registered name of the notification.
 * \param title the title for the notification.
 * \param description the description of the notification.
 * \param icon the icon of the notification.
 * \param sticky whether the notification should be sticky (i.e. require a 
 *	click to discard.
 * \param receiver the receiving object which will be signaled when the
 *	notification is clicked. May be NULL.
 * \param slot the slot to be signaled when the notification is clicked.
 * \param context the context which will be passed back to the slot
 *	May be NULL.
 */
void GrowlNotifier::notify(const QString& name, const QString& title, 
	const QString& description, const QPixmap& p, bool sticky, 
	const QObject* receiver, 
	const char* clicked_slot, const char* timeout_slot, 
	void* qcontext)
{
	// Convert the image if necessary
	CFDataRef icon = 0;
	if (!p.isNull()) {
		QByteArray img_data;
		QBuffer buffer(&img_data);
		buffer.open(QIODevice::WriteOnly);
		p.save(&buffer, "PNG");
		icon = CFDataCreate( NULL, (UInt8*) img_data.data(), img_data.size());
	}

	// Convert strings
	CFStringRef cf_title = qString2CFString(title);
	CFStringRef cf_description = qString2CFString(description);
	CFStringRef cf_name = qString2CFString(name);

	// Do notification
	CFPropertyListRef context = createContext(signaler_, receiver, clicked_slot, timeout_slot, qcontext/*, getpid()*/);
	Growl_NotifyWithTitleDescriptionNameIconPriorityStickyClickContext(
		cf_title, cf_description, cf_name, icon, 0, sticky, context);
	
	// Release intermediary datastructures
	CFRelease(context);
	if (icon) 
		CFRelease(icon);
	if (cf_title) 
		CFRelease(cf_title);
	if (cf_description) 
		CFRelease(cf_description);
	if (cf_name) 
		CFRelease(cf_name);
}
Esempio n. 25
0
GlxContext::GlxContext(GlxContext* shared) :
m_window    (0),
m_context   (NULL),
m_ownsWindow(true)
{
    // Open a connection with the X server
    m_display = OpenDisplay();
    m_connection = XGetXCBConnection(m_display);
    xcb_screen_t* screen = XCBScreenOfDisplay(m_connection, DefaultScreen(m_display));

    // Choose the visual according to the context settings
    XVisualInfo visualInfo = selectBestVisual(m_display, VideoMode::getDesktopMode().bitsPerPixel, ContextSettings());

    // Define the window attributes
    xcb_colormap_t colormap = xcb_generate_id(m_connection);
    xcb_create_colormap(m_connection, XCB_COLORMAP_ALLOC_NONE, colormap, screen->root, visualInfo.visualid);
    const uint32_t value_list[] = {colormap};

    // Create a dummy window (disabled and hidden)
    m_window = xcb_generate_id(m_connection);
    xcb_create_window(
        m_connection,
        static_cast<uint8_t>(visualInfo.depth),
        m_window,
        screen->root,
        0, 0,
        1, 1,
        0,
        XCB_WINDOW_CLASS_INPUT_OUTPUT,
        visualInfo.visualid,
        XCB_CW_COLORMAP,
        value_list
    );

    // Create the context
    createContext(shared, VideoMode::getDesktopMode().bitsPerPixel, ContextSettings());
}
int thread_create(thread_t*t,void*(*func)(void *),void*arg){
#ifdef O_PREEMPTION
  interruptsOff();
#endif
  //si le main n'est pas un thread, il le devient sinon
  if(MAIN_IS_THREAD == FALSE && mainBecomesThread()==-1)
    return -1;

  //on cree le context du thread
  ucontext_t *uc = createContext((void (*) (void))func,arg);
  if(uc == NULL)
    return -1;

  //on cree le thread
  *t = getNextTID();
  thread *newth = newThread(*t, STATUS_READY, uc);

  //on met à jour la rélation thread pere et thread fils
  thread* pere = getRunningThread();
  pere->is_father = TRUE;
  newth->father = pere;
  newth->context->uc_link = pere->context;
  addInFifo(pere);

#ifdef O_PRIORITE
  updatePriority(pere);
#endif  

  //on lance le nouveau thread cree
  setRunningThread(newth);

#ifdef O_PREEMPTION
  interruptsOn();
#endif
  swapcontext(pere->context, newth->context);
  return 0;
}
Esempio n. 27
0
int _glfwCreateContext(_GLFWwindow* window,
                       const _GLFWwndconfig* wndconfig,
                       const _GLFWfbconfig* fbconfig)
{
    _GLFWfbconfig closest;

    // Choose the best available fbconfig
    {
        unsigned int fbcount;
        _GLFWfbconfig* fbconfigs;
        const _GLFWfbconfig* result;

        fbconfigs = getFBConfigs(window, wndconfig, &fbcount);
        if (!fbconfigs)
        {
            _glfwInputError(GLFW_PLATFORM_ERROR,
                            "EGL: No usable EGLFBConfigs found");
            return GL_FALSE;
        }

        result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount);
        if (!result)
        {
            _glfwInputError(GLFW_PLATFORM_ERROR,
                            "EGL: No EGLFBConfig matched the criteria");

            free(fbconfigs);
            return GL_FALSE;
        }

        closest = *result;
        free(fbconfigs);
    }

    return createContext(window, wndconfig, closest.platformID);
}
Esempio n. 28
0
bool CCRenderer::setup()
{
    viewportX = viewportY = viewportWidth = viewportHeight = 0.0f;
    scissorX = scissorY = scissorWidth = scissorHeight = 0.0f;

    usingOpenGL2 = true;
	renderFlags = render_all;
    if( !createContext() || !loadShaders() )
    {
        return false;
    }
    DEBUG_OPENGL();

    // All current iPhoneOS devices support BGRA via an extension.
    BGRASupport = CCTextureBase::ExtensionSupported( "GL_IMG_texture_format_BGRA8888" );

    frameBufferManager.setup();
    DEBUG_OPENGL();

    // Screen dimensions
    setupScreenSizeParams();

    return true;
}
//----------------------------------------------------------------------------//
OpenGLGLXPBTextureTarget::OpenGLGLXPBTextureTarget(OpenGLRenderer& owner) :
    OpenGLTextureTarget(owner),
    d_pbuffer(0)
{
    if (!GLXEW_VERSION_1_3)
        throw InvalidRequestException("System does not support GLX >= 1.3 "
            "required by CEGUI pbuffer usage under GLX");

    d_dpy = glXGetCurrentDisplay();

    selectFBConfig();
    createContext();
    initialiseTexture();

    // set default size (and cause initialisation of the pbuffer)
    declareRenderSize(Size(DEFAULT_SIZE, DEFAULT_SIZE));

    // set some states as a one-time thing (because we use a separate context)
    enablePBuffer();

    glEnable(GL_SCISSOR_TEST);
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
    glDisableClientState(GL_INDEX_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);
    glDisableClientState(GL_FOG_COORDINATE_ARRAY);
    glDisableClientState(GL_EDGE_FLAG_ARRAY);
    glClearColor(0,0,0,0);

    disablePBuffer();
}
Esempio n. 30
0
void Sdl2Application::createContext() { createContext({}); }