[stsf-commit] stsf/STClientLibrary/src STGlyphVector.c, 1.4,
1.5 STLine.c, 1.2, 1.3 STStyle.c, 1.1.1.1, 1.2 STText.c, 1.3,
1.4 STTypeEnv.c, 1.3, 1.4 libtest.c, 1.2,
1.3 serverconnection.c, 1.5, 1.6
Alexander Gelfenbain
stsf-commit at pdx.freedesktop.org
Tue May 25 19:58:53 PDT 2004
Committed by: adg
Index: STGlyphVector.c
===================================================================
RCS file: /cvs/stsf/stsf/STClientLibrary/src/STGlyphVector.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/STGlyphVector.c 25 May 2004 02:47:24 -0000 1.4
+++ b/STGlyphVector.c 26 May 2004 02:58:50 -0000 1.5
@@ -686,6 +686,7 @@
p->rpropsManager = GetRenderPropsManager();
p->metricsCacheDirty = src->metricsCacheDirty;
// p->rpropsCacheDirty = src->rpropsCacheDirty;
+ p->graphics = NULL;
memcpy(&p->bbox, &src->bbox, sizeof(STRectangle));
if ((p->glyphs = calloc(p->glyphCount, sizeof(STStyledGlyphInternal *))) == NULL) {
Index: STLine.c
===================================================================
RCS file: /cvs/stsf/stsf/STClientLibrary/src/STLine.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/STLine.c 25 May 2004 02:47:24 -0000 1.2
+++ b/STLine.c 26 May 2004 02:58:50 -0000 1.3
@@ -640,7 +640,7 @@
STScaler scaler;
STHintingMode hints;
STSbitsMode sbits;
- STStyleMask styleMask;
+ STStyleMask styleMask = 0;
result = STStyleGetFont(*(in->style), &styleMask, NULL, &fontSize, NULL, NULL);
if (result != ST_OK) {
Index: STStyle.c
===================================================================
RCS file: /cvs/stsf/stsf/STClientLibrary/src/STStyle.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- a/STStyle.c 26 Mar 2004 19:19:55 -0000 1.1.1.1
+++ b/STStyle.c 26 May 2004 02:58:50 -0000 1.2
@@ -59,13 +59,13 @@
D1;
o = *oStyleRep = malloc(sizeof(STStyleRep));
if (o == NULL) {
- return ST_MEMORY;
+ return ST_MEMORY;
}
if (iStyleRep == NULL) {
- memset(o, 0, sizeof(STStyleRep));
- o->env = iEnv;
+ memset(o, 0, sizeof(STStyleRep));
+ o->env = iEnv;
[...1080 lines suppressed...]
- return ST_NULL_POINTER;
+ return ST_NULL_POINTER;
}
result = STStyleCopyOnWrite(t);
if (result != ST_OK)
- return result;
+ return result;
t->p->pData = iData;
@@ -1172,7 +1172,7 @@
/* STStatus result = ST_OK; */
D1;
if (t == NULL || t->p == NULL ) {
- return ST_NULL_POINTER;
+ return ST_NULL_POINTER;
}
oData = t->p->pData;
Index: STText.c
===================================================================
RCS file: /cvs/stsf/stsf/STClientLibrary/src/STText.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- a/STText.c 22 Apr 2004 20:56:32 -0000 1.3
+++ b/STText.c 26 May 2004 02:58:50 -0000 1.4
@@ -75,59 +75,59 @@
STStatus glyphCacheDispose(glyphCache *g)
{
if ((g != NULL) && (--g->refCnt <= 0)) {
- if (g->cachedGraphics) {
- STGraphicsDispose(g->cachedGraphics);
- g->cachedGraphics = NULL;
- }
- if (g->cachedDevice) {
- free(g->cachedDevice);
- g->cachedDevice = NULL;
- }
[...1114 lines suppressed...]
if ( result == ST_OK ) {
result = StyleChunkSet(iText->styles, iPosition + iCharCount, mod_start + mod_length - ( iPosition + iCharCount ), mod_style);
@@ -1768,7 +1768,7 @@
* If we are at the start of a style, then just change the style.
*/
if ( mod_start != i ) {
- result = STStyleNewCopy ( new_style, mod_style );
+ result = STStyleNewCopy ( new_style, mod_style );
if ( result == ST_OK ) {
result = StyleChunkSet(iText->styles, mod_start, i - mod_start, mod_style);
new_start = i;
@@ -1782,7 +1782,7 @@
*/
if ( mod_start + mod_length > iPosition + iCharCount ) {
if ( new_style == NULL ) {
- result = STStyleNewCopy ( new_style, mod_style );
+ result = STStyleNewCopy ( new_style, mod_style );
if ( result == ST_OK ) {
result = StyleChunkSet(iText->styles, iPosition + iCharCount, mod_start + mod_length - ( iPosition + iCharCount ), mod_style);
Index: STTypeEnv.c
===================================================================
RCS file: /cvs/stsf/stsf/STClientLibrary/src/STTypeEnv.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- a/STTypeEnv.c 22 Apr 2004 20:56:32 -0000 1.3
+++ b/STTypeEnv.c 26 May 2004 02:58:50 -0000 1.4
@@ -164,13 +164,13 @@
STTypeEnvRep *p = t->p;
- fprintf(DebugFile, "STTypeEnv: %X\n"
+ DebugStr(-1, "STTypeEnv: %X\n"
"\tdefaultStyle: %X\n"
"\tdefaultText: %X\n"
"\tp: %X\n", (unsigned int) t, (unsigned int) t->defaultStyle, (unsigned int) t->defaultText, (unsigned int) t->p);
if (p != NULL) {
- fprintf(DebugFile, "\t\trefCnt: %d\n"
+ DebugStr(-1, "\t\trefCnt: %d\n"
"\t\tfbPolicy: %d\n"
"\t\tSTServerSession %X\n", p->refCnt, p->fbPolicy, (unsigned int) p->session);
Index: libtest.c
===================================================================
RCS file: /cvs/stsf/stsf/STClientLibrary/src/libtest.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/libtest.c 25 May 2004 02:47:24 -0000 1.2
+++ b/libtest.c 26 May 2004 02:58:50 -0000 1.3
@@ -213,7 +213,7 @@
static STDevice DummyDeviceConstructor(void)
{
- STRasterDevice s = malloc(sizeof(struct STRasterDeviceStruct));
+ STRasterDevice s = calloc(1, sizeof(struct STRasterDeviceStruct));
s->devType = ST_DEVICE_RASTER;
// STMatrixInit(&s->matrix);
@@ -545,8 +545,9 @@
STLine line = 0;
STGraphics graphics = 0;
byte *bitmap;
- STRasterDevice dev;
+ STRasterDevice dev = NULL;
STRGBAColor colors[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
+ utf16 *tt = CStringToUTF16(mytext);
if ((s = STTypeEnvNew(&e)) != ST_OK) return;
@@ -555,7 +556,7 @@
goto done;
}
- if ((s = STTextNew(&text, e, CStringToUTF16(mytext), strlen(mytext))) != ST_OK) {
+ if ((s = STTextNew(&text, e, tt, strlen(mytext))) != ST_OK) {
printf("STTextNew: %s.\n", ErrorCodeName(s));
goto done;
}
@@ -604,6 +605,7 @@
done:
+ free(tt);
STLineDispose(line);
STTextDispose(text);
STStyleDispose(style);
@@ -1063,6 +1065,81 @@
}
#endif
+void GlyphVectorTest3(void)
+{
+ STTypeEnv e;
+ STGlyphVector a = NULL, b = NULL;
+ STGraphics g;
+ STStatus res;
+ STGraphics graphics;
+ STRGBAColor colors[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
+ STStyledGlyph glyphs[5] = {
+ {1, NULL, {2.5, 3.5}},
+ {2, NULL, {3.5, 4.5}},
+ {3, NULL, {4.5, 5.5}},
+ {4, NULL, {5.5, 6.5}},
+ {5, NULL, {6.5, 7.5}}
+ };
+ STStyle s0;
+
+ if ((res = STGraphicsNew(&graphics,
+ DummyDeviceConstructor(),
+ ST_OM_RASTER_MONO,
+ ST_GM_COLOR_ALL,
+ colors)) != ST_OK) {
+
+ printf("STGraphicsNew: %s.\n", ErrorCodeName(res));
+ }
+
+
+ if ((res = STTypeEnvNew(&e)) != ST_OK) {
+ printf("STTypeEnvNew: %s.\n", ErrorCodeName(res));
+ return;
+ }
+
+ STStyleNewDefault(&s0, e);
+ STStyleSetFont(s0, ST_SM_FONTID|ST_SM_SIZE, 1, 14.0, 0, 0);
+
+ glyphs[0].style = &s0;
+ glyphs[1].style = &s0;
+ glyphs[2].style = &s0;
+ glyphs[3].style = &s0;
+ glyphs[4].style = &s0;
+
+ if ((res = STGlyphVectorNew(&a, e, NULL, 0)) != ST_OK) {
+ printf("STGlyphVectorNew: %s.\n", ErrorCodeName(res));
+ }
+ if ((res = STGlyphVectorReplaceGlyphs(a, 0, 0, glyphs, 5)) != ST_OK) {
+ printf("STGlyphVectorReplaceGlyphs: %s.\n", ErrorCodeName(res));
+ }
+ if ((res = STGlyphVectorNewCopy(&b, a)) != ST_OK) {
+ printf("STGlyphVectorNewCopy: %s.\n", ErrorCodeName(res));
+ }
+
+ if ((res = STGlyphVectorRender(a, 0, 5, graphics)) != ST_OK) {
+ printf("STGlyphVectorRender: %s.\n", ErrorCodeName(res));
+ }
+ if ((res = STGlyphVectorRender(b, 0, 5, graphics)) != ST_OK) {
+ printf("STGlyphVectorRender: %s.\n", ErrorCodeName(res));
+ }
+ if ((res = STGlyphVectorDispose(a)) != ST_OK) {
+ printf("STGlyphVectorDispose: %s.\n", ErrorCodeName(res));
+ }
+ if ((res = STGlyphVectorDispose(b)) != ST_OK) {
+ printf("STGlyphVectorDispose: %s.\n", ErrorCodeName(res));
+ }
+ if ((res = STTypeEnvDispose(e)) != ST_OK) {
+ printf("STTypeEnvDispose: %s.\n", ErrorCodeName(res));
+ }
+ if ((res = STGraphicsDispose(graphics)) != ST_OK) {
+ printf("STGlyphVectorDispose: %s.\n", ErrorCodeName(res));
+ }
+}
+
+
+
+
+
void FindFontTest(int ac, char **av)
@@ -1260,13 +1337,18 @@
setlocale(LC_CTYPE, "");
STSysCtlByName("sharedcache.payloadsize", NULL, NULL, &psize, sizeof(uint32_t));
+
+ GlyphVectorTest();
+ GlyphVectorTest3();
+
+// return 0;
-// FindFontTest(ac, av);
-// TypeEnvTest1();
-// TypeEnvTest2();
-// FontTest1();
-// MetricsTest("Utopia Regular");
-// MetricsTest("Times New Roman");
+ FindFontTest(ac, av);
+ TypeEnvTest1();
+ TypeEnvTest2();
+ FontTest1();
+ MetricsTest("Utopia Regular");
+ MetricsTest("Times New Roman");
GlyphTest1(0);
@@ -1275,12 +1357,12 @@
// XXX GlyphTest2(0);
// XXX GlyphTest2(1);
-// RenderTest1();
-// ScalerTest();
-// LayoutTest();
+ RenderTest1();
+ ScalerTest();
+ LayoutTest();
GlyphVectorTest();
GlyphVectorTest2();
-// SessionFontsTest();
+ SessionFontsTest();
#ifdef TERMINATE_STFS
Index: serverconnection.c
===================================================================
RCS file: /cvs/stsf/stsf/STClientLibrary/src/serverconnection.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- a/serverconnection.c 25 May 2004 21:34:49 -0000 1.5
+++ b/serverconnection.c 26 May 2004 02:58:50 -0000 1.6
@@ -1006,11 +1006,11 @@
#ifdef STSF_DEBUG
if (DebugLevel >= 3) {
- fprintf(DebugFile, "PREFETCHGLYPHS: %d ==>", iCount);
+ DebugStr(-1, "PREFETCHGLYPHS: %d ==>", iCount);
for (i=0; i<iCount; i++) {
- fprintf(DebugFile, "[%d %d %d %d] ", ioGlyphs[i].scalerID, ioGlyphs[i].instanceID, ioGlyphs[i].glyphID, ioGlyphs[i].fracdelta);
+ DebugStr(-1, "[%d %d %d %d] ", ioGlyphs[i].scalerID, ioGlyphs[i].instanceID, ioGlyphs[i].glyphID, ioGlyphs[i].fracdelta);
}
- fprintf(DebugFile, "\n");
+ DebugStr(-1, "\n");
}
#endif
More information about the stsf-commit
mailing list