00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "mmsgui/fb/mmsfbconv.h"
00034
00035 #ifdef __HAVE_PF_ARGB3565__
00036
00037 #include <cstring>
00038 #include "mmstools/mmstools.h"
00039
00040 void mmsfb_blit_argb3565_to_argb3565(MMSFBSurfacePlanes *src_planes, int src_height, int sx, int sy, int sw, int sh,
00041 MMSFBSurfacePlanes *dst_planes, int dst_height, int dx, int dy) {
00042
00043 static bool firsttime = true;
00044 if (firsttime) {
00045 printf("DISKO: Using accelerated copy ARGB3565 to ARGB3565.\n");
00046 firsttime = false;
00047 }
00048
00049
00050 unsigned short int *src = (unsigned short int *)src_planes->ptr;
00051 int src_pitch = src_planes->pitch;
00052
00053
00054 unsigned char *src_a;
00055 int src_a_pitch;
00056 if (src_planes->ptr2) {
00057
00058 src_a = (unsigned char *)src_planes->ptr2;
00059 src_a_pitch = src_planes->pitch2;
00060 }
00061 else {
00062
00063 src_a = ((unsigned char *)src_planes->ptr) + src_planes->pitch * src_height;
00064 src_a_pitch = src_planes->pitch / 4;
00065 }
00066
00067
00068 unsigned short int *dst = (unsigned short int *)dst_planes->ptr;
00069 int dst_pitch = dst_planes->pitch;
00070
00071
00072 unsigned char *dst_a;
00073 int dst_a_pitch;
00074 if (dst_planes->ptr2) {
00075
00076 dst_a = (unsigned char *)dst_planes->ptr2;
00077 dst_a_pitch = dst_planes->pitch2;
00078 }
00079 else {
00080
00081 dst_a = ((unsigned char *)dst_planes->ptr) + dst_planes->pitch * dst_height;
00082 dst_a_pitch = dst_planes->pitch / 4;
00083 }
00084
00085
00086
00087 int src_pitch_pix = src_pitch >> 1;
00088 int dst_pitch_pix = dst_pitch >> 1;
00089 src+= sx + sy * src_pitch_pix;
00090 dst+= dx + dy * dst_pitch_pix;
00091
00092
00093 if (dst_pitch_pix - dx < sw - sx)
00094 sw = dst_pitch_pix - dx - sx;
00095 if (dst_height - dy < sh - sy)
00096 sh = dst_height - dy - sy;
00097 if ((sw <= 0)||(sh <= 0))
00098 return;
00099
00100 unsigned short int *src_end = src + src_pitch_pix * sh;
00101
00102
00103 while (src < src_end) {
00104
00105 memcpy(dst, src, sw << 1);
00106
00107
00108 src+= src_pitch_pix;
00109 dst+= dst_pitch_pix;
00110 }
00111
00112
00113
00114
00115 src_a+= (sx >> 1) + sy * src_a_pitch;
00116 dst_a+= (dx >> 1) + dy * dst_a_pitch;
00117
00118
00119 bool odd_left = (dx & 0x01);
00120 bool odd_right = ((dx + sw) & 0x01);
00121
00122
00123
00124
00125
00126
00127 if (odd_left) {
00128
00129 dx++;
00130 sw--;
00131 src_a++;
00132 dst_a++;
00133 }
00134
00135 if (odd_right) {
00136
00137 sw--;
00138 }
00139
00140
00141
00142 src_end = (unsigned short int *)(src_a + src_a_pitch * sh);
00143
00144
00145 while (src_a < (unsigned char *)src_end) {
00146
00147 memcpy(dst_a, src_a, sw >> 1);
00148
00149
00150 src_a+= src_a_pitch;
00151 dst_a+= dst_a_pitch;
00152 }
00153 }
00154
00155 #endif