📄 r2d_vertical_lcd_i.c
字号:
//printf("dst start %08X contains %08X\n",p_dst_start,*p_dst_start);
if (v_direction==-1)
{
p_src_start+=src_nb_rows-1;
p_dst_start+=dst_nb_rows-1;
temp=src_dy;
src_dy=end_src_dy;
end_src_dy=temp;
temp=dst_dy;
dst_dy=end_dst_dy;
end_dst_dy=temp;
}
//printf("src start %08X contains %08X\n",p_src_start,*p_src_start);
//printf("dst start %08X contains %08X\n",p_dst_start,*p_dst_start);
//printf("dst_start=%08X contains %08X\n",p_dst_start,*p_dst_start);
while(xnb!=0)
{
p_dst_current=p_dst_start;
p_src_current=p_src_start;
//printf("xnb=%d\n",xnb);
//printf("src start %08X contains %08X\n",p_src_start,*p_src_start);
//printf("dst start %08X contains %08X\n",p_dst_start,*p_dst_start);
ynb=dst_nb_rows-1;
if (v_direction==-1)
{
y=r2d_get_ymax(dst_rectangle) - 1;
current_src_dy=(1<<R2D_PIXELS_PER_MEMORY_WORD)-1;
current_dst_dy=(1<<R2D_PIXELS_PER_MEMORY_WORD)-1;
}
else
{
current_src_dy=0;
current_dst_dy=0;
y=r2d_get_ymin(dst_rectangle);
}
dstcounter=(1<<R2D_PIXELS_PER_MEMORY_WORD);
srccounter=(1<<R2D_PIXELS_PER_MEMORY_WORD);
dst_current=*p_dst_current;
src_current=*p_src_current;
//printf("src_current=%08X, dst_current=%08X\n",src_current,dst_current);
temp=0;
//printf("new column\n dst=%08X\n",p_dst_current);
//printf("current_dst_dy =%d, dst_dy=%d\n",current_dst_dy,dst_dy);
dstvalue=0;
if (v_direction==-1)
{
while(current_dst_dy!=dst_dy)
{
r2d_shift_pixel_up(dstvalue,dst_current,dstcounter,p_dst_current);
current_dst_dy--;
//printf("dstcounter=%d\n",dstcounter);
y--;
}
while(current_src_dy!=src_dy)
{
//printf("current_src_dy=%d\n",current_src_dy);
//printf("srccounter=%d\n",srccounter);
r2d_shift_pixel_up(temp,src_current,srccounter,p_src_current);
current_src_dy--;
//printf("src_current=%08X\n",src_current);
}
while(ynb!=0)
{
r2d_shift_pixel_up_and_write(dst,src);
//printf("srccounter=%d\n",srccounter);
y--;
if (dstcounter==(1<<R2D_PIXELS_PER_MEMORY_WORD))
{
ynb--;
*p_dst_current--=dstvalue;
#if (R2D_DEBUG == R2D_ON)
#if (R2D_DEBUG_WARNING == R2D_DEBUG_HIGH)
if ((p_dst_current<((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer))->p_memory_words)
|| (p_dst_current>((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer))->p_frame_buffer_end))
{
//printf("Error : frame_buffer overflow\n");
IND_rvf_send_trace("R2D : Framebuffer overflow1",27, NULL_PARAM,
RV_TRACE_LEVEL_ERROR, R2D_USE_ID );
}
#endif
#endif
current_dst_dy=(1<<R2D_PIXELS_PER_MEMORY_WORD)-1;
dst_current=*p_dst_current;
//printf("%08X <- %08X\n",p_dst_current,dstvalue);
dstvalue=0;
}
}
current_dst_dy++;
while(current_dst_dy!=end_dst_dy)
{
r2d_shift_pixel_up_and_write(dst,src);
current_dst_dy--;
//printf("Last row %08X, %08X\n",p_dst_current,current_dst_dy);
y--;
}
if (dstcounter==(1<<R2D_PIXELS_PER_MEMORY_WORD))
compensate=FALSE;
while(dstcounter!=(1<<R2D_PIXELS_PER_MEMORY_WORD))
{
r2d_shift_pixel_up(dstvalue,dst_current,dstcounter,p_dst_current);
current_dst_dy--;
//printf(" Last row %08X\n",p_src_current);
//printf("dstcounter=%d\n",dstcounter);
y--;
}
if (compensate==TRUE)
{
*++p_dst_current=dstvalue;
}
else
{
*p_dst_current=dstvalue;
}
#if (R2D_DEBUG == R2D_ON)
#if (R2D_DEBUG_WARNING == R2D_DEBUG_HIGH)
if ((p_dst_current<((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer))->p_memory_words)
|| (p_dst_current>((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer))->p_frame_buffer_end))
{
//printf("Error : frame_buffer overflow\n");
IND_rvf_send_trace("R2D : Framebuffer overflow2",27, NULL_PARAM,
RV_TRACE_LEVEL_ERROR, R2D_USE_ID );
}
#endif
#endif
}
else
{
while(current_dst_dy!=dst_dy)
{
r2d_shift_pixel_down(dstvalue,dst_current,dstcounter,p_dst_current);
current_dst_dy++;
y++;
//printf("dstcounter=%d\n",dstcounter);
}
while(current_src_dy!=src_dy)
{
r2d_shift_pixel_down(temp,src_current,srccounter,p_src_current);
current_src_dy++;
}
while(ynb!=0)
{
r2d_shift_pixel_down_and_write(dst,src);
y++;
if (dstcounter==(1<<R2D_PIXELS_PER_MEMORY_WORD))
{
ynb--;
*p_dst_current++=dstvalue;
#if (R2D_DEBUG == R2D_ON)
#if (R2D_DEBUG_WARNING == R2D_DEBUG_HIGH)
if ((p_dst_current<((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer))->p_memory_words)
|| (p_dst_current>((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer))->p_frame_buffer_end))
{
char error[256];
T_R2D_RECT *dst;
//dst=(T_R2D_RECT*)dst_rectangle;
//sprintf(error,"%d %d %d %d",dst->ul_x,dst->ul_y,
// dst->br_x,dst->br_y);
//IND_rvf_send_trace(error,strlen(error), NULL_PARAM,
// RV_TRACE_LEVEL_ERROR, R2D_USE_ID );
//printf("Error : frame_buffer overflow\n");
IND_rvf_send_trace("R2D : Framebuffer overflow3",27, NULL_PARAM,
RV_TRACE_LEVEL_ERROR, R2D_USE_ID );
}
#endif
#endif
current_dst_dy=0;
dst_current=*p_dst_current;
//printf("%08X <- %08X\n",p_dst_current,dstvalue);
dstvalue=0;
}
}
current_dst_dy--;
while(current_dst_dy!=end_dst_dy)
{
r2d_shift_pixel_down_and_write(dst,src);
current_dst_dy++;
//printf("Last row %08X\n",p_dst_current);
y++;
}
if (dstcounter==(1<<R2D_PIXELS_PER_MEMORY_WORD))
compensate=FALSE;
while(dstcounter!=(1<<R2D_PIXELS_PER_MEMORY_WORD))
{
r2d_shift_pixel_down(dstvalue,dst_current,dstcounter,p_dst_current);
current_dst_dy++;
//printf("Last row %08X\n",p_dst_current);
y++;
}
if (compensate==TRUE)
{
*--p_dst_current=dstvalue;
}
else
{
*p_dst_current=dstvalue;
}
#if (R2D_DEBUG == R2D_ON)
#if (R2D_DEBUG_WARNING == R2D_DEBUG_HIGH)
if ((p_dst_current<((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer))->p_memory_words)
|| (p_dst_current>((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer))->p_frame_buffer_end))
{
//printf("Error : frame_buffer overflow\n");
IND_rvf_send_trace("R2D : Framebuffer overflow4",27, NULL_PARAM,
RV_TRACE_LEVEL_ERROR, R2D_USE_ID );
}
#endif
#endif
}
dstvalue=0;
if (h_direction==-1)
{
p_src_start-=src_offset;
p_dst_start-=dst_offset;
x--;
}
else
{
p_src_start+=src_offset;
p_dst_start+=dst_offset;
x++;
}
xnb--;
}
}
end_blit: dstvalue=0;
}
#undef r2d_shift_pixel_down_and_write
#undef r2d_shift_pixel_up_and_write
#define r2d_shift_pixel_down_and_write(dst,src) {\
dst##value =R2D_PIXEL_DOWN_OUT(dst##value); \
dst##value|=dop((dst##_current & R2D_PIXEL_MASK), \
r2d_convert_from_color_to_color(use_foreground_color,\
src##_current & R2D_PIXEL_MASK,src_gc,dst_gc,x,y)) \
<< ((1<<R2D_MEMORY_WORD) - R2D_PIXEL_DEPTH) ; \
src##_current=R2D_PIXEL_DOWN_OUT(src##_current); \
dst##_current=R2D_PIXEL_DOWN_OUT(dst##_current); \
dst##counter--; \
src##counter--; \
if (src##counter==0) \
{ \
src##counter=(1<<R2D_PIXELS_PER_MEMORY_WORD); \
src##_current=*++p_##src##_current; \
} \
if (dst##counter==0) \
{ \
dst##counter=(1<<R2D_PIXELS_PER_MEMORY_WORD); \
} \
}
#define r2d_shift_pixel_up_and_write(dst,src) {\
dst##value =R2D_PIXEL_UP_OUT(dst##value); \
dst##value |=dop( \
(dst##_current >> ((1<<R2D_MEMORY_WORD) - R2D_PIXEL_DEPTH)) & R2D_PIXEL_MASK, \
r2d_convert_from_color_to_color(use_foreground_color,\
(src##_current >> ((1<<R2D_MEMORY_WORD) - R2D_PIXEL_DEPTH)) & R2D_PIXEL_MASK, \
src_gc,dst_gc,x,y)); \
src##_current=R2D_PIXEL_UP_OUT(src##_current); \
dst##_current=R2D_PIXEL_UP_OUT(dst##_current); \
dst##counter--; \
src##counter--; \
if (src##counter==0) \
{ \
src##counter=(1<<R2D_PIXELS_PER_MEMORY_WORD); \
src##_current=*--p_##src##_current; \
} \
if (dst##counter==0) \
{ \
dst##counter=(1<<R2D_PIXELS_PER_MEMORY_WORD); \
} \
}
// Requires shapes in graphic context coordinates
void r2d_blit_color_to_color(T_R2D_GC_PTR src_gc,T_R2D_GC_PTR dst_gc,
T_R2D_SHAPE_PTR src_rectangle,
T_R2D_SHAPE_PTR dst_rectangle,
R2D_BOOLEAN use_foreground_color)
{
UINT32 *p_src,*p_dst,*p_src_current,*p_dst_current,*p_src_start,*p_dst_start,value;
INT16 rect_width,rect_height,src_x,src_y,dst_x,dst_y;
INT16 src_offset,dst_offset,src_height,dst_height;
INT16 xnb,ynb,nb_rows;
INT16 x,y;//,temp;
INT32 h_direction,v_direction;
T_R2D_DRAWING_MODE mode;
T_R2D_DRAWING_OP dop;
dop=((T_R2D_GC*)dst_gc)->drawing_op;
{
p_src=((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)src_gc)->p_frame_buffer))->p_memory_words;
p_dst=((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer))->p_memory_words;
rect_width=r2d_get_xmax(src_rectangle)-r2d_get_xmin(src_rectangle);
rect_height=r2d_get_ymax(src_rectangle)-r2d_get_ymin(src_rectangle);
if ((rect_width<=0) || (rect_height<=0))
goto end_blit_c;
mode=IND_r2d_get_drawing_mode(dst_gc);
src_x=r2d_get_xmin(src_rectangle);
src_y=r2d_get_ymin(src_rectangle);
dst_x=r2d_get_xmin(dst_rectangle);
dst_y=r2d_get_ymin(dst_rectangle);
// Number of rows is word containing last point - word containing first point
// + 1
nb_rows=(r2d_get_ymax(dst_rectangle)-1)-(dst_y)+1;
//printf("nb_rows %d\n",nb_rows);
h_direction=1;
v_direction=1;
if (((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)src_gc)->p_frame_buffer))==
((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer)))
r2d_check_rectangle_overlap(src_x,src_y,dst_x,dst_y,
rect_width,rect_height,&h_direction,&v_direction);
//printf("h,v=%d,%d\n",h_direction,v_direction);
#if (R2D_REFRESH == R2D_VERTICAL)
src_height=((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)src_gc)->p_frame_buffer))->height;
dst_height=((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer))->height;
#else
src_height=((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)src_gc)->p_frame_buffer))->width;
dst_height=((T_R2D_FRAMEBUFFER*)(((T_R2D_GC*)dst_gc)->p_frame_buffer))->width;
#endif
src_offset=(src_height);
dst_offset=(dst_height);
//printf("%08X,dst offset=%08X\n",p_dst,dst_offset);
p_src_start=p_src
+((src_x*src_offset+(src_y)));
p_dst_start=p_dst
+((dst_x*dst_offset+(dst_y)));
xnb=rect_width;
//printf("start %08X contains %08X\n",p_dst_start,*p_dst_start);
if (h_direction==-1)
{
x=r2d_get_xmax(dst_rectangle)-1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -