示例#1
0
QIcon IconFactory::getIcon(const QString &themeName, ushort id, const QColor &color,
                           const QColor &activeColor)
{
    // Icon from theme
    if ( (!m_loaded || useSystemIcons()) && !themeName.isEmpty() ) {
        QIcon icon = QIcon::fromTheme(themeName);
        if ( !icon.isNull() )
            return icon;
    }

    // Icon with different color than for QMenu
    if ( color != m_iconColor || activeColor != m_iconColorActive ) {
        QIcon icon( createPixmap(id, color) );
        if ( activeColor.isValid() )
            icon.addPixmap( createPixmap(id, activeColor), QIcon::Selected );
        return icon;
    }

    IconCache::iterator it = m_iconCache.find(id);
    if ( it == m_iconCache.end() ) {
        QIcon icon( createPixmap(id, m_iconColor) );
        if ( m_iconColorActive.isValid() ) {
            icon.addPixmap( createPixmap(id, m_iconColorActive), QIcon::Active );
            icon.addPixmap( createPixmap(id, m_iconColorActive), QIcon::Selected );
        }
        it = m_iconCache.insert(id, icon);
    }

    return *it;
}
示例#2
0
static Icon createIcon(bool isPlus)
{
    Icon icon;
    QColor stdColor=QColor(QApplication::palette().color(QPalette::Active, QPalette::ButtonText));
    QColor highlightColor=stdColor.red()<100 ? stdColor.lighter(50) : stdColor.darker(50);
    QList<int> sizes=QList<int>() << 16 << 22;

    foreach (int s, sizes) {
        icon.addPixmap(createPixmap(s, stdColor, 1.0, isPlus));
        icon.addPixmap(createPixmap(s, stdColor, 0.5, isPlus), QIcon::Disabled);
        icon.addPixmap(createPixmap(s, highlightColor, 1.0, isPlus), QIcon::Active);
    }
示例#3
0
    //______________________________________________
    const QVector<quint32>& ShadowHelper::createPixmapHandles( void )
    {

        /**
        shadow atom and property specification available at
        http://community.kde.org/KWin/Shadow
        */

        // create atom
        #if MENDA_HAVE_X11
        if( !_atom && Helper::isX11() ) _atom = _helper.createAtom( QLatin1String( netWMShadowAtomName ) );
        #endif

        shadowTiles();

        // make sure size is valid
        if( _pixmaps.empty() && _shadowTiles.isValid() )
        {

            _pixmaps.append( createPixmap( _shadowTiles.pixmap( 1 ) ) );
            _pixmaps.append( createPixmap( _shadowTiles.pixmap( 2 ) ) );
            _pixmaps.append( createPixmap( _shadowTiles.pixmap( 5 ) ) );
            _pixmaps.append( createPixmap( _shadowTiles.pixmap( 8 ) ) );
            _pixmaps.append( createPixmap( _shadowTiles.pixmap( 7 ) ) );
            _pixmaps.append( createPixmap( _shadowTiles.pixmap( 6 ) ) );
            _pixmaps.append( createPixmap( _shadowTiles.pixmap( 3 ) ) );
            _pixmaps.append( createPixmap( _shadowTiles.pixmap( 0 ) ) );

        }

        // return relevant list of pixmap handles
        return _pixmaps;

    }
void X11Helper::createPixmap(Pixmap* handleId, const EGLint id, bool hasAlpha, const IntSize& size)
{
    VisualID visualId = static_cast<VisualID>(id);

    if (!visualId)
        return;

    // EGL has suggested a visual id, so get the rest of the visual info for that id.
    XVisualInfo visualInfoTemplate;
    memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
    visualInfoTemplate.visualid = visualId;
    int matchingCount = 0;
    OwnPtrX11<XVisualInfo> matchingVisuals(XGetVisualInfo(nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount));
    XVisualInfo* foundVisual = 0;
    int requiredDepth = hasAlpha ? 32 : 24;

    if (matchingVisuals) {
        for (int i = 0; i< matchingCount; i++) {
            XVisualInfo* temp = &matchingVisuals[i];

            if (temp->visualid == visualId && temp->depth == requiredDepth) {
                foundVisual = temp;
                break;
            }
        }

        if (foundVisual)
            createPixmap(handleId, *foundVisual, size);
    }
}
示例#5
0
void
makePixmap(PluginInstance *This)
{
    createPixmap(This);
    drawPixmap(This);
    setCursor(This);
    addXtEventHandler(This);
}
示例#6
0
void Loader::Impl::startLoading()
{
	if (status_ != WaitingToLoad)
		return;

	if (cached_item_->tryDisplayFormat()) {
		status_ = Loaded;
		createPixmap();
		return;
	}

	LoaderQueue::get().touch(cached_item_);
}
示例#7
0
PageScreen::PageScreen(WebView* view, QWidget* parent)
    : QDialog(parent)
    , ui(new Ui::PageScreen)
    , m_view(view)
{
    setAttribute(Qt::WA_DeleteOnClose);
    ui->setupUi(this);

    createPixmap();
    ui->label->setPixmap(m_pagePixmap);

    connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
}
void KICList::createItems()
{
	QList<KBase*> ICList = ::g_ICMap.values();
	KBase* pIC;
	for(int i = 0; i < ICList.count(); ++i)
	{
		pIC = ICList[i];
		QPixmap pix = createPixmap(pIC);
		QListWidgetItem* item = new QListWidgetItem(
			QIcon(pix), pIC->name());
		item->setToolTip(pIC->description());
		addItem(item);
	}
}
示例#9
0
int main() {
    EGLContextType *context = NULL;
    // X display and window
    Display * x11Display = XOpenDisplay(NULL);
    CHECK_HANDLE_RET(x11Display, NULL, "XOpenDisplay", -1);
    Window x11RootWindow = DefaultRootWindow(x11Display);

    // may remove the attrib
    XSetWindowAttributes x11WindowAttrib;
    x11WindowAttrib.event_mask = ExposureMask | KeyPressMask;

    // create with video size, simplify it
    Window x11Window = XCreateWindow(x11Display, x11RootWindow,
        0, 0, 800, 600, 0, CopyFromParent, InputOutput,
        CopyFromParent, CWEventMask, &x11WindowAttrib);
    XMapWindow(x11Display, x11Window);
    XSync(x11Display, 0);

    context = eglInit(x11Display, x11Window, 0, 0);
    // GLuint textureId = createTestTexture();
    XID pixmap = createPixmap(x11Display, x11Window);
    GLuint textureId = createTextureFromPixmap(context, pixmap);
    drawTextures(context, &textureId, 1);

    EGLBoolean running = EGL_TRUE;
    while (running) {
        XEvent x_event;
        XNextEvent(x11Display, &x_event);
        switch (x_event.type) {
        case Expose:
            glClear(GL_COLOR_BUFFER_BIT
                | GL_DEPTH_BUFFER_BIT
            );
            drawTextures(context, &textureId, 1);
            break;
        case KeyPress:
            running = EGL_FALSE;
            break;
        default:
            break;
        }
    }

    XUnmapWindow(x11Display, x11Window);
    XDestroyWindow(x11Display, x11Window);
    XCloseDisplay(x11Display);
    INFO("exit successfully");
    return 0;
}
void KICList::performDrag()
{
	QListWidgetItem* item = currentItem();
	if (item)
	{
		QMimeData* mimeData = new QMimeData;
		mimeData->setText(item->text());

		QPixmap pix = createPixmap(::g_ICMap[item->text()]);

		QDrag* drag = new QDrag(this);
		drag->setMimeData(mimeData);
		drag->setPixmap(pix);
		drag->setHotSpot(QPoint(pix.width() / 2, pix.height() / 2));
		drag->exec(Qt::MoveAction);
	}
}
TestThemeDaemonServerThread::TestThemeDaemonServerThread(const QString &serverAddress,
                                                         QObject *parent) :
    QThread(parent),
    m_serverAddress(serverAddress),
    m_pixmapCache()
{
    // Creating of QPixmaps may only get done in the context of the GUI thread. The
    // pixmaps are forwarded in TestThemeDaemonServerThread::run() to the
    // themedaemon server.
    createPixmap("test_pixmap_1");
    createPixmap("test_pixmap_2");
    createPixmap("test_pixmap_2", QSize(100, 100));
    createPixmap("test_pixmap_3");
    createPixmap("most_used_pixmap_1");
    createPixmap("most_used_pixmap_2");
    createPixmap("most_used_pixmap_3");
}
示例#12
0
void CScreenShotView::onFinishTimerOut()
{
    QPointF startPos = m_selectRectItem->getSelectRect().topLeft();
    QPointF endPos = m_selectRectItem->getSelectRect().bottomRight();
    //    QRect rect = getPositiveRect(startPos,endPos).toRect();
    QRect rect = CScreenshotUtil::convertLineFToRectF(QLineF(startPos,endPos)).toRect();
    if(rect.width() >= 1 && rect.height() >= 1)
    {
        m_isValid = true;
        m_pixmap = createPixmap(rect);
        QClipboard *clipboard = QApplication::clipboard();
        clipboard->setPixmap(m_pixmap);
    }
    else
    {
        m_isValid = false;
    }
    C_SCREENSHOT_LOG_INFO(QString("shot is %1valid,pixmap is %2null")
                           .arg(m_isValid?"":"not")
                           .arg(m_pixmap.isNull()?"":"not "));
    setShotStatus(CSCREEN_SHOT_STATE_FINISHED);
}
void MakeCurrentPerfCase::createSurfaces (void)
{
	vector<SurfaceType> types;

	if ((m_spec.surfaceTypes & SURFACETYPE_WINDOW) != 0)
		types.push_back(SURFACETYPE_WINDOW);

	if ((m_spec.surfaceTypes & SURFACETYPE_PIXMAP) != 0)
		types.push_back(SURFACETYPE_PIXMAP);

	if ((m_spec.surfaceTypes & SURFACETYPE_PBUFFER) != 0)
		types.push_back(SURFACETYPE_PBUFFER);

	DE_ASSERT((int)types.size() <= m_spec.surfaceCount);

	// Create surfaces
	for (int surfaceNdx = 0; surfaceNdx < m_spec.surfaceCount; surfaceNdx++)
	{
		SurfaceType type = types[surfaceNdx % types.size()];

		switch (type)
		{
			case SURFACETYPE_PBUFFER:
				createPBuffer();
				break;

			case SURFACETYPE_WINDOW:
				createWindow();
				break;

			case SURFACETYPE_PIXMAP:
				createPixmap();
				break;

			default:
				DE_ASSERT(false);
		};
	}
}
示例#14
0
文件: bigrams.c 项目: SGjorge/SOT1516
int
main(int argc, char *argv[])
{
	int i;
	DataTh *dt;
	pthread_t thr[maxArgs];
	void *sts[maxArgs];
	int posPix;

	posPix = posMap;
	i = 0;
	dt = malloc(sizeof(DataTh));

	checkArgs(argc,argv);
	if(strcmp(argv[1],"-p") == 0){
		printPixmap(argv[posPix+1]);
		exit(EXIT_SUCCESS);
	}

	(*dt).map = malloc(strlen(argv[posPix]));
	strcpy((*dt).map,argv[posPix]);
	fprintf(stdout, "-------------------- bigrams ---------------------\n");
	createPixmap(argv[posPix],asciiRange*asciiRange);
	for(i=posPix+1; i < argc; i++){
		pthread_mutex_lock(&dt->lock);
		(*dt).file = malloc(strlen(argv[i]));
		strcpy((*dt).file,argv[i]);
		if(pthread_create(thr+i, NULL, tPF, dt) != 0) {
			err(1, "thread");
		}
	}
	for(i = posPix+1; i < argc; i++) {
		pthread_join(thr[i], sts+i);
		free(sts[i]);
	}

	exit(EXIT_SUCCESS);
}
示例#15
0
void ThumbView::slNewFileItems( const KFileItemList& items )
{
   kdDebug(28000) << "Creating thumbnails for fileItemList" << endl;

   /* Fill the pending jobs list. */
   KFileItemListIterator it( items );
   KFileItem *item = 0;
   for ( ; (item = it.current()); ++it )
   {
      QString filename = item->url().prettyURL();
      if( item->isDir() )
      {
	 /* create a dir pixmap */
      }
      else
      {
	 QPixmap p(m_basePix) ;
	 QPixmap mime( item->pixmap(0) );

	 if( p.width() > mime.width() && p.height() > mime.height() )
	 {
	    QPainter paint( &p );
	    paint.drawPixmap( (p.width()-mime.width())/2,
			      (p.height()-mime.height())/2,
			      mime );
	    paint.flush();
	 }

	 /* Create a new empty preview pixmap and store the pointer to it */
	 ThumbViewItem *newIconViewIt = new ThumbViewItem( m_iconView,
							   item->url().filename(),
							   createPixmap( p ),
							   item );

	 newIconViewIt->setItemUrl( item->url() );

	 /* tell the file item about the iconView-representation */
	 item->setExtraData( this, newIconViewIt );

	 m_pendingJobs.append( item );
      }
   }

   /*
     From a mail from Waldo Bastian pointing out problems with thumbview:

     2) I think you may end up creating two PreviewJob's in parallel
        when the slNewFileItems() function is called two times in
        quick succession. The current code doesn't seem to expect
        that, given the comment in slPreviewResult(). In the light of
        1) it might become fatal since you will not be able to call
        PreviewJob::removeItem on the proper job. I suggest to queue
        new items when a job is already running and start a new job
        once the first one is finished when there are any items left
        in the queue. Don't forget to delete items from the queue if
        they get deleted in the mean time.

        The strategy is as follows: In the global list m_pendingJobs
        the jobs to start are appended. Only if m_job is zero (no job
        is running) a job is started on the current m_pendingJobs list.
        The m_pendingJobs list is clear afterwords.
   */

   if( ! m_job && m_pendingJobs.count() > 0 )
   {
      /* Progress-Bar */
      m_progress->show();
      m_progress->setTotalSteps(m_pendingJobs.count());
      m_cntJobsStarted = 0;

      /* start a preview-job */
      m_job = KIO::filePreview(m_pendingJobs, m_pixWidth, m_pixHeight );

      if( m_job )
      {
	 connect( m_job, SIGNAL( result( KIO::Job * )),
		  this, SLOT( slPreviewResult( KIO::Job * )));
	 connect( m_job, SIGNAL( gotPreview( const KFileItem*, const QPixmap& )),
		  SLOT( slGotPreview( const KFileItem*, const QPixmap& ) ));

         m_pendingJobs.clear();

         /* KIO::Jo result is called in any way: Success, Failed, Error,
	  * thus connecting the failed is not really necessary.
	  */
        // connect( job, SIGNAL( failed( const KFileItem* )),
        //          this, SLOT( slotFailed( const KFileItem* ) ));

      }
   }
示例#16
0
文件: gapi.cpp 项目: bigbensk/gpac
GF_Err GAPI_SetupOGL_ES(GF_VideoOutput *dr) 
{
	EGLint n, maj, min;
	u32 i;
	GF_Event evt;
	GAPICTX(dr)
	static int atts[32];
	const char *opt;

	i=0;
	atts[i++] = EGL_RED_SIZE; atts[i++] = (gctx->pixel_format==GF_PIXEL_RGB_24) ? 8 : 5;
	atts[i++] = EGL_GREEN_SIZE; atts[i++] = (gctx->pixel_format==GF_PIXEL_RGB_24) ? 8 : (gctx->pixel_format==GF_PIXEL_RGB_565) ? 6 : 5;
	atts[i++] = EGL_BLUE_SIZE; atts[i++] = (gctx->pixel_format==GF_PIXEL_RGB_24) ? 8 : 5;
	opt = gf_modules_get_option((GF_BaseInterface *)dr, "Video", "GLNbBitsDepth");
	atts[i++] = EGL_DEPTH_SIZE; atts[i++] = opt ? atoi(opt) : 16;
	atts[i++] = EGL_SURFACE_TYPE; 

#ifdef GLES_NO_PIXMAP
	atts[i++] = EGL_WINDOW_BIT;
#else
	atts[i++] = EGL_PIXMAP_BIT;
//	atts[i++] = gctx->fullscreen ? EGL_WINDOW_BIT : EGL_PIXMAP_BIT;
#endif
	atts[i++] = EGL_ALPHA_SIZE; atts[i++] = EGL_DONT_CARE;
	atts[i++] = EGL_STENCIL_SIZE; atts[i++] = EGL_DONT_CARE;
	atts[i++] = EGL_NONE;

	/*whenever window is resized we must reinit OGL-ES*/
	GAPI_ReleaseOGL_ES(gctx, 0);

	if (!gctx->fullscreen) {
		RECT rc;
		::GetClientRect(gctx->hWnd, &rc);
		gctx->bb_width = rc.right-rc.left;
		gctx->bb_height = rc.bottom-rc.top;

#ifndef GLES_NO_PIXMAP
		createPixmap(gctx, 1);
#endif
	}

	gctx->egldpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
	if (!gctx->egldpy) {
		GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[GAPI] Cannot get OpenGL display\n"));
		return GF_IO_ERR;
	}
	if (!eglInitialize(gctx->egldpy, &maj, &min)) {
		gctx->egldpy = NULL;
		GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[GAPI] Cannot initialize OpenGL layer\n"));
		return GF_IO_ERR;
	}

	if (!eglChooseConfig(gctx->egldpy, atts, &gctx->eglconfig, 1, &n) || (eglGetError() != EGL_SUCCESS)) {
		GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[GAPI] Cannot choose OpenGL config\n"));
		return GF_IO_ERR;
	}

	if (gctx->fullscreen
#ifdef GLES_NO_PIXMAP
		|| 1
#endif
		) {
		gctx->surface = eglCreateWindowSurface(gctx->egldpy, gctx->eglconfig, gctx->hWnd, 0);
	} else {
		gctx->surface = eglCreatePixmapSurface(gctx->egldpy, gctx->eglconfig, gctx->bitmap, 0);
	}

	if (!gctx->surface) {
		GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[GAPI] Cannot create OpenGL surface - error %d\n", eglGetError()));
		return GF_IO_ERR; 
	}
	gctx->eglctx = eglCreateContext(gctx->egldpy, gctx->eglconfig, NULL, NULL);
	if (!gctx->eglctx) {
		GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[GAPI] Cannot create OpenGL context\n"));
		eglDestroySurface(gctx->egldpy, gctx->surface);
		gctx->surface = 0L;
		return GF_IO_ERR; 
	}
    if (!eglMakeCurrent(gctx->egldpy, gctx->surface, gctx->surface, gctx->eglctx)) {
		GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("[GAPI] Cannot bind OpenGL context\n"));
		eglDestroyContext(gctx->egldpy, gctx->eglctx);
		gctx->eglctx = 0L;
		eglDestroySurface(gctx->egldpy, gctx->surface);
		gctx->surface = 0L;
		return GF_IO_ERR;
	}
	GF_LOG(GF_LOG_DEBUG, GF_LOG_MMIO, ("[GAPI] OpenGL initialize - %d x %d \n", gctx->bb_width, gctx->bb_height));
	memset(&evt, 0, sizeof(GF_Event));
	evt.type = GF_EVENT_VIDEO_SETUP;
	dr->on_event(dr->evt_cbk_hdl, &evt);	
	return GF_OK;
}
示例#17
0
文件: gapi.cpp 项目: bigbensk/gpac
static GF_Err GAPI_InitBackBuffer(GF_VideoOutput *dr, u32 VideoWidth, u32 VideoHeight)
{
	u32 gx_mode;
	GAPICTX(dr);

	if (!gctx || !VideoWidth || !VideoHeight) return GF_BAD_PARAM;

	gf_mx_p(gctx->mx);

	GAPI_ReleaseObjects(gctx);

	/*flip W&H in landscape mode*/
	if (landscape) {
		u32 t = VideoWidth;
		VideoWidth = VideoHeight;
		VideoHeight = t;
	}

	RECT rc;
	GetWindowRect(gctx->hWnd, &rc);
	gctx->off_x = rc.left;
	gctx->off_y = rc.top;
	gctx->erase_dest = 1;

	const char *opt = gf_modules_get_option((GF_BaseInterface *)dr, "GAPI", "FBAccess");
	if (!opt || !strcmp(opt, "raw")) gx_mode = 2;
	else if (opt && !strcmp(opt, "gx")) gx_mode = 1;
	else gx_mode = 0;

	if ((gx_mode != gctx->gx_mode) || !gctx->screen_w) {
		struct GXDisplayProperties gx = GXGetDisplayProperties();

		gctx->x_pitch = gx.cbxPitch;
		gctx->y_pitch = gx.cbyPitch;

		gctx->gx_mode = gx_mode;
		if (gctx->gx_mode==2) {
			if (gapi_get_raw_fb(dr) == GF_EOS) {
				gf_mx_v(gctx->mx);
				return GF_OK;
			}
		} else if (check_resolution_switch(dr, gx.cxWidth, gx.cyHeight)) {
			gf_mx_v(gctx->mx);
			return GF_OK;
		}
	}
	if (gctx->gx_mode==2) {
		GF_Err e = gapi_get_raw_fb(dr);
		if (e) {
			gf_mx_v(gctx->mx);
			if (e==GF_EOS) return GF_OK;
			else return e;
		}
	}


	gctx->bb_size = VideoWidth * VideoHeight * gctx->BPP;
	gctx->bb_width = VideoWidth;
	gctx->bb_height = VideoHeight;
	gctx->bb_pitch = VideoWidth * gctx->BPP;


	if (gctx->gx_mode) {
		gctx->backbuffer = (char *) gf_malloc(sizeof(unsigned char) * gctx->bb_size);

		gctx->contiguous_mem = ((gctx->x_pitch==gctx->BPP) && (gctx->y_pitch==gctx->screen_w*gctx->BPP)) ? 1 : 0;
	} else {
		createPixmap(gctx, 0);
	}

	gf_mx_v(gctx->mx);
	return GF_OK;
}
    //______________________________________________
    void ShadowHelper::createPixmapHandles( void )
    {

        #if OXYGEN_DEBUG
        std::cerr << "Oxygen::ShadowHelper::createPixmapHandles" << std::endl;
        #endif

        #ifdef GDK_WINDOWING_X11
        // create atom
        if( !_atom )
        {

            // get screen and check
            GdkScreen* screen = gdk_screen_get_default();
            if( !screen )
            {

                #if OXYGEN_DEBUG
                std::cerr << "ShadowHelper::createPixmapHandles - screen is NULL" << std::endl;
                #endif

                return;
            }

            // get display and check
            Display* display( GDK_DISPLAY_XDISPLAY( gdk_screen_get_display( screen ) ) );
            if( !display )
            {

                #if OXYGEN_DEBUG
                std::cerr << "ShadowHelper::createPixmapHandles - display is NULL" << std::endl;
                #endif

                return;
            }

           _atom = XInternAtom( display, "_KDE_NET_WM_SHADOW", False);
        }

        // make sure size is valid
        if( _size <= 0 ) return;

        // opacity
        const int shadowOpacity = 150;

        if( _roundPixmaps.empty() || _squarePixmaps.empty() )
        {
            // get screen, display, visual and check
            // no need to check screen and display, since was already done for ATOM
            GdkScreen* screen = gdk_screen_get_default();
            if( !gdk_screen_get_rgba_visual( screen ) )
            {

                #if OXYGEN_DEBUG
                std::cerr << "ShadowHelper::createPixmapHandles - no valid RGBA visual found." << std::endl;
                #endif

                return;

            }
        }

        // make sure pixmaps are not already initialized
        if( _roundPixmaps.empty() )
        {

            _roundPixmaps.push_back( createPixmap( _roundTiles.surface( 1 ), shadowOpacity ) );
            _roundPixmaps.push_back( createPixmap( _roundTiles.surface( 2 ), shadowOpacity ) );
            _roundPixmaps.push_back( createPixmap( _roundTiles.surface( 5 ), shadowOpacity ) );
            _roundPixmaps.push_back( createPixmap( _roundTiles.surface( 8 ), shadowOpacity ) );
            _roundPixmaps.push_back( createPixmap( _roundTiles.surface( 7 ), shadowOpacity ) );
            _roundPixmaps.push_back( createPixmap( _roundTiles.surface( 6 ), shadowOpacity ) );
            _roundPixmaps.push_back( createPixmap( _roundTiles.surface( 3 ), shadowOpacity ) );
            _roundPixmaps.push_back( createPixmap( _roundTiles.surface( 0 ), shadowOpacity ) );

        }

        if( _squarePixmaps.empty() )
        {

            _squarePixmaps.push_back( createPixmap( _squareTiles.surface( 1 ), shadowOpacity ) );
            _squarePixmaps.push_back( createPixmap( _squareTiles.surface( 2 ), shadowOpacity ) );
            _squarePixmaps.push_back( createPixmap( _squareTiles.surface( 5 ), shadowOpacity ) );
            _squarePixmaps.push_back( createPixmap( _squareTiles.surface( 8 ), shadowOpacity ) );
            _squarePixmaps.push_back( createPixmap( _squareTiles.surface( 7 ), shadowOpacity ) );
            _squarePixmaps.push_back( createPixmap( _squareTiles.surface( 6 ), shadowOpacity ) );
            _squarePixmaps.push_back( createPixmap( _squareTiles.surface( 3 ), shadowOpacity ) );
            _squarePixmaps.push_back( createPixmap( _squareTiles.surface( 0 ), shadowOpacity ) );

        }

        #endif

    }
示例#19
0
文件: gapi.cpp 项目: bigbensk/gpac
GF_Err GAPI_SetupOGL_ES_Offscreen(GF_VideoOutput *dr, u32 width, u32 height) 
{
	int atts[15];
	const char *opt;
	EGLint n, maj, min;

	GAPICTX(dr)

	GAPI_ReleaseOGL_ES(gctx, 1);

	if (!gctx->use_pbuffer) {
		SetWindowPos(gctx->gl_hwnd, NULL, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE);
		createPixmap(gctx, 2);
	}

	gctx->egldpy = eglGetDisplay(/*gctx->dpy*/EGL_DEFAULT_DISPLAY);
	if (!eglInitialize(gctx->egldpy, &maj, &min)) {
		gctx->egldpy = NULL;
		return GF_IO_ERR;
	}
	atts[0] = EGL_RED_SIZE; atts[1] = 8;
	atts[2] = EGL_GREEN_SIZE; atts[3] = 8;
	atts[4] = EGL_BLUE_SIZE; atts[5] = 8;
	atts[6] = EGL_ALPHA_SIZE; atts[7] = (dr->hw_caps & GF_VIDEO_HW_OPENGL_OFFSCREEN_ALPHA) ? 8 : EGL_DONT_CARE;
	opt = gf_modules_get_option((GF_BaseInterface *)dr, "Video", "GLNbBitsDepth");
	atts[8] = EGL_DEPTH_SIZE; atts[9] = opt ? atoi(opt) : 16;

	atts[10] = EGL_STENCIL_SIZE; atts[11] = EGL_DONT_CARE;
	atts[12] = EGL_SURFACE_TYPE; atts[13] = gctx->use_pbuffer ? EGL_PBUFFER_BIT : EGL_PIXMAP_BIT;
	atts[14] = EGL_NONE;

	eglGetConfigs(gctx->egldpy, NULL, 0, &n);
	if (!eglChooseConfig(gctx->egldpy, atts, &gctx->eglconfig, 1, &n)) {
		return GF_IO_ERR;
	}

	if (!gctx->use_pbuffer) {
		gctx->surface = eglCreatePixmapSurface(gctx->egldpy, gctx->eglconfig, gctx->gl_bitmap, 0);
	} else {
		atts[0] = EGL_WIDTH; atts[1] = width;
		atts[2] = EGL_HEIGHT; atts[3] = height;
		atts[4] = EGL_NONE;

		gctx->surface = eglCreatePbufferSurface(gctx->egldpy, gctx->eglconfig, atts);
	}

	if (!gctx->surface) {
		return GF_IO_ERR; 
	}
	gctx->eglctx = eglCreateContext(gctx->egldpy, gctx->eglconfig, NULL, NULL);
	if (!gctx->eglctx) {
		eglDestroySurface(gctx->egldpy, gctx->surface);
		gctx->surface = 0L;
		return GF_IO_ERR; 
	}
    if (!eglMakeCurrent(gctx->egldpy, gctx->surface, gctx->surface, gctx->eglctx)) {
		eglDestroyContext(gctx->egldpy, gctx->eglctx);
		gctx->eglctx = 0L;
		eglDestroySurface(gctx->egldpy, gctx->surface);
		gctx->surface = 0L;
		return GF_IO_ERR;
	}
	return GF_OK;
}
示例#20
0
void Loader::Impl::statusChanged()
{
	status_ = cached_item_ ? cached_item_->status() : WaitingToLoad;
	createPixmap();
	signal_();
}
示例#21
0
    //______________________________________________
    const QVector<Qt::HANDLE>& ShadowHelper::createPixmapHandles( bool isDockWidget )
    {

        /*!
        shadow atom and property specification available at
        http://community.kde.org/KWin/Shadow
        */

        // create atom
        #ifdef Q_WS_X11
        if( !_atom ) _atom = XInternAtom( QX11Info::display(), netWMShadowAtomName, False);
        #endif

        // make sure size is valid
        if( _size <= 0 ) return _pixmaps;

        // make sure pixmaps are not already initialized
        if( isDockWidget )
        {
            // make sure pixmaps are not already initialized
            if( _dockPixmaps.empty() && _dockTiles.isValid() )
            {

                _dockPixmaps.push_back( createPixmap( _dockTiles.pixmap( 1 ) ) );
                _dockPixmaps.push_back( createPixmap( _dockTiles.pixmap( 2 ) ) );
                _dockPixmaps.push_back( createPixmap( _dockTiles.pixmap( 5 ) ) );
                _dockPixmaps.push_back( createPixmap( _dockTiles.pixmap( 8 ) ) );
                _dockPixmaps.push_back( createPixmap( _dockTiles.pixmap( 7 ) ) );
                _dockPixmaps.push_back( createPixmap( _dockTiles.pixmap( 6 ) ) );
                _dockPixmaps.push_back( createPixmap( _dockTiles.pixmap( 3 ) ) );
                _dockPixmaps.push_back( createPixmap( _dockTiles.pixmap( 0 ) ) );

            }

        } else if( _pixmaps.empty() && _tiles.isValid() ) {

            _pixmaps.push_back( createPixmap( _tiles.pixmap( 1 ) ) );
            _pixmaps.push_back( createPixmap( _tiles.pixmap( 2 ) ) );
            _pixmaps.push_back( createPixmap( _tiles.pixmap( 5 ) ) );
            _pixmaps.push_back( createPixmap( _tiles.pixmap( 8 ) ) );
            _pixmaps.push_back( createPixmap( _tiles.pixmap( 7 ) ) );
            _pixmaps.push_back( createPixmap( _tiles.pixmap( 6 ) ) );
            _pixmaps.push_back( createPixmap( _tiles.pixmap( 3 ) ) );
            _pixmaps.push_back( createPixmap( _tiles.pixmap( 0 ) ) );

        }

        // return relevant list of pixmap handles
        return isDockWidget ? _dockPixmaps:_pixmaps;

    }
NativePixmap* NativePixmapFactory::createPixmap (NativeDisplay* nativeDisplay, EGLDisplay display, EGLConfig config, const EGLAttrib* attribList, int width, int height) const
{
	DE_UNREF(display && config && attribList);
	return createPixmap(nativeDisplay, width, height);
}