Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType Demo Programs
Commits:
-
f2191a8b
by Alexei Podtelezhnikov at 2021-11-23T22:16:30-05:00
-
be07acd3
by Alexei Podtelezhnikov at 2021-11-23T23:05:55-05:00
9 changed files:
- graph/allegro/gralleg.c
- graph/batch/grbatch.c
- graph/gblblit.c
- graph/graph.h
- graph/grdevice.c
- graph/grobjs.h
- graph/grtypes.h
- src/ftcommon.c
- src/ftdiff.c
Changes:
... | ... | @@ -192,8 +192,6 @@ static int init_surface(grSurface* surface, grBitmap* bitmap) |
192 | 192 |
surface->bitmap = *bitmap;
|
193 | 193 |
surface->refresh = 0;
|
194 | 194 |
surface->owner = 0;
|
195 |
- surface->saturation = 0;
|
|
196 |
- surface->blit_mono = 0;
|
|
197 | 195 |
|
198 | 196 |
surface->refresh_rect = alrefresh_rect;
|
199 | 197 |
surface->set_title = alset_title;
|
... | ... | @@ -84,8 +84,6 @@ |
84 | 84 |
surface->bitmap = *bitmap;
|
85 | 85 |
surface->refresh = 0;
|
86 | 86 |
surface->owner = 0;
|
87 |
- surface->saturation = 0;
|
|
88 |
- surface->blit_mono = 0;
|
|
89 | 87 |
|
90 | 88 |
surface->refresh_rect = (grRefreshRectFunc)NULL; /* nothing to refresh */
|
91 | 89 |
surface->set_title = gr_batch_surface_set_title;
|
... | ... | @@ -387,23 +387,20 @@ gblender_blit_init( GBlenderBlit blit, |
387 | 387 |
|
388 | 388 |
|
389 | 389 |
GBLENDER_APIDEF( void )
|
390 |
-grSetTargetGamma( grBitmap* target,
|
|
391 |
- double gamma )
|
|
390 |
+grSetTargetGamma( grSurface* surface,
|
|
391 |
+ double gamma )
|
|
392 | 392 |
{
|
393 |
- grSurface* surface = (grSurface*)target;
|
|
394 |
- |
|
395 |
- |
|
396 | 393 |
gblender_init( surface->gblender, gamma );
|
397 | 394 |
}
|
398 | 395 |
|
399 | 396 |
|
400 | 397 |
GBLENDER_APIDEF( void )
|
401 |
-grSetTargetPenBrush( grBitmap* target,
|
|
402 |
- int x,
|
|
403 |
- int y,
|
|
404 |
- grColor color )
|
|
398 |
+grSetTargetPenBrush( grSurface* surface,
|
|
399 |
+ int x,
|
|
400 |
+ int y,
|
|
401 |
+ grColor color )
|
|
405 | 402 |
{
|
406 |
- grSurface* surface = (grSurface*)target;
|
|
403 |
+ grBitmap* target = &surface->bitmap;
|
|
407 | 404 |
|
408 | 405 |
|
409 | 406 |
surface->origin = target->buffer;
|
... | ... | @@ -705,13 +705,14 @@ |
705 | 705 |
* blit glyphs
|
706 | 706 |
*
|
707 | 707 |
* <Input>
|
708 |
- * target :: handle to target bitmap/surface
|
|
708 |
+ * surface :: handle to target surface
|
|
709 | 709 |
* gamma :: gamma value. <= 0 to select sRGB transfer function
|
710 | 710 |
*
|
711 | 711 |
**********************************************************************/
|
712 | 712 |
|
713 | 713 |
extern
|
714 |
- void grSetTargetGamma( grBitmap* target, double gamma_value );
|
|
714 |
+ void grSetTargetGamma( grSurface* surface,
|
|
715 |
+ double gamma_value );
|
|
715 | 716 |
|
716 | 717 |
|
717 | 718 |
/**********************************************************************
|
... | ... | @@ -723,17 +724,17 @@ |
723 | 724 |
* set the pen position and brush color as required for direct mode.
|
724 | 725 |
*
|
725 | 726 |
* <Input>
|
726 |
- * target :: handle to target bitmap/surface
|
|
727 |
+ * surface :: handle to target surface
|
|
727 | 728 |
* x, y :: pen position
|
728 | 729 |
* color :: color as defined by grFindColor
|
729 | 730 |
*
|
730 | 731 |
**********************************************************************/
|
731 | 732 |
|
732 | 733 |
extern
|
733 |
- void grSetTargetPenBrush( grBitmap* target,
|
|
734 |
- int x,
|
|
735 |
- int y,
|
|
736 |
- grColor color );
|
|
734 |
+ void grSetTargetPenBrush( grSurface* surface,
|
|
735 |
+ int x,
|
|
736 |
+ int y,
|
|
737 |
+ grColor color );
|
|
737 | 738 |
|
738 | 739 |
/* */
|
739 | 740 |
|
... | ... | @@ -152,7 +152,7 @@ |
152 | 152 |
surface = NULL;
|
153 | 153 |
}
|
154 | 154 |
else
|
155 |
- grSetTargetGamma( (grBitmap*)surface, 1.8 );
|
|
155 |
+ grSetTargetGamma( surface, 1.8 );
|
|
156 | 156 |
|
157 | 157 |
return surface;
|
158 | 158 |
}
|
... | ... | @@ -23,76 +23,6 @@ |
23 | 23 |
#include "gblender.h"
|
24 | 24 |
|
25 | 25 |
|
26 |
- typedef struct grBiColor_
|
|
27 |
- {
|
|
28 |
- grColor foreground;
|
|
29 |
- grColor background;
|
|
30 |
- |
|
31 |
- int num_levels;
|
|
32 |
- int max_levels;
|
|
33 |
- grColor* levels;
|
|
34 |
- |
|
35 |
- } grBiColor;
|
|
36 |
- |
|
37 |
- |
|
38 |
- |
|
39 |
- /**********************************************************************
|
|
40 |
- *
|
|
41 |
- * Technical note : explaining how the blitter works.
|
|
42 |
- *
|
|
43 |
- * The blitter is used to "draw" a given source bitmap into
|
|
44 |
- * a given target bitmap.
|
|
45 |
- *
|
|
46 |
- * The function called 'compute_clips' is used to compute clipping
|
|
47 |
- * constraints. These lead us to compute two areas :
|
|
48 |
- *
|
|
49 |
- * - the read area : is the rectangle, within the source bitmap,
|
|
50 |
- * which will be effectively "drawn" in the
|
|
51 |
- * target bitmap.
|
|
52 |
- *
|
|
53 |
- * - the write area : is the rectangle, within the target bitmap,
|
|
54 |
- * which will effectively "receive" the pixels
|
|
55 |
- * from the read area
|
|
56 |
- *
|
|
57 |
- * Note that both areas have the same dimensions, but are
|
|
58 |
- * located in distinct surfaces.
|
|
59 |
- *
|
|
60 |
- * These areas are computed by 'compute_clips' which is called
|
|
61 |
- * by each blitting function.
|
|
62 |
- *
|
|
63 |
- * Note that we use the Y-downwards convention within the blitter
|
|
64 |
- *
|
|
65 |
- **********************************************************************/
|
|
66 |
- |
|
67 |
- typedef struct grBlitter_
|
|
68 |
- {
|
|
69 |
- int width; /* width in pixels of the areas */
|
|
70 |
- int height; /* height in pixels of the areas */
|
|
71 |
- |
|
72 |
- int xread; /* x position of start point in read area */
|
|
73 |
- int yread; /* y position of start point in read area */
|
|
74 |
- |
|
75 |
- int xwrite; /* x position of start point in write area */
|
|
76 |
- int ywrite; /* y position of start point in write area */
|
|
77 |
- |
|
78 |
- int right_clip; /* amount of right clip */
|
|
79 |
- |
|
80 |
- unsigned char* read; /* top left corner of read area in source map */
|
|
81 |
- unsigned char* write; /* top left corner of write area in target map */
|
|
82 |
- |
|
83 |
- int read_line; /* byte increment to go down one row in read area */
|
|
84 |
- int write_line; /* byte increment to go down one row in write area */
|
|
85 |
- |
|
86 |
- grBitmap source; /* source bitmap descriptor */
|
|
87 |
- grBitmap target; /* target bitmap descriptor */
|
|
88 |
- |
|
89 |
- } grBlitter;
|
|
90 |
- |
|
91 |
- |
|
92 |
- |
|
93 |
- typedef void (*grBlitterFunc)( grBlitter* blitter,
|
|
94 |
- grColor color );
|
|
95 |
- |
|
96 | 26 |
typedef void (*grSetTitleFunc)( grSurface* surface,
|
97 | 27 |
const char* title_string );
|
98 | 28 |
|
... | ... | @@ -142,9 +72,6 @@ |
142 | 72 |
grBool refresh;
|
143 | 73 |
grBool owner;
|
144 | 74 |
|
145 |
- const byte* saturation; /* used for gray surfaces only */
|
|
146 |
- grBlitterFunc blit_mono; /* 0 by default, set by grBlit.. */
|
|
147 |
- |
|
148 | 75 |
grRefreshRectFunc refresh_rect;
|
149 | 76 |
grSetTitleFunc set_title;
|
150 | 77 |
grSetIconFunc set_icon;
|
... | ... | @@ -86,9 +86,7 @@ |
86 | 86 |
#define gr_err_bad_argument -2
|
87 | 87 |
#define gr_err_bad_target_depth -3
|
88 | 88 |
#define gr_err_bad_source_depth -4
|
89 |
-#define gr_err_saturation_overflow -5
|
|
90 |
-#define gr_err_conversion_overflow -6
|
|
91 |
-#define gr_err_invalid_device -7
|
|
89 |
+#define gr_err_invalid_device -5
|
|
92 | 90 |
|
93 | 91 |
|
94 | 92 |
#ifdef GR_MAKE_OPTION_SINGLE_OBJECT
|
... | ... | @@ -165,7 +165,7 @@ |
165 | 165 |
|
166 | 166 |
display->gamma = GAMMA;
|
167 | 167 |
|
168 |
- grSetTargetGamma( display->bitmap, display->gamma );
|
|
168 |
+ grSetTargetGamma( display->surface, display->gamma );
|
|
169 | 169 |
|
170 | 170 |
return display;
|
171 | 171 |
}
|
... | ... | @@ -200,7 +200,7 @@ |
200 | 200 |
display->gamma = 2.2;
|
201 | 201 |
}
|
202 | 202 |
|
203 |
- grSetTargetGamma( display->bitmap, display->gamma );
|
|
203 |
+ grSetTargetGamma( display->surface, display->gamma );
|
|
204 | 204 |
}
|
205 | 205 |
|
206 | 206 |
|
... | ... | @@ -1981,7 +1981,7 @@ |
1981 | 1981 |
FT_Pos y,
|
1982 | 1982 |
grColor color )
|
1983 | 1983 |
{
|
1984 |
- grSurface* surface = (grSurface*)display->surface;
|
|
1984 |
+ grSurface* surface = display->surface;
|
|
1985 | 1985 |
grBitmap* target = display->bitmap;
|
1986 | 1986 |
FT_Outline* outline;
|
1987 | 1987 |
FT_Raster_Params params;
|
... | ... | @@ -1990,7 +1990,7 @@ |
1990 | 1990 |
if ( glyph->format != FT_GLYPH_FORMAT_OUTLINE )
|
1991 | 1991 |
return FT_Err_Ok;
|
1992 | 1992 |
|
1993 |
- grSetTargetPenBrush( target, x, y, color );
|
|
1993 |
+ grSetTargetPenBrush( surface, x, y, color );
|
|
1994 | 1994 |
|
1995 | 1995 |
outline = &((FT_OutlineGlyph)glyph)->outline;
|
1996 | 1996 |
|
... | ... | @@ -991,7 +991,7 @@ |
991 | 991 |
display->bitmap = &surface->bitmap;
|
992 | 992 |
display->gamma = GAMMA;
|
993 | 993 |
|
994 |
- grSetTargetGamma( display->bitmap, display->gamma );
|
|
994 |
+ grSetTargetGamma( display->surface, display->gamma );
|
|
995 | 995 |
|
996 | 996 |
display->fore_color = grFindColor( display->bitmap, 0, 0, 0, 255 );
|
997 | 997 |
display->back_color = grFindColor( display->bitmap, 255, 255, 255, 255 );
|
... | ... | @@ -1079,7 +1079,7 @@ |
1079 | 1079 |
else if ( display->gamma < 0.0001 )
|
1080 | 1080 |
display->gamma = 0.0;
|
1081 | 1081 |
|
1082 |
- grSetTargetGamma( display->bitmap, display->gamma );
|
|
1082 |
+ grSetTargetGamma( display->surface, display->gamma );
|
|
1083 | 1083 |
}
|
1084 | 1084 |
|
1085 | 1085 |
|