2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
*
|
2004-12-04 01:43:13 +01:00
|
|
|
* Copyright © 2000 SuSE, Inc.
|
2003-11-14 17:48:57 +01:00
|
|
|
*
|
|
|
|
* 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 SuSE not be used in advertising or
|
|
|
|
* publicity pertaining to distribution of the software without specific,
|
|
|
|
* written prior permission. SuSE makes no representations about the
|
|
|
|
* suitability of this software for any purpose. It is provided "as is"
|
|
|
|
* without express or implied warranty.
|
|
|
|
*
|
|
|
|
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Author: Keith Packard, SuSE, Inc.
|
|
|
|
*/
|
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2009-10-14 23:20:44 +02:00
|
|
|
#include "xsha1.h"
|
2008-09-23 18:22:07 +02:00
|
|
|
|
2005-07-03 10:53:54 +02:00
|
|
|
#include "misc.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "scrnintstr.h"
|
2005-07-03 10:53:54 +02:00
|
|
|
#include "os.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "regionstr.h"
|
|
|
|
#include "validate.h"
|
|
|
|
#include "windowstr.h"
|
|
|
|
#include "input.h"
|
|
|
|
#include "resource.h"
|
|
|
|
#include "colormapst.h"
|
|
|
|
#include "cursorstr.h"
|
|
|
|
#include "dixstruct.h"
|
|
|
|
#include "gcstruct.h"
|
|
|
|
#include "servermd.h"
|
|
|
|
#include "picturestr.h"
|
|
|
|
#include "glyphstr.h"
|
2007-10-20 01:34:54 +02:00
|
|
|
#include "mipict.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* From Knuth -- a good choice for hash/rehash values is p, p-2 where
|
|
|
|
* p and p-2 are both prime. These tables are sized to have an extra 10%
|
|
|
|
* free to avoid exponential performance degradation as the hash table fills
|
|
|
|
*/
|
|
|
|
static GlyphHashSetRec glyphHashSets[] = {
|
2012-03-21 20:55:09 +01:00
|
|
|
{32, 43, 41},
|
|
|
|
{64, 73, 71},
|
|
|
|
{128, 151, 149},
|
|
|
|
{256, 283, 281},
|
|
|
|
{512, 571, 569},
|
|
|
|
{1024, 1153, 1151},
|
|
|
|
{2048, 2269, 2267},
|
|
|
|
{4096, 4519, 4517},
|
|
|
|
{8192, 9013, 9011},
|
|
|
|
{16384, 18043, 18041},
|
|
|
|
{32768, 36109, 36107},
|
|
|
|
{65536, 72091, 72089},
|
|
|
|
{131072, 144409, 144407},
|
|
|
|
{262144, 288361, 288359},
|
|
|
|
{524288, 576883, 576881},
|
|
|
|
{1048576, 1153459, 1153457},
|
|
|
|
{2097152, 2307163, 2307161},
|
|
|
|
{4194304, 4613893, 4613891},
|
|
|
|
{8388608, 9227641, 9227639},
|
|
|
|
{16777216, 18455029, 18455027},
|
|
|
|
{33554432, 36911011, 36911009},
|
|
|
|
{67108864, 73819861, 73819859},
|
|
|
|
{134217728, 147639589, 147639587},
|
|
|
|
{268435456, 295279081, 295279079},
|
|
|
|
{536870912, 590559793, 590559791}
|
2003-11-14 17:48:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#define NGLYPHHASHSETS (sizeof(glyphHashSets)/sizeof(glyphHashSets[0]))
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 };
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static GlyphHashRec globalGlyphs[GlyphFormatNum];
|
2003-11-14 17:48:57 +01:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphUninit(ScreenPtr pScreen)
|
2006-01-03 23:06:23 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
GlyphPtr glyph;
|
|
|
|
int fdepth, i;
|
|
|
|
|
|
|
|
for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++) {
|
|
|
|
if (!globalGlyphs[fdepth].hashSet)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for (i = 0; i < globalGlyphs[fdepth].hashSet->size; i++) {
|
|
|
|
glyph = globalGlyphs[fdepth].table[i].glyph;
|
|
|
|
if (glyph && glyph != DeletedGlyph) {
|
2012-05-05 10:47:24 +02:00
|
|
|
if (GetGlyphPicture(glyph, pScreen)) {
|
|
|
|
FreePicture((pointer) GetGlyphPicture(glyph, pScreen), 0);
|
|
|
|
SetGlyphPicture(glyph, pScreen, NULL);
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
(*ps->UnrealizeGlyph) (pScreen, glyph);
|
|
|
|
}
|
|
|
|
}
|
2006-01-03 23:06:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
GlyphHashSetPtr
|
2012-03-21 20:55:09 +01:00
|
|
|
FindGlyphHashSet(CARD32 filled)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int i;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
for (i = 0; i < NGLYPHHASHSETS; i++)
|
2012-03-21 20:55:09 +01:00
|
|
|
if (glyphHashSets[i].entries >= filled)
|
|
|
|
return &glyphHashSets[i];
|
2003-11-14 17:48:57 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
GlyphRefPtr
|
2012-03-21 20:55:09 +01:00
|
|
|
FindGlyphRef(GlyphHashPtr hash,
|
|
|
|
CARD32 signature, Bool match, unsigned char sha1[20])
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
CARD32 elt, step, s;
|
|
|
|
GlyphPtr glyph;
|
|
|
|
GlyphRefPtr table, gr, del;
|
|
|
|
CARD32 tableSize = hash->hashSet->size;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
table = hash->table;
|
|
|
|
elt = signature % tableSize;
|
|
|
|
step = 0;
|
|
|
|
del = 0;
|
2012-03-21 20:55:09 +01:00
|
|
|
for (;;) {
|
|
|
|
gr = &table[elt];
|
|
|
|
s = gr->signature;
|
|
|
|
glyph = gr->glyph;
|
|
|
|
if (!glyph) {
|
|
|
|
if (del)
|
|
|
|
gr = del;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (glyph == DeletedGlyph) {
|
|
|
|
if (!del)
|
|
|
|
del = gr;
|
|
|
|
else if (gr == del)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (s == signature &&
|
|
|
|
(!match || memcmp(glyph->sha1, sha1, 20) == 0)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!step) {
|
|
|
|
step = signature % hash->hashSet->rehash;
|
|
|
|
if (!step)
|
|
|
|
step = 1;
|
|
|
|
}
|
|
|
|
elt += step;
|
|
|
|
if (elt >= tableSize)
|
|
|
|
elt -= tableSize;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return gr;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
HashGlyph(xGlyphInfo * gi,
|
|
|
|
CARD8 *bits, unsigned long size, unsigned char sha1[20])
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2009-10-14 23:20:44 +02:00
|
|
|
void *ctx = x_sha1_init();
|
2008-09-23 18:22:07 +02:00
|
|
|
int success;
|
|
|
|
|
2009-10-14 23:20:44 +02:00
|
|
|
if (!ctx)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2008-09-23 18:22:07 +02:00
|
|
|
|
2009-10-14 23:20:44 +02:00
|
|
|
success = x_sha1_update(ctx, gi, sizeof(xGlyphInfo));
|
|
|
|
if (!success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2009-10-14 23:20:44 +02:00
|
|
|
success = x_sha1_update(ctx, bits, size);
|
|
|
|
if (!success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2009-10-14 23:20:44 +02:00
|
|
|
success = x_sha1_final(ctx, sha1);
|
|
|
|
if (!success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2007-08-01 02:04:13 +02:00
|
|
|
return Success;
|
2007-07-31 06:43:20 +02:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
GlyphPtr
|
2012-03-21 20:55:09 +01:00
|
|
|
FindGlyphByHash(unsigned char sha1[20], int format)
|
2007-07-31 02:31:47 +02:00
|
|
|
{
|
|
|
|
GlyphRefPtr gr;
|
2007-08-01 02:04:13 +02:00
|
|
|
CARD32 signature = *(CARD32 *) sha1;
|
2007-07-31 02:31:47 +02:00
|
|
|
|
2010-03-23 17:08:19 +01:00
|
|
|
if (!globalGlyphs[format].hashSet)
|
2012-03-21 20:55:09 +01:00
|
|
|
return NULL;
|
2010-03-23 17:08:19 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
gr = FindGlyphRef(&globalGlyphs[format], signature, TRUE, sha1);
|
2007-07-31 02:31:47 +02:00
|
|
|
|
|
|
|
if (gr->glyph && gr->glyph != DeletedGlyph)
|
2012-03-21 20:55:09 +01:00
|
|
|
return gr->glyph;
|
2007-07-31 02:31:47 +02:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
return NULL;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CHECK_DUPLICATES
|
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
DuplicateRef(GlyphPtr glyph, char *where)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
ErrorF("Duplicate Glyph 0x%x from %s\n", glyph, where);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
CheckDuplicates(GlyphHashPtr hash, char *where)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphPtr g;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
for (i = 0; i < hash->hashSet->size; i++) {
|
|
|
|
g = hash->table[i].glyph;
|
|
|
|
if (!g || g == DeletedGlyph)
|
|
|
|
continue;
|
|
|
|
for (j = i + 1; j < hash->hashSet->size; j++)
|
|
|
|
if (hash->table[j].glyph == g)
|
|
|
|
DuplicateRef(g, where);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define CheckDuplicates(a,b)
|
|
|
|
#define DuplicateRef(a,b)
|
|
|
|
#endif
|
|
|
|
|
2009-09-23 02:53:51 +02:00
|
|
|
static void
|
|
|
|
FreeGlyphPicture(GlyphPtr glyph)
|
|
|
|
{
|
|
|
|
PictureScreenPtr ps;
|
|
|
|
int i;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
2009-09-23 02:53:51 +02:00
|
|
|
ScreenPtr pScreen = screenInfo.screens[i];
|
|
|
|
|
2012-05-05 10:47:24 +02:00
|
|
|
if (GetGlyphPicture(glyph, pScreen))
|
|
|
|
FreePicture((pointer) GetGlyphPicture(glyph, pScreen), 0);
|
2009-09-23 02:53:51 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
ps = GetPictureScreenIfSet(pScreen);
|
2009-09-23 02:53:51 +02:00
|
|
|
if (ps)
|
|
|
|
(*ps->UnrealizeGlyph) (pScreen, glyph);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
FreeGlyph(GlyphPtr glyph, int format)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
CheckDuplicates(&globalGlyphs[format], "FreeGlyph");
|
|
|
|
if (--glyph->refcnt == 0) {
|
|
|
|
GlyphRefPtr gr;
|
|
|
|
int i;
|
|
|
|
int first;
|
|
|
|
CARD32 signature;
|
|
|
|
|
|
|
|
first = -1;
|
|
|
|
for (i = 0; i < globalGlyphs[format].hashSet->size; i++)
|
|
|
|
if (globalGlyphs[format].table[i].glyph == glyph) {
|
|
|
|
if (first != -1)
|
|
|
|
DuplicateRef(glyph, "FreeGlyph check");
|
|
|
|
first = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
signature = *(CARD32 *) glyph->sha1;
|
|
|
|
gr = FindGlyphRef(&globalGlyphs[format], signature, TRUE, glyph->sha1);
|
|
|
|
if (gr - globalGlyphs[format].table != first)
|
|
|
|
DuplicateRef(glyph, "Found wrong one");
|
|
|
|
if (gr->glyph && gr->glyph != DeletedGlyph) {
|
|
|
|
gr->glyph = DeletedGlyph;
|
|
|
|
gr->signature = 0;
|
|
|
|
globalGlyphs[format].tableEntries--;
|
|
|
|
}
|
|
|
|
|
|
|
|
FreeGlyphPicture(glyph);
|
|
|
|
dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
AddGlyph(GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphRefPtr gr;
|
|
|
|
CARD32 signature;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
CheckDuplicates(&globalGlyphs[glyphSet->fdepth], "AddGlyph top global");
|
2003-11-14 17:48:57 +01:00
|
|
|
/* Locate existing matching glyph */
|
2007-08-01 02:04:13 +02:00
|
|
|
signature = *(CARD32 *) glyph->sha1;
|
2012-03-21 20:55:09 +01:00
|
|
|
gr = FindGlyphRef(&globalGlyphs[glyphSet->fdepth], signature,
|
|
|
|
TRUE, glyph->sha1);
|
|
|
|
if (gr->glyph && gr->glyph != DeletedGlyph && gr->glyph != glyph) {
|
|
|
|
FreeGlyphPicture(glyph);
|
|
|
|
dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
|
|
|
|
glyph = gr->glyph;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else if (gr->glyph != glyph) {
|
|
|
|
gr->glyph = glyph;
|
|
|
|
gr->signature = signature;
|
|
|
|
globalGlyphs[glyphSet->fdepth].tableEntries++;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* Insert/replace glyphset value */
|
2012-03-21 20:55:09 +01:00
|
|
|
gr = FindGlyphRef(&glyphSet->hash, id, FALSE, 0);
|
2003-11-14 17:48:57 +01:00
|
|
|
++glyph->refcnt;
|
|
|
|
if (gr->glyph && gr->glyph != DeletedGlyph)
|
2012-03-21 20:55:09 +01:00
|
|
|
FreeGlyph(gr->glyph, glyphSet->fdepth);
|
2003-11-14 17:48:57 +01:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
glyphSet->hash.tableEntries++;
|
2003-11-14 17:48:57 +01:00
|
|
|
gr->glyph = glyph;
|
|
|
|
gr->signature = id;
|
2012-03-21 20:55:09 +01:00
|
|
|
CheckDuplicates(&globalGlyphs[glyphSet->fdepth], "AddGlyph bottom");
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
DeleteGlyph(GlyphSetPtr glyphSet, Glyph id)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphRefPtr gr;
|
|
|
|
GlyphPtr glyph;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
gr = FindGlyphRef(&glyphSet->hash, id, FALSE, 0);
|
2003-11-14 17:48:57 +01:00
|
|
|
glyph = gr->glyph;
|
2012-03-21 20:55:09 +01:00
|
|
|
if (glyph && glyph != DeletedGlyph) {
|
|
|
|
gr->glyph = DeletedGlyph;
|
|
|
|
glyphSet->hash.tableEntries--;
|
|
|
|
FreeGlyph(glyph, glyphSet->fdepth);
|
|
|
|
return TRUE;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
GlyphPtr
|
2012-03-21 20:55:09 +01:00
|
|
|
FindGlyph(GlyphSetPtr glyphSet, Glyph id)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphPtr glyph;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
glyph = FindGlyphRef(&glyphSet->hash, id, FALSE, 0)->glyph;
|
2003-11-14 17:48:57 +01:00
|
|
|
if (glyph == DeletedGlyph)
|
2012-03-21 20:55:09 +01:00
|
|
|
glyph = 0;
|
2003-11-14 17:48:57 +01:00
|
|
|
return glyph;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
GlyphPtr
|
2012-03-21 20:55:09 +01:00
|
|
|
AllocateGlyph(xGlyphInfo * gi, int fdepth)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2006-01-03 23:06:23 +01:00
|
|
|
PictureScreenPtr ps;
|
2012-03-21 20:55:09 +01:00
|
|
|
int size;
|
|
|
|
GlyphPtr glyph;
|
|
|
|
int i;
|
|
|
|
int head_size;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
head_size = sizeof(GlyphRec) + screenInfo.numScreens * sizeof(PicturePtr);
|
2010-06-07 01:04:42 +02:00
|
|
|
size = (head_size + dixPrivatesSize(PRIVATE_GLYPH));
|
2012-03-21 20:55:09 +01:00
|
|
|
glyph = (GlyphPtr) malloc(size);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!glyph)
|
2012-03-21 20:55:09 +01:00
|
|
|
return 0;
|
2003-11-14 17:48:57 +01:00
|
|
|
glyph->refcnt = 0;
|
2012-03-21 20:55:09 +01:00
|
|
|
glyph->size = size + sizeof(xGlyphInfo);
|
2003-11-14 17:48:57 +01:00
|
|
|
glyph->info = *gi;
|
2010-06-07 01:04:42 +02:00
|
|
|
dixInitPrivates(glyph, (char *) glyph + head_size, PRIVATE_GLYPH);
|
2006-01-03 23:06:23 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
2012-05-05 10:47:24 +02:00
|
|
|
ScreenPtr pScreen = screenInfo.screens[i];
|
|
|
|
SetGlyphPicture(glyph, pScreen, NULL);
|
|
|
|
ps = GetPictureScreenIfSet(pScreen);
|
2007-08-02 00:48:30 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (ps) {
|
2012-05-05 10:47:24 +02:00
|
|
|
if (!(*ps->RealizeGlyph) (pScreen, glyph))
|
2012-03-21 20:55:09 +01:00
|
|
|
goto bail;
|
|
|
|
}
|
2006-01-03 23:06:23 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
return glyph;
|
2007-08-02 00:48:30 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
bail:
|
|
|
|
while (i--) {
|
|
|
|
ps = GetPictureScreenIfSet(screenInfo.screens[i]);
|
|
|
|
if (ps)
|
|
|
|
(*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph);
|
2007-08-02 00:48:30 +02:00
|
|
|
}
|
2007-10-25 18:19:30 +02:00
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
dixFreeObjectWithPrivates(glyph, PRIVATE_GLYPH);
|
2007-08-02 00:48:30 +02:00
|
|
|
return 0;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
AllocateGlyphHash(GlyphHashPtr hash, GlyphHashSetPtr hashSet)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
hash->table = calloc(hashSet->size, sizeof(GlyphRefRec));
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!hash->table)
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
hash->hashSet = hashSet;
|
|
|
|
hash->tableEntries = 0;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
ResizeGlyphHash(GlyphHashPtr hash, CARD32 change, Bool global)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
CARD32 tableEntries;
|
2003-11-14 17:48:57 +01:00
|
|
|
GlyphHashSetPtr hashSet;
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphHashRec newHash;
|
|
|
|
GlyphRefPtr gr;
|
|
|
|
GlyphPtr glyph;
|
|
|
|
int i;
|
|
|
|
int oldSize;
|
|
|
|
CARD32 s;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
tableEntries = hash->tableEntries + change;
|
2012-03-21 20:55:09 +01:00
|
|
|
hashSet = FindGlyphHashSet(tableEntries);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (hashSet == hash->hashSet)
|
2012-03-21 20:55:09 +01:00
|
|
|
return TRUE;
|
2003-11-14 17:48:57 +01:00
|
|
|
if (global)
|
2012-03-21 20:55:09 +01:00
|
|
|
CheckDuplicates(hash, "ResizeGlyphHash top");
|
|
|
|
if (!AllocateGlyphHash(&newHash, hashSet))
|
|
|
|
return FALSE;
|
|
|
|
if (hash->table) {
|
|
|
|
oldSize = hash->hashSet->size;
|
|
|
|
for (i = 0; i < oldSize; i++) {
|
|
|
|
glyph = hash->table[i].glyph;
|
|
|
|
if (glyph && glyph != DeletedGlyph) {
|
|
|
|
s = hash->table[i].signature;
|
|
|
|
gr = FindGlyphRef(&newHash, s, global, glyph->sha1);
|
|
|
|
|
|
|
|
gr->signature = s;
|
|
|
|
gr->glyph = glyph;
|
|
|
|
++newHash.tableEntries;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(hash->table);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
*hash = newHash;
|
|
|
|
if (global)
|
2012-03-21 20:55:09 +01:00
|
|
|
CheckDuplicates(hash, "ResizeGlyphHash bottom");
|
2003-11-14 17:48:57 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
ResizeGlyphSet(GlyphSetPtr glyphSet, CARD32 change)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
return (ResizeGlyphHash(&glyphSet->hash, change, FALSE) &&
|
|
|
|
ResizeGlyphHash(&globalGlyphs[glyphSet->fdepth], change, TRUE));
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
GlyphSetPtr
|
2012-03-21 20:55:09 +01:00
|
|
|
AllocateGlyphSet(int fdepth, PictFormatPtr format)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetPtr glyphSet;
|
|
|
|
|
|
|
|
if (!globalGlyphs[fdepth].hashSet) {
|
|
|
|
if (!AllocateGlyphHash(&globalGlyphs[fdepth], &glyphHashSets[0]))
|
|
|
|
return FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
glyphSet = dixAllocateObjectWithPrivates(GlyphSetRec, PRIVATE_GLYPHSET);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!glyphSet)
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!AllocateGlyphHash(&glyphSet->hash, &glyphHashSets[0])) {
|
|
|
|
free(glyphSet);
|
|
|
|
return FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
glyphSet->refcnt = 1;
|
|
|
|
glyphSet->fdepth = fdepth;
|
|
|
|
glyphSet->format = format;
|
2012-03-21 20:55:09 +01:00
|
|
|
return glyphSet;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
FreeGlyphSet(pointer value, XID gid)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphSetPtr glyphSet = (GlyphSetPtr) value;
|
|
|
|
|
|
|
|
if (--glyphSet->refcnt == 0) {
|
|
|
|
CARD32 i, tableSize = glyphSet->hash.hashSet->size;
|
|
|
|
GlyphRefPtr table = glyphSet->hash.table;
|
|
|
|
GlyphPtr glyph;
|
|
|
|
|
|
|
|
for (i = 0; i < tableSize; i++) {
|
|
|
|
glyph = table[i].glyph;
|
|
|
|
if (glyph && glyph != DeletedGlyph)
|
|
|
|
FreeGlyph(glyph, glyphSet->fdepth);
|
|
|
|
}
|
|
|
|
if (!globalGlyphs[glyphSet->fdepth].tableEntries) {
|
|
|
|
free(globalGlyphs[glyphSet->fdepth].table);
|
|
|
|
globalGlyphs[glyphSet->fdepth].table = 0;
|
|
|
|
globalGlyphs[glyphSet->fdepth].hashSet = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ResizeGlyphHash(&globalGlyphs[glyphSet->fdepth], 0, TRUE);
|
|
|
|
free(table);
|
|
|
|
dixFreeObjectWithPrivates(glyphSet, PRIVATE_GLYPHSET);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
2007-10-20 01:34:54 +02:00
|
|
|
|
|
|
|
static void
|
2012-03-21 20:55:09 +01:00
|
|
|
GlyphExtents(int nlist, GlyphListPtr list, GlyphPtr * glyphs, BoxPtr extents)
|
2007-10-20 01:34:54 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int x1, x2, y1, y2;
|
|
|
|
int n;
|
|
|
|
GlyphPtr glyph;
|
|
|
|
int x, y;
|
|
|
|
|
2007-10-20 01:34:54 +02:00
|
|
|
x = 0;
|
|
|
|
y = 0;
|
|
|
|
extents->x1 = MAXSHORT;
|
|
|
|
extents->x2 = MINSHORT;
|
|
|
|
extents->y1 = MAXSHORT;
|
|
|
|
extents->y2 = MINSHORT;
|
2012-03-21 20:55:09 +01:00
|
|
|
while (nlist--) {
|
|
|
|
x += list->xOff;
|
|
|
|
y += list->yOff;
|
|
|
|
n = list->len;
|
|
|
|
list++;
|
|
|
|
while (n--) {
|
|
|
|
glyph = *glyphs++;
|
|
|
|
x1 = x - glyph->info.x;
|
|
|
|
if (x1 < MINSHORT)
|
|
|
|
x1 = MINSHORT;
|
|
|
|
y1 = y - glyph->info.y;
|
|
|
|
if (y1 < MINSHORT)
|
|
|
|
y1 = MINSHORT;
|
|
|
|
x2 = x1 + glyph->info.width;
|
|
|
|
if (x2 > MAXSHORT)
|
|
|
|
x2 = MAXSHORT;
|
|
|
|
y2 = y1 + glyph->info.height;
|
|
|
|
if (y2 > MAXSHORT)
|
|
|
|
y2 = MAXSHORT;
|
|
|
|
if (x1 < extents->x1)
|
|
|
|
extents->x1 = x1;
|
|
|
|
if (x2 > extents->x2)
|
|
|
|
extents->x2 = x2;
|
|
|
|
if (y1 < extents->y1)
|
|
|
|
extents->y1 = y1;
|
|
|
|
if (y2 > extents->y2)
|
|
|
|
extents->y2 = y2;
|
|
|
|
x += glyph->info.xOff;
|
|
|
|
y += glyph->info.yOff;
|
|
|
|
}
|
2007-10-20 01:34:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
CompositeGlyphs(CARD8 op,
|
|
|
|
PicturePtr pSrc,
|
|
|
|
PicturePtr pDst,
|
|
|
|
PictFormatPtr maskFormat,
|
|
|
|
INT16 xSrc,
|
|
|
|
INT16 ySrc, int nlist, GlyphListPtr lists, GlyphPtr * glyphs)
|
2007-10-20 01:34:54 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
|
2007-10-27 00:13:50 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
ValidatePicture(pSrc);
|
|
|
|
ValidatePicture(pDst);
|
|
|
|
(*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, lists,
|
|
|
|
glyphs);
|
2007-10-20 01:34:54 +02:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
miRealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph)
|
2007-10-20 01:34:54 +02:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
miUnrealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph)
|
2007-10-20 01:34:54 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
miGlyphs(CARD8 op,
|
|
|
|
PicturePtr pSrc,
|
|
|
|
PicturePtr pDst,
|
|
|
|
PictFormatPtr maskFormat,
|
|
|
|
INT16 xSrc,
|
|
|
|
INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs)
|
2007-10-20 01:34:54 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pPicture;
|
|
|
|
PixmapPtr pMaskPixmap = 0;
|
|
|
|
PicturePtr pMask;
|
|
|
|
ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
|
|
|
int width = 0, height = 0;
|
|
|
|
int x, y;
|
|
|
|
int xDst = list->xOff, yDst = list->yOff;
|
|
|
|
int n;
|
|
|
|
GlyphPtr glyph;
|
|
|
|
int error;
|
|
|
|
BoxRec extents = { 0, 0, 0, 0 };
|
|
|
|
CARD32 component_alpha;
|
|
|
|
|
|
|
|
if (maskFormat) {
|
|
|
|
GCPtr pGC;
|
|
|
|
xRectangle rect;
|
|
|
|
|
|
|
|
GlyphExtents(nlist, list, glyphs, &extents);
|
|
|
|
|
|
|
|
if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
|
|
|
|
return;
|
|
|
|
width = extents.x2 - extents.x1;
|
|
|
|
height = extents.y2 - extents.y1;
|
|
|
|
pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
|
|
|
|
maskFormat->depth,
|
|
|
|
CREATE_PIXMAP_USAGE_SCRATCH);
|
|
|
|
if (!pMaskPixmap)
|
|
|
|
return;
|
|
|
|
component_alpha = NeedsComponent(maskFormat->format);
|
|
|
|
pMask = CreatePicture(0, &pMaskPixmap->drawable,
|
|
|
|
maskFormat, CPComponentAlpha, &component_alpha,
|
|
|
|
serverClient, &error);
|
|
|
|
if (!pMask) {
|
|
|
|
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pGC = GetScratchGC(pMaskPixmap->drawable.depth, pScreen);
|
|
|
|
ValidateGC(&pMaskPixmap->drawable, pGC);
|
|
|
|
rect.x = 0;
|
|
|
|
rect.y = 0;
|
|
|
|
rect.width = width;
|
|
|
|
rect.height = height;
|
|
|
|
(*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
|
|
|
|
FreeScratchGC(pGC);
|
|
|
|
x = -extents.x1;
|
|
|
|
y = -extents.y1;
|
2007-10-20 01:34:54 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else {
|
|
|
|
pMask = pDst;
|
|
|
|
x = 0;
|
|
|
|
y = 0;
|
2007-10-20 01:34:54 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
while (nlist--) {
|
|
|
|
x += list->xOff;
|
|
|
|
y += list->yOff;
|
|
|
|
n = list->len;
|
|
|
|
while (n--) {
|
|
|
|
glyph = *glyphs++;
|
2012-05-05 10:47:24 +02:00
|
|
|
pPicture = GetGlyphPicture(glyph, pScreen);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
if (pPicture) {
|
|
|
|
if (maskFormat) {
|
|
|
|
CompositePicture(PictOpAdd,
|
|
|
|
pPicture,
|
|
|
|
None,
|
|
|
|
pMask,
|
|
|
|
0, 0,
|
|
|
|
0, 0,
|
|
|
|
x - glyph->info.x,
|
|
|
|
y - glyph->info.y,
|
|
|
|
glyph->info.width, glyph->info.height);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
CompositePicture(op,
|
|
|
|
pSrc,
|
|
|
|
pPicture,
|
|
|
|
pDst,
|
|
|
|
xSrc + (x - glyph->info.x) - xDst,
|
|
|
|
ySrc + (y - glyph->info.y) - yDst,
|
|
|
|
0, 0,
|
|
|
|
x - glyph->info.x,
|
|
|
|
y - glyph->info.y,
|
|
|
|
glyph->info.width, glyph->info.height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
x += glyph->info.xOff;
|
|
|
|
y += glyph->info.yOff;
|
|
|
|
}
|
|
|
|
list++;
|
2007-10-20 01:34:54 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (maskFormat) {
|
|
|
|
x = extents.x1;
|
|
|
|
y = extents.y1;
|
|
|
|
CompositePicture(op,
|
|
|
|
pSrc,
|
|
|
|
pMask,
|
|
|
|
pDst,
|
|
|
|
xSrc + x - xDst,
|
|
|
|
ySrc + y - yDst, 0, 0, x, y, width, height);
|
|
|
|
FreePicture((pointer) pMask, (XID) 0);
|
|
|
|
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
2007-10-20 01:34:54 +02:00
|
|
|
}
|
|
|
|
}
|
2012-05-05 10:38:28 +02:00
|
|
|
|
|
|
|
PicturePtr GetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen)
|
|
|
|
{
|
2012-06-05 18:09:38 +02:00
|
|
|
if (pScreen->isGPU)
|
|
|
|
return NULL;
|
2012-05-05 10:38:28 +02:00
|
|
|
return GlyphPicture(glyph)[pScreen->myNum];
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen, PicturePtr picture)
|
|
|
|
{
|
|
|
|
GlyphPicture(glyph)[pScreen->myNum] = picture;
|
|
|
|
}
|