A
download qtaddons_x11.cpp
Language: C++
Copyright: Copyright 2000 Keith Packard, member of The XFree86 Project, Inc.
LOC: 80
Project Info
FacturaLUX
Server: SourceForge
Type: cvs
...rototipo\src\qt\src\kernel\
   makepsheader.pl
   q1xcompatibility.h
   qabstractlayout.cpp
   qabstractlayout.h
   qaccel.cpp
   qaccel.h
   qaccessible.cpp
   qaccessible.h
   qapplication.cpp
   qapplication.h
   qapplication_p.h
   qapplication_x11.cpp
   qasyncimageio.cpp
   qasyncimageio.h
   qasyncio.cpp
   qasyncio.h
   qbitmap.cpp
   qbitmap.h
   qbrush.h
   qclipboard.cpp
   qclipboard.h
   qclipboard_x11.cpp
   qcolor.cpp
   qcolor.h
   qcolor_p.cpp
   qcolor_p.h
   qcolor_x11.cpp
   qcomplextext.cpp
   qcomplextext_p.h
   qconnection.cpp
   qconnection.h
   qcursor.cpp
   qcursor.h
   qcursor_x11.cpp
   qdesktopwidget.h
   qdesktopwidget_x11.cpp
   qdnd_x11.cpp
   qdragobject.cpp
   qdragobject.h
   qdrawutil.cpp
   qdrawutil.h
   qdropsite.cpp
   qdropsite.h
   qevent.cpp
   qevent.h
   qeventloop.cpp
   qeventloop.h
   qeventloop_p.h
   qeventloop_unix.cpp
   qeventloop_x11.cpp
   qfocusdata.cpp
   qfocusdata.h
   qfont.cpp
   qfont.h
   qfont_x11.cpp
   qfontdata_p.h
   qfontdatabase.cpp
   qfontdatabase.h
   qfontdatabase_x11.cpp
   qfontengine_p.h
   qfontengine_x11.cpp
   qfontinfo.h
   qfontmetrics.h
   qgif.h
   qgplugin.cpp
   qgplugin.h
   qguardedptr.cpp
   qguardedptr.h
   qiconset.cpp
   qiconset.h
   qimage.cpp
   qimage.h
   qimageformatinterface_p.h
   qimageformatplugin.cpp
   qimageformatplugin.h
   qinputcontext_p.h
   qinputcontext_x11.cpp
   qinternal.cpp
   qinternal_p.h
   qjpegio.cpp
   qjpegio.h
   qkeycode.h
   qkeysequence.cpp
   qkeysequence.h
   qlayout.cpp
   qlayout.h
   qlayoutengine.cpp
   qlayoutengine_p.h
   qlocalfs.cpp
   qlocalfs.h
   qlock.cpp
   qlock_p.h
   qmetaobject.cpp
   qmetaobject.h
   qmime.cpp
   qmime.h
   qmngio.cpp
   qmngio.h
   qmotifdnd_x11.cpp
   qmovie.cpp
   qmovie.h
   qnamespace.h
   qnetworkprotocol.cpp
   qnetworkprotocol.h
   qobject.cpp
   qobject.h
   qobjectcleanuphandler.cpp
   qobjectcleanuphandler.h
   qobjectdefs.h
   qobjectdict.h
   qobjectlist.h
   qpaintdevice.h
   qpaintdevice_x11.cpp
   qpaintdevicedefs.h
   qpaintdevicemetrics.cpp
   qpaintdevicemetrics.h
   qpainter.cpp
   qpainter.h
   qpainter_p.h
   qpainter_x11.cpp
   qpalette.cpp
   qpalette.h
   qpen.h
   qpicture.cpp
   qpicture.h
   qpixmap.cpp
   qpixmap.h
   qpixmap_x11.cpp
   qpixmapcache.cpp
   qpixmapcache.h
   qpngio.cpp
   qpngio.h
   qpoint.cpp
   qpoint.h
   qpointarray.cpp
   qpointarray.h
   qpolygonscanner.cpp
   qpolygonscanner.h
   qprinter.cpp
   qprinter.h
   qprinter_p.h
   qprinter_unix.cpp
   qprocess.cpp
   qprocess.h
   qprocess_unix.cpp
   qpsprinter.cpp
   qpsprinter.ps
   qpsprinter_p.h
   qrect.cpp
   qrect.h
   qregion.cpp
   qregion.h
   qregion_x11.cpp
   qrichtext.cpp
   qrichtext_p.cpp
   qrichtext_p.h
   qscriptengine.cpp
   qscriptengine_p.h
   qscriptengine_x11.cpp
   qsession.h
   qsessionmanager.h
   qsharedmemory_p.cpp
   qsharedmemory_p.h
   qsignal.cpp
   qsignal.h
   qsignalmapper.cpp
   qsignalmapper.h
   qsignalslotimp.h
   qsimplerichtext.cpp
   qsimplerichtext.h
   qsize.cpp
   qsize.h
   qsizegrip.cpp
   qsizegrip.h
   qsizepolicy.h
   qsocketnotifier.cpp
   qsocketnotifier.h
   qsound.cpp
   qsound.h
   qsound_x11.cpp
   qstyle.cpp
   qstyle.h
   qstylesheet.cpp
   qstylesheet.h
   qt.h
   qt_compat.pri
   qt_gfx.pri
   qt_kernel.pri
   qt_x11.pri
   qt_x11_p.h
   qtaddons_x11.cpp
   qtextengine.cpp
   qtextengine_p.h
   qtextengine_unix.cpp
   qtextlayout.cpp
   qtextlayout_p.h
   qthread.cpp
   qthread.h
   qthread_unix.cpp
   qtimer.cpp
   qtimer.h
   qtranslator.cpp
   qtranslator.h
   qucomextra.cpp
   qucomextra_p.h
   qurl.cpp
   qurl.h
   qurlinfo.cpp
   qurlinfo.h
   qurloperator.cpp
   qurloperator.h
   qvariant.cpp
   qvariant.h
   qvfbhdr.h
   qwidget.cpp
   qwidget.h
   qwidget_p.h
   qwidget_x11.cpp
   qwidgetcreate_x11.cpp
   qwidgetintdict.h
   qwidgetlist.h
   qwindow.cpp
   qwindow.h
   qwindowdefs.h
   qwmatrix.cpp
   qwmatrix.h

/*
 * $XFree86: xc/lib/Xft/xftname.c,v 1.10 2001/03/30 18:50:18 keithp Exp $
 *
 * Copyright  2000 Keith Packard, member of The XFree86 Project, Inc.
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of Keith Packard not be used in
 * advertising or publicity pertaining to distribution of the software without
 * specific, written prior permission.  Keith Packard makes no
 * representations about the suitability of this software for any purpose.  It
 * is provided "as is" without express or implied warranty.
 *
 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 */

#include "qt_x11_p.h"

#if !defined(QT_NO_XFTFREETYPE) && !defined(QT_XFT2)

#include <X11/Xft/Xft.h>

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

extern bool qt_use_xrender; // defined in qapplication_x11.cpp

extern "C" {

#define XFT_DRAW_N_SRC 2

struct _XftDraw {
    Display *dpy;
    Drawable drawable;
    Visual *visual;
    Colormap colormap;
    Region clip;
    Bool core_set;
    Bool render_set;
    Bool render_able;
    struct {
	Picture pict;
	struct {
	    Picture pict;
	    XRenderColor color;
	} src[XFT_DRAW_N_SRC];
    } render;
    struct {
	GC draw_gc;
	unsigned long fg;
	Font font;
    } core;
};

Picture XftDrawPicture( XftDraw *draw )
{
    if ( ! draw ) return 0;
    if ( ! draw->render_set ) {
	// force the RENDER Picture to be created...
	XftColor color;
	color.color.red = color.color.green = color.color.blue = color.color.alpha =
	    color.pixel = 0;
	XftDrawRect( draw, &color, -100, -100, 1, 1 );
    }
    return draw->render.pict;
}

XftDraw *XftDrawCreateAlpha( Display *display,
			     Pixmap pixmap,
			     int depth )
{
    // taken from Xft 1 sources, see copyright above
    XftDraw     *draw;

    draw = (XftDraw *) malloc (sizeof (XftDraw));
    if (!draw)
	return 0;
    draw->dpy = display;
    draw->drawable = pixmap;
    draw->visual = 0;
    draw->colormap = 0;
    draw->core_set = False;
    draw->clip = 0;

    // Qt addition - go ahead and create the render picture now
    draw->render_set = True;
    draw->render_able = False;

    if ( qt_use_xrender ) {
	draw->render_able = True;

	XRenderPictFormat *format = 0;
	XRenderPictFormat req;
	unsigned long mask = PictFormatType | PictFormatDepth | PictFormatAlphaMask;
	req.type = PictTypeDirect;
	req.depth = depth;
	req.direct.alphaMask = 0xff;
	format = XRenderFindFormat(draw->dpy, mask, &req, 0);
	if (format) {
	    draw->render.pict =
		XRenderCreatePicture(draw->dpy, draw->drawable, format, 0, 0);
	}

	// to keep Xft from trying to free zero pixmaps/pictures, we need to create
	// 2 more pictures (that are identical to draw->render.pict) :/
	draw->render.src[0].pict =
	    XRenderCreatePicture( draw->dpy, draw->drawable, format, 0, 0 );
	draw->render.src[1].pict =
	    XRenderCreatePicture( draw->dpy, draw->drawable, format, 0, 0 );
    }

    return draw;
}

}

#endif // !QT_NO_XFTFREETYPE && !QT_XFT2

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us