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: (%d, %d) -- (%d, %d); %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: (%d, %d) -- (%d, %d); %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 FT_TRACE5((
" final bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
967 final_llx / 64, final_lly / 64,
968 final_urx / 64, final_ury / 64,
969 final_width, final_rows ));
970#endif
971
972
973
974 source_llx -= final_llx;
975 source_lly -= final_lly;
976
978 {
979 target_llx -= final_llx;
980 target_lly -= final_lly;
981 }
982
983
985 {
986
987 target->width = final_width;
988 target->rows = final_rows;
992
994 {
995 FT_TRACE5((
"FT_Blend_Bitmap: target bitmap too large (%d x %d)\n",
996 final_width, final_rows ));
997 return FT_THROW( Invalid_Argument );
998 }
999
1002
1003 free_target_bitmap_on_error = 1;
1004 }
1005 else if (
target->width != final_width ||
1006 target->rows != final_rows )
1007 {
1008
1009 int pitch, new_pitch;
1010
1012
1013
1015 if ( pitch < 0 )
1016 pitch = -pitch;
1017
1018 new_pitch = (
int)final_width * 4;
1019
1021 {
1022 FT_TRACE5((
"FT_Blend_Bitmap: target bitmap too large (%d x %d)\n",
1023 final_width, final_rows ));
1024 return FT_THROW( Invalid_Argument );
1025 }
1026
1027
1028
1031
1032
1033 x = target_llx >> 6;
1034 y = target_lly >> 6;
1035
1036
1037
1039 {
1040
1041 }
1042 else
1043 {
1048 ( final_rows -
y -
target->rows ) * new_pitch +
1050 unsigned char* limit_p =
1052
1053
1055 {
1057
1060 }
1061 }
1062
1064
1065 target->width = final_width;
1066 target->rows = final_rows;
1067
1069 target->pitch = -new_pitch;
1070 else
1071 target->pitch = new_pitch;
1072
1074 }
1075
1076
1078 {
1083
1085 free_source_bitmap = 1;
1086 }
1087 else
1089
1090
1091
1092 x = source_llx >> 6;
1093 y = source_lly >> 6;
1094
1095
1096
1098 {
1099
1100 }
1101 else
1102 {
1109 unsigned char* limit_p =
1111
1112
1113 while (
p < limit_p )
1114 {
1115 unsigned char*
r =
p;
1116 unsigned char*
s =
q;
1117 unsigned char* limit_r =
r +
source->width;
1118
1119
1120 while (
r < limit_r )
1121 {
1123 int fa =
color.alpha * aa / 255;
1124
1125 int fb =
color.blue *
fa / 255;
1126 int fg =
color.green *
fa / 255;
1127 int fr =
color.red *
fa / 255;
1128
1130
1135
1136
1137 *
s++ = (
unsigned char)( bb * ba2 / 255 + fb );
1138 *
s++ = (
unsigned char)( bg * ba2 / 255 + fg );
1139 *
s++ = (
unsigned char)( br * ba2 / 255 + fr );
1140 *
s++ = (
unsigned char)( ba * ba2 / 255 +
fa );
1141 }
1142
1145 }
1146 }
1147
1148 atarget_offset->
x = final_llx;
1149 atarget_offset->
y = final_lly + ( final_rows << 6 );
1150
1152 if (
error && free_target_bitmap_on_error )
1154
1155 if ( free_source_bitmap )
1157
1159 }
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]