846 {
849
852
855
856 FT_Bool free_source_bitmap = 0;
857 FT_Bool free_target_bitmap_on_error = 0;
858
859 FT_Pos source_llx, source_lly, source_urx, source_ury;
860 FT_Pos target_llx, target_lly, target_urx, target_ury;
861 FT_Pos final_llx, final_lly, final_urx, final_ury;
862
863 unsigned int final_rows, final_width;
865
866
868 return FT_THROW( Invalid_Argument );
869
871
875 return FT_THROW( Invalid_Argument );
876
879
880
882 ( source_->pitch ^
target->pitch ) < 0 )
883 return FT_THROW( Invalid_Argument );
884
885 if ( !( source_->width && source_->rows ) )
887
888
893
894
895 source_llx = source_offset.
x;
897 {
899 "FT_Bitmap_Blend: y coordinate overflow in source bitmap\n" ));
900 return FT_THROW( Invalid_Argument );
901 }
902 source_lly = source_offset.
y - ( source_->rows << 6 );
903
905 {
907 "FT_Bitmap_Blend: x coordinate overflow in source bitmap\n" ));
908 return FT_THROW( Invalid_Argument );
909 }
910 source_urx = source_llx + ( source_->width << 6 );
911 source_ury = source_offset.
y;
912
913
915 {
916 target_llx = target_offset.
x;
918 {
920 "FT_Bitmap_Blend: y coordinate overflow in target bitmap\n" ));
921 return FT_THROW( Invalid_Argument );
922 }
923 target_lly = target_offset.
y - (
target->rows << 6 );
924
926 {
928 "FT_Bitmap_Blend: x coordinate overflow in target bitmap\n" ));
929 return FT_THROW( Invalid_Argument );
930 }
931 target_urx = target_llx + (
target->width << 6 );
932 target_ury = target_offset.
y;
933 }
934 else
935 {
940 }
941
942
943 final_llx =
FT_MIN( source_llx, target_llx );
944 final_lly =
FT_MIN( source_lly, target_lly );
945 final_urx =
FT_MAX( source_urx, target_urx );
946 final_ury =
FT_MAX( source_ury, target_ury );
947
948 final_width = ( final_urx - final_llx ) >> 6;
949 final_rows = ( final_ury - final_lly ) >> 6;
950
951#ifdef FT_DEBUG_LEVEL_TRACE
953 " source bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
954 source_llx / 64, source_lly / 64,
955 source_urx / 64, source_ury / 64,
956 source_->width, source_->rows ));
957
959 FT_TRACE5((
" target bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
960 target_llx / 64, target_lly / 64,
961 target_urx / 64, target_ury / 64,
963 else
964 FT_TRACE5((
" target bitmap: empty\n" ));
965
966 if ( final_width && final_rows )
967 FT_TRACE5((
" final bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
968 final_llx / 64, final_lly / 64,
969 final_urx / 64, final_ury / 64,
970 final_width, final_rows ));
971 else
973#endif
974
975 if ( !( final_width && final_rows ) )
977
978
979
980 source_llx -= final_llx;
981 source_lly -= final_lly;
982
984 {
985 target_llx -= final_llx;
986 target_lly -= final_lly;
987 }
988
989
991 {
992
993 target->width = final_width;
994 target->rows = final_rows;
998
1000 {
1001 FT_TRACE5((
"FT_Blend_Bitmap: target bitmap too large (%d x %d)\n",
1002 final_width, final_rows ));
1003 return FT_THROW( Invalid_Argument );
1004 }
1005
1008
1009 free_target_bitmap_on_error = 1;
1010 }
1011 else if (
target->width != final_width ||
1012 target->rows != final_rows )
1013 {
1014
1015 int pitch, new_pitch;
1016
1018
1019
1021
1022 if ( pitch < 0 )
1023 pitch = -pitch;
1024
1025 new_pitch = (
int)final_width * 4;
1026
1028 {
1029 FT_TRACE5((
"FT_Blend_Bitmap: target bitmap too large (%d x %d)\n",
1030 final_width, final_rows ));
1031 return FT_THROW( Invalid_Argument );
1032 }
1033
1034
1035
1038
1039
1040 x = target_llx >> 6;
1041 y = target_lly >> 6;
1042
1043
1044
1046 {
1047
1048 }
1049 else
1050 {
1055 ( final_rows -
y -
target->rows ) * new_pitch +
1057 unsigned char* limit_p =
1059
1060
1062 {
1064
1067 }
1068 }
1069
1071
1072 target->width = final_width;
1073 target->rows = final_rows;
1074
1076 target->pitch = -new_pitch;
1077 else
1078 target->pitch = new_pitch;
1079
1081 }
1082
1083
1085 {
1090
1092 free_source_bitmap = 1;
1093 }
1094 else
1096
1097
1098
1099 x = source_llx >> 6;
1100 y = source_lly >> 6;
1101
1102
1103
1105 {
1106
1107 }
1108 else
1109 {
1116 unsigned char* limit_p =
1118
1119
1120 while (
p < limit_p )
1121 {
1122 unsigned char*
r =
p;
1123 unsigned char*
s =
q;
1124 unsigned char* limit_r =
r +
source->width;
1125
1126
1127 while (
r < limit_r )
1128 {
1130 int fa =
color.alpha * aa / 255;
1131
1132 int fb =
color.blue *
fa / 255;
1133 int fg =
color.green *
fa / 255;
1134 int fr =
color.red *
fa / 255;
1135
1137
1142
1143
1144 *
s++ = (
unsigned char)( bb * ba2 / 255 + fb );
1145 *
s++ = (
unsigned char)( bg * ba2 / 255 + fg );
1146 *
s++ = (
unsigned char)( br * ba2 / 255 + fr );
1147 *
s++ = (
unsigned char)( ba * ba2 / 255 +
fa );
1148 }
1149
1152 }
1153 }
1154
1155 atarget_offset->
x = final_llx;
1156 atarget_offset->
y = final_lly + ( final_rows << 6 );
1157
1159 if (
error && free_target_bitmap_on_error )
1161
1162 if ( free_source_bitmap )
1164
1166 }
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
FT_Bitmap_Convert(FT_Library library, const FT_Bitmap *source, FT_Bitmap *target, FT_Int alignment)
FT_Bitmap_Done(FT_Library library, FT_Bitmap *bitmap)
FT_Bitmap_Init(FT_Bitmap *abitmap)
#define FT_TRACE5(varformat)
FT_BEGIN_HEADER typedef signed long FT_Pos
#define FT_ALLOC(ptr, size)
#define FT_MEM_COPY(dest, source, count)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLdouble GLdouble GLdouble r
GLdouble GLdouble GLdouble GLdouble q
static char memory[1024 *256]