[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src surface.h,1.7.2.3,1.7.2.4 surface
From: |
Alexandre Courbot <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src surface.h,1.7.2.3,1.7.2.4 surface.cc,1.9.2.2,1.9.2.3 |
Date: |
Fri, 05 Apr 2002 14:19:59 -0500 |
Update of /cvsroot/adonthell/adonthell/src
In directory subversions:/tmp/cvs-serv6661/src
Modified Files:
Tag: Branch_road_to_0-4
surface.h surface.cc
Log Message:
Uh, found a better way to add drawing_area support to surface::draw_line!
Index: surface.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/surface.h,v
retrieving revision 1.7.2.3
retrieving revision 1.7.2.4
diff -C2 -r1.7.2.3 -r1.7.2.4
*** surface.h 5 Apr 2002 18:21:45 -0000 1.7.2.3
--- surface.h 5 Apr 2002 19:19:57 -0000 1.7.2.4
***************
*** 229,234 ****
*
*/
! void draw_line (s_int16 sx, s_int16 sy, s_int16 ex, s_int16 ey, u_int32
col,
! drawing_area * da_opt = NULL);
//@}
--- 229,234 ----
*
*/
! void draw_line (const s_int16 sx, const s_int16 sy, const s_int16 ex,
const s_int16 ey,
! const u_int32 col, const drawing_area * da_opt = NULL);
//@}
Index: surface.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/surface.cc,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -C2 -r1.9.2.2 -r1.9.2.3
*** surface.cc 5 Apr 2002 18:21:45 -0000 1.9.2.2
--- surface.cc 5 Apr 2002 19:19:57 -0000 1.9.2.3
***************
*** 107,111 ****
}
! void surface::draw_line(s_int16 x1, s_int16 y1, s_int16 x2, s_int16 y2,
u_int32 color, drawing_area * da_opt = NULL)
{
int i;
--- 107,112 ----
}
! void surface::draw_line(const s_int16 x1, const s_int16 y1, const s_int16 x2,
const s_int16 y2,
! const u_int32 color, const drawing_area * da_opt =
NULL)
{
int i;
***************
*** 117,138 ****
int offset;
- if (da_opt)
- {
- u_int16 mx = da_opt->x() + da_opt->length();
- u_int16 my = da_opt->y() + da_opt->height();
-
- if (x1 < da_opt->x()) x1 = da_opt->x();
- if (x2 < da_opt->x()) x2 = da_opt->x();
-
- if (x1 >= mx) x1 = mx - 1;
- if (x2 >= mx) x2 = mx - 1;
-
- if (y1 < da_opt->y()) y1 = da_opt->y();
- if (y2 < da_opt->y()) y2 = da_opt->y();
-
- if (y1 >= my) y1 = my - 1;
- if (y2 >= my) y2 = my - 1;
- }
-
x=x1;
y=y1;
--- 118,121 ----
***************
*** 140,205 ****
if(x1<=x2)
{
! IncX=1;
! Dx=x2-x1;
}
else
{
! IncX=-1;
! Dx=x1-x2;
}
!
if(y1<=y2)
{
! IncY=1;
! Dy=y2-y1;
}
else
{
! IncY=-1;
! Dy=y1-y2;
}
!
lock ();
if(Dy<Dx)
{
! inc1=(Dy-Dx)<<1;
! inc2=Dy<<1;
! Err=inc2-Dx;
!
! for(i=0;i<Dx;i++)
! {
! put_pix (x, y, color);
!
! if(Err>0)
! {
! y+=IncY;
! Err+=inc1;
! }
! else
! Err+=inc2;
!
! x+=IncX;
! offset+=IncX;
! }
! }else
! {
! inc1=(Dx-Dy)<<1;
! inc2=Dx<<1;
! Err=inc2-Dy;
!
! for(i=0;i<Dy;i++)
! {
! put_pix(x, y, color);
!
! if(Err>0)
! {
! x+=IncX;
! Err+=inc1;
! }
! else
! Err+=inc2;
!
! y+=IncY;
! }
}
unlock();
--- 123,193 ----
if(x1<=x2)
{
! IncX=1;
! Dx=x2-x1;
}
else
{
! IncX=-1;
! Dx=x1-x2;
}
!
if(y1<=y2)
{
! IncY=1;
! Dy=y2-y1;
}
else
{
! IncY=-1;
! Dy=y1-y2;
}
!
lock ();
if(Dy<Dx)
{
! inc1=(Dy-Dx)<<1;
! inc2=Dy<<1;
! Err=inc2-Dx;
!
! for(i=0;i<Dx;i++)
! {
! if (!da_opt || (x >= da_opt->x() && x < da_opt->x() +
da_opt->length() &&
! y >= da_opt->y() && y < da_opt->y() +
da_opt->height()))
! put_pix (x, y, color);
!
! if(Err>0)
! {
! y+=IncY;
! Err+=inc1;
! }
! else
! Err+=inc2;
!
! x+=IncX;
! offset+=IncX;
! }
! }
! else
! {
! inc1=(Dx-Dy)<<1;
! inc2=Dx<<1;
! Err=inc2-Dy;
!
! for(i=0;i<Dy;i++)
! {
! if (!da_opt || (x >= da_opt->x() && x < da_opt->x() +
da_opt->length() &&
! y >= da_opt->y() && y < da_opt->y() +
da_opt->height()))
! put_pix(x, y, color);
!
! if(Err>0)
! {
! x+=IncX;
! Err+=inc1;
! }
! else
! Err+=inc2;
!
! y+=IncY;
! }
}
unlock();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src surface.h,1.7.2.3,1.7.2.4 surface.cc,1.9.2.2,1.9.2.3,
Alexandre Courbot <address@hidden> <=
- Prev by Date:
[Adonthell-commits] CVS: adonthell .cvsignore,1.3.4.1,1.3.4.2
- Next by Date:
[Adonthell-commits] CVS: adonthell/src atk_border.cc,NONE,1.1.2.1 atk_border.h,NONE,1.1.2.1 atk_border_template.cc,NONE,1.1.2.1 atk_border_template.h,NONE,1.1.2.1 atk_window.cc,NONE,1.1.2.1 Makefile.am,1.80.2.21,1.80.2.22 atk_bin.cc,1.1.2.1,1.1.2.2 atk_bin.h,1.1.2.1,1.1.2.2 atk_box.cc,1.1.2.3,1.1.2.4 atk_box.h,1.1.2.3,1.1.2.4 atk_container.cc,1.1.2.2,1.1.2.3 atk_container.h,1.1.2.3,1.1.2.4 atk_manager.cc,1.1.2.1,1.1.2.2 atk_manager.h,1.1.2.1,1.1.2.2 atk_widget.cc,1.1.2.3,1.1.2.4 atk_widget.h,1.1.2.4,1.1.2.5 atk_window.h,1.1.2.1,1.1.2.2 callback.h,1.4.4.2,1.4.4.3 joltest.cc,1.1.2.6,1.1.2.7
- Previous by thread:
[Adonthell-commits] CVS: adonthell .cvsignore,1.3.4.1,1.3.4.2
- Next by thread:
[Adonthell-commits] CVS: adonthell/src atk_border.cc,NONE,1.1.2.1 atk_border.h,NONE,1.1.2.1 atk_border_template.cc,NONE,1.1.2.1 atk_border_template.h,NONE,1.1.2.1 atk_window.cc,NONE,1.1.2.1 Makefile.am,1.80.2.21,1.80.2.22 atk_bin.cc,1.1.2.1,1.1.2.2 atk_bin.h,1.1.2.1,1.1.2.2 atk_box.cc,1.1.2.3,1.1.2.4 atk_box.h,1.1.2.3,1.1.2.4 atk_container.cc,1.1.2.2,1.1.2.3 atk_container.h,1.1.2.3,1.1.2.4 atk_manager.cc,1.1.2.1,1.1.2.2 atk_manager.h,1.1.2.1,1.1.2.2 atk_widget.cc,1.1.2.3,1.1.2.4 atk_widget.h,1.1.2.4,1.1.2.5 atk_window.h,1.1.2.1,1.1.2.2 callback.h,1.4.4.2,1.4.4.3 joltest.cc,1.1.2.6,1.1.2.7
- Index(es):