?? r2d_vertical_lcd_i.c
字號:
#if (R2D_PIXEL_DEPTH == 32)
#define R2D_PIXEL_DOWN_OUT(a) (0)
#define R2D_PIXEL_UP_OUT(a) (0)
#else
#define R2D_PIXEL_DOWN_OUT(a) (a>>R2D_PIXEL_DEPTH)
#define R2D_PIXEL_UP_OUT(a) (a<<R2D_PIXEL_DEPTH)
#endif
#if (R2D_ASM == R2D_ON)
// All below global are modified in the context of a blit_rect and
// the use of the self modifying blit_rect is protected by
// a semaphore
extern T_R2D_DRAWING_MODE r2d_g_old_mode;
extern R2D_BOOLEAN r2d_g_old_use_foreground;
extern INT32 r2d_g_old_srcdst;
extern UINT32 r2d_g_old_foreground_pixelvalue;
extern UINT32 r2d_g_old_background_pixelvalue;
extern void r2d_blit_la(UINT32 *a);
extern void r2d_blit_lb(UINT32 *a);
#endif
extern BOOLEAN IND_r2d_color_framebuffer_foreground_pixel(UINT32 lcd_value,T_R2D_GC_PTR src_gc);
#define r2d_get_texture_color() ((T_R2D_ANCHORED_TEXTURE*)(gc->background_texture))->pattern[((x-gc->s_org_x)&texture_mask)*texture_size+((ty-gc->s_org_y)&texture_mask)]
void r2d_write_lcd_line(T_R2D_GC* gc,INT16 x,INT16 y,INT16 nb,R2D_BOOLEAN background)
{
UINT32 *p;
UINT16 tmp,ty;
// UINT32 temp;
UINT32 pixel_cache,pixel_value;
INT16 current_y,count;
UINT32 new_value,current_value;
T_R2D_DRAWING_OP dop;
INT16 texture_mask,texture_size;
ty=y; // True y
if (gc->background_texture!=NULL)
{
texture_mask=~((-1)<<gc->background_texture->size);
texture_size=1<<gc->background_texture->size;
}
dop=gc->drawing_op;
if (nb==0)
goto r2d_fail_line;
p=((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->p_memory_words;
switch(((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->kind)
{
case 0:// LCD format with hard coded dimensions
{
// Get position of the memory word containing the pixel
#if (R2D_REFRESH == R2D_VERTICAL)
p+=((x*R2D_MWHEIGHT+(y>>R2D_PIXELS_PER_MEMORY_WORD)));
#else
p+=((x*R2D_MWWIDTH+(y>>R2D_PIXELS_PER_MEMORY_WORD)));
#endif
if ((y<0) || (x<0) || ((p<((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->p_memory_words)
|| (p>((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->p_frame_buffer_end)))
{
#if (R2D_DEBUG == R2D_ON)
//printf("Error : frame_buffer overflow\n");
IND_rvf_send_trace("R2D : Framebuffer overflow",26, NULL_PARAM,
RV_TRACE_LEVEL_ERROR, R2D_USE_ID );
#endif
goto r2d_fail_line;
}
// Get the pixel position into the memory word
new_value=0;
y=y & R2D_WORD_POSITION_MASK;
y=y << R2D_PIXEL_POS_TO_BIT_POS;
pixel_cache=*p;
current_y=0;
current_value=pixel_cache;
if (y!=0)
{
do
{
new_value =R2D_PIXEL_DOWN_OUT(new_value);
new_value|=((current_value & R2D_PIXEL_MASK)
<< ((1<<R2D_MEMORY_WORD) - R2D_PIXEL_DEPTH)) ;
current_value=R2D_PIXEL_DOWN_OUT(current_value);
current_y+=(1<<R2D_PIXEL_POS_TO_BIT_POS);
} while (current_y != y);
}
count=0;
#if (R2D_DITHERING == R2D_OFF)
if (background)
pixel_value=((T_R2D_GC*)gc)->background_pixel_value;
else
pixel_value=((T_R2D_GC*)gc)->foreground_pixel_value;
#endif
do
{
#if (R2D_DITHERING == R2D_ON)
if (background)
{
if (gc->background_texture!=NULL)
pixel_value=r2d_get_texture_color();
else
pixel_value=r2d_get_dithering_matrix_entry(((T_R2D_GC*)gc)->p_background_dithered_cache,x,ty);
}
else
pixel_value=r2d_get_dithering_matrix_entry(((T_R2D_GC*)gc)->p_foreground_dithered_cache,x,ty);
#endif
#if (R2D_DITHERING == R2D_OFF)
if ((background) && (gc->background_texture!=NULL))
pixel_value=r2d_get_texture_color();
#endif
ty++;
new_value =R2D_PIXEL_DOWN_OUT(new_value);
new_value|=((dop(current_value & R2D_PIXEL_MASK,pixel_value) & R2D_PIXEL_MASK)
<< ((1<<R2D_MEMORY_WORD) - R2D_PIXEL_DEPTH)) ;
current_value=R2D_PIXEL_DOWN_OUT(current_value);
current_y+=(1<<R2D_PIXEL_POS_TO_BIT_POS);
if (current_y==(1<<R2D_MEMORY_WORD))
{
current_y=0;
*p++=new_value;
current_value=*p;
}
count++;
} while (count<nb);
while(current_y != (1<<R2D_MEMORY_WORD))
{
new_value =R2D_PIXEL_DOWN_OUT(new_value) ;
new_value|=((current_value & R2D_PIXEL_MASK)
<< ((1<<R2D_MEMORY_WORD) - R2D_PIXEL_DEPTH)) ;
current_value=R2D_PIXEL_DOWN_OUT(current_value);
current_y+=(1<<R2D_PIXEL_POS_TO_BIT_POS);
}
*p++=new_value;
}
break;
case R2D_LCD_KIND: // LCD format with any size
{
INT16 height,width;
height=((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->height;
width=((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->width;
// Get position of the memory word containing the pixel
#if (R2D_REFRESH == R2D_VERTICAL)
p+=((x*R2D_ALIGNED_MWLENGTH(height)+(y>>R2D_PIXELS_PER_MEMORY_WORD)));
#else
p+=((x*R2D_ALIGNED_MWLENGTH(width)+(y>>R2D_PIXELS_PER_MEMORY_WORD)));
#endif
if ((y<0) || (x<0) || ((p<((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->p_memory_words)
|| (p>((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->p_frame_buffer_end)))
{
#if (R2D_DEBUG == R2D_ON)
IND_rvf_send_trace("R2D : Framebuffer overflow",26, NULL_PARAM,
RV_TRACE_LEVEL_ERROR, R2D_USE_ID );
#endif
goto r2d_fail_line;
}
// Get the pixel position into the memory word
new_value=0;
y=y & R2D_WORD_POSITION_MASK;
y=y << R2D_PIXEL_POS_TO_BIT_POS;
pixel_cache=*p;
current_y=0;
current_value=pixel_cache;
if (y!=0)
{
do
{
new_value =R2D_PIXEL_DOWN_OUT(new_value) ;
new_value|=((current_value & R2D_PIXEL_MASK)
<< ((1<<R2D_MEMORY_WORD) - R2D_PIXEL_DEPTH)) ;
current_value=R2D_PIXEL_DOWN_OUT(current_value);
current_y+=(1<<R2D_PIXEL_POS_TO_BIT_POS);
} while (current_y != y);
}
count=0;
#if (R2D_DITHERING == R2D_OFF)
if (background)
pixel_value=((T_R2D_GC*)gc)->background_pixel_value;
else
pixel_value=((T_R2D_GC*)gc)->foreground_pixel_value;
#endif
do
{
#if (R2D_DITHERING == R2D_ON)
if (background)
if (gc->background_texture!=NULL)
pixel_value=r2d_get_texture_color();
else
pixel_value=r2d_get_dithering_matrix_entry(((T_R2D_GC*)gc)->p_background_dithered_cache,x,ty);
else
pixel_value=r2d_get_dithering_matrix_entry(((T_R2D_GC*)gc)->p_foreground_dithered_cache,x,ty);
#endif
#if (R2D_DITHERING == R2D_OFF)
if ((background) && (gc->background_texture!=NULL))
pixel_value=r2d_get_texture_color();
#endif
ty++;
new_value =R2D_PIXEL_DOWN_OUT(new_value);
new_value|=((dop(current_value & R2D_PIXEL_MASK,pixel_value) & R2D_PIXEL_MASK)
<< ((1<<R2D_MEMORY_WORD) - R2D_PIXEL_DEPTH)) ;
current_value=R2D_PIXEL_DOWN_OUT(current_value);
current_y+=(1<<R2D_PIXEL_POS_TO_BIT_POS);
if (current_y==(1<<R2D_MEMORY_WORD))
{
current_y=0;
*p++=new_value;
current_value=*p;
}
count++;
} while (count<nb);
while(current_y != (1<<R2D_MEMORY_WORD))
{
new_value =R2D_PIXEL_DOWN_OUT(new_value);
new_value|=((current_value & R2D_PIXEL_MASK)
<< ((1<<R2D_MEMORY_WORD) - R2D_PIXEL_DEPTH)) ;
current_value=R2D_PIXEL_DOWN_OUT(current_value);
current_y+=(1<<R2D_PIXEL_POS_TO_BIT_POS);
}
*p++=new_value;
}
break;
case R2D_FULL_KIND: // LCD format with any size
{
INT16 height,width;
height=((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->height;
width=((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->width;
// Get position of the memory word containing the pixel
#if (R2D_REFRESH == R2D_VERTICAL)
p+=((x*height+y));
#else
p+=((x*width+y));
#endif
if ((y<0) || (x<0) || ((p<((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->p_memory_words)
|| (p>((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->p_frame_buffer_end)))
{
#if (R2D_DEBUG == R2D_ON)
IND_rvf_send_trace("R2D : Framebuffer overflow",26, NULL_PARAM,
RV_TRACE_LEVEL_ERROR, R2D_USE_ID );
#endif
goto r2d_fail_line;
}
// Get the pixel position into the memory word
y=0;
new_value=0;
pixel_cache=*p;
current_y=0;
current_value=pixel_cache;
count=0;
if (background)
{
pixel_value=((T_R2D_GC*)gc)->background_pixel_value;
}
else
{
pixel_value=((T_R2D_GC*)gc)->foreground_pixel_value;
}
do
{
if ((background) && (gc->background_texture!=NULL))
pixel_value=r2d_get_texture_color();
ty++;
new_value=dop(current_value,pixel_value);
current_y=0;
*p++=new_value;
current_value=*p;
count++;
} while (count<nb);
}
break;
}
r2d_fail_line:tmp=0; // Just because one needs code after a label
}
void r2d_arc_write_lcd_line(T_R2D_GC* gc,INT16 x,INT16 y,
INT16 org_x,INT16 org_y,INT16 nb,
T_R2D_ARC_REGION *rgn,R2D_BOOLEAN background)
{
UINT32 *p;
UINT16 tmp,ty;
// UINT32 temp;
UINT32 pixel_cache,pixel_value;
INT32 current_y,count;
UINT32 new_value,current_value;
T_R2D_DRAWING_OP dop;
INT16 texture_mask,texture_size;
INT32 sides,sidee;
BOOLEAN start_filling=FALSE;
sides=r2d_get_point_side((INT16)(x-org_x),(INT16)(y-org_y),rgn->sa,rgn->sb);
sidee=r2d_get_point_side((INT16)(x-org_x),(INT16)(y-org_y),rgn->ea,rgn->eb);
ty=y; // True y
if (gc->background_texture!=NULL)
{
texture_mask=~((-1)<<gc->background_texture->size);
texture_size=1<<gc->background_texture->size;
}
dop=gc->drawing_op;
if (nb==0)
goto r2d_fail_line;
p=((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->p_memory_words;
switch(((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->kind)
{
case 0:// LCD format with hard coded dimensions
{
// Get position of the memory word containing the pixel
#if (R2D_REFRESH == R2D_VERTICAL)
p+=((x*R2D_MWHEIGHT+(y>>R2D_PIXELS_PER_MEMORY_WORD)));
#else
p+=((x*R2D_MWWIDTH+(y>>R2D_PIXELS_PER_MEMORY_WORD)));
#endif
if ((y<0) || (x<0) || ((p<((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->p_memory_words)
|| (p>((T_R2D_FRAMEBUFFER*)(gc->p_frame_buffer))->p_frame_buffer_end)))
{
#if (R2D_DEBUG == R2D_ON)
//printf("Error : frame_buffer overflow\n");
IND_rvf_send_trace("R2D : Framebuffer overflow",26, NULL_PARAM,
RV_TRACE_LEVEL_ERROR, R2D_USE_ID );
#endif
goto r2d_fail_line;
}
// Get the pixel position into the memory word
new_value=0;
y=y & R2D_WORD_POSITION_MASK;
y=y << R2D_PIXEL_POS_TO_BIT_POS;
pixel_cache=*p;
current_y=0;
current_value=pixel_cache;
if (y!=0)
{
do
{
new_value =R2D_PIXEL_DOWN_OUT(new_value);
new_value|=((current_value & R2D_PIXEL_MASK)
<< ((1<<R2D_MEMORY_WORD) - R2D_PIXEL_DEPTH)) ;
current_value=R2D_PIXEL_DOWN_OUT(current_value);
current_y+=(1<<R2D_PIXEL_POS_TO_BIT_POS);
} while (current_y != y);
}
count=0;
#if (R2D_DITHERING == R2D_OFF)
if (background)
pixel_value=((T_R2D_GC*)gc)->background_pixel_value;
else
pixel_value=((T_R2D_GC*)gc)->foreground_pixel_value;
#endif
do
{
#if (R2D_DITHERING == R2D_ON)
if (background)
{
if (gc->background_texture!=NULL)
pixel_value=r2d_get_texture_color();
else
pixel_value=r2d_get_dithering_matrix_entry(((T_R2D_GC*)gc)->p_background_dithered_cache,x,ty);
}
else
pixel_value=r2d_get_dithering_matrix_entry(((T_R2D_GC*)gc)->p_foreground_dithered_cache,x,ty);
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -