[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Enigma-cvs] enigma/src/px video.cc,1.12,1.13
From: |
Daniel Heck <address@hidden> |
Subject: |
[Enigma-cvs] enigma/src/px video.cc,1.12,1.13 |
Date: |
Wed, 26 Nov 2003 08:20:34 +0000 |
Update of /cvsroot/enigma/enigma/src/px
In directory subversions:/tmp/cvs-serv10514/src/px
Modified Files:
video.cc
Log Message:
- clip_blit() takes clipping rectangle instead
of graphics state as first arguments.
- px::Grab performs clipping and returns grabbed area.
- Fixed bug in MakeSurface (data, ...)
- Added MakeSurfaceLike()
Index: video.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/px/video.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** video.cc 19 Nov 2003 16:22:38 -0000 1.12
--- video.cc 26 Nov 2003 08:20:32 -0000 1.13
***************
*** 104,118 ****
}
! bool clip_blit (const GS &gs, int &x, int &y, Rect &r)
{
! Rect rr = gs.cliprect;
! rr.x += r.x-x;
! rr.y += r.y-y;
! rr.intersect (r);
! if (rr.w > 0 && rr.h > 0) {
! x += rr.x-r.x;
! y += rr.y-r.y;
! r = rr;
return true;
}
--- 104,117 ----
}
! bool clip_blit (Rect cliprect, int &x, int &y, Rect &r)
{
! cliprect.x += r.x-x;
! cliprect.y += r.y-y;
! cliprect.intersect (r);
! if (cliprect.w > 0 && cliprect.h > 0) {
! x += cliprect.x-r.x;
! y += cliprect.y-r.y;
! r = cliprect;
return true;
}
***************
*** 274,280 ****
! //----------------------------------------
! // Surface implementation
! //----------------------------------------
Surface::Surface (SDL_Surface* sfc)
--- 273,277 ----
! /* -------------------- Surface -------------------- */
Surface::Surface (SDL_Surface* sfc)
***************
*** 283,299 ****
}
! Surface::~Surface()
! {
SDL_FreeSurface(m_surface);
}
! void Surface::lock()
! {
if (SDL_MUSTLOCK (m_surface))
SDL_LockSurface (m_surface);
}
! void Surface::unlock()
! {
if (SDL_MUSTLOCK (m_surface))
SDL_UnlockSurface (m_surface);
--- 280,293 ----
}
! Surface::~Surface() {
SDL_FreeSurface(m_surface);
}
! void Surface::lock() {
if (SDL_MUSTLOCK (m_surface))
SDL_LockSurface (m_surface);
}
! void Surface::unlock() {
if (SDL_MUSTLOCK (m_surface))
SDL_UnlockSurface (m_surface);
***************
*** 313,319 ****
! void
! Surface::box (const GS &gs, int x, int y, int w, int h)
! {
Rect r (x, y, w, h);
if (NOCLIP(gs) || clip_rect (gs, r)) {
--- 307,311 ----
! void Surface::box (const GS &gs, int x, int y, int w, int h) {
Rect r (x, y, w, h);
if (NOCLIP(gs) || clip_rect (gs, r)) {
***************
*** 324,330 ****
}
! void
! Surface::line (const GS &gs, int x1, int y1, int x2, int y2)
! {
SDL_Rect s;
sdl::copy_rect(s, gs.cliprect);
--- 316,320 ----
}
! void Surface::line (const GS &gs, int x1, int y1, int x2, int y2) {
SDL_Rect s;
sdl::copy_rect(s, gs.cliprect);
***************
*** 342,350 ****
}
! void
! Surface::blit (const GS &gs, int x, int y, const Surface* s, const Rect &r_)
! {
Rect r(r_);
! if (NOCLIP(gs) || clip_blit (gs, x, y, r)) {
SDL_Rect r1;
SDL_Rect r2;
--- 332,338 ----
}
! void Surface::blit (const GS &gs, int x, int y, const Surface* s, const Rect
&r_) {
Rect r(r_);
! if (NOCLIP(gs) || clip_blit (gs.cliprect, x, y, r)) {
SDL_Rect r1;
SDL_Rect r2;
***************
*** 355,374 ****
}
! void
! Surface::blit (const GS &gs, int x, int y, const Surface* src)
! {
blit (gs, x, y, src, src->size());
}
! void
! Surface::set_color_key (int r, int g, int b)
! {
Uint32 color = map_color(r,g,b);
SDL_SetColorKey(get_surface(), SDL_SRCCOLORKEY | SDL_RLEACCEL, color);
}
! void
! Surface::set_alpha(int a)
! {
SDL_SetAlpha(get_surface(), SDL_SRCALPHA, a);
}
--- 343,356 ----
}
! void Surface::blit (const GS &gs, int x, int y, const Surface* src) {
blit (gs, x, y, src, src->size());
}
! void Surface::set_color_key (int r, int g, int b) {
Uint32 color = map_color(r,g,b);
SDL_SetColorKey(get_surface(), SDL_SRCCOLORKEY | SDL_RLEACCEL, color);
}
! void Surface::set_alpha(int a) {
SDL_SetAlpha(get_surface(), SDL_SRCALPHA, a);
}
***************
*** 403,410 ****
}
!
! //----------------------------------------
! // Screen implementation
! //----------------------------------------
/* `Xlib.h' also defines a type named `Screen' so we have to specify
--- 385,390 ----
}
!
! /* -------------------- Screen -------------------- */
/* `Xlib.h' also defines a type named `Screen' so we have to specify
***************
*** 419,424 ****
{}
! void
! px::Screen::update_all()
{
//SDL_UpdateRect(get_surface(), 0, 0, 0, 0);
--- 399,403 ----
{}
! void px::Screen::update_all()
{
//SDL_UpdateRect(get_surface(), 0, 0, 0, 0);
***************
*** 426,431 ****
}
! void
! px::Screen::update_rect(const Rect& r)
{
if (m_dirtyrects.size() < 200)
--- 405,409 ----
}
! void px::Screen::update_rect(const Rect& r)
{
if (m_dirtyrects.size() < 200)
***************
*** 435,446 ****
}
! void
! px::Screen::set_caption(const char* str)
{
SDL_WM_SetCaption(str, 0);
}
! void
! px::Screen::flush_updates()
{
if (update_all_p) {
--- 413,422 ----
}
! void px::Screen::set_caption(const char* str)
{
SDL_WM_SetCaption(str, 0);
}
! void px::Screen::flush_updates()
{
if (update_all_p) {
***************
*** 626,637 ****
}
! Surface *
! px::Grab (const Surface *s, Rect r)
! {
! if (s==0) return 0;
SDL_Surface *sdls = s->get_surface();
SDL_Rect rect;
! sdl::copy_rect (rect, intersect(r, s->size()));
SDL_Surface *copy = CropSurface (sdls, rect, sdls->format, sdls->flags);
return Surface::make_surface (copy);
--- 602,617 ----
}
! Surface * px::Grab (const Surface *s, Rect &r) {
! if (s==0)
! return 0;
SDL_Surface *sdls = s->get_surface();
+ int x = 0;
+ int y = 0;
+
+ clip_blit (s->size(), x, y, r);
+
SDL_Rect rect;
! sdl::copy_rect (rect, r);
SDL_Surface *copy = CropSurface (sdls, rect, sdls->format, sdls->flags);
return Surface::make_surface (copy);
***************
*** 642,647 ****
! Surface*
! px::LoadImage (const char* filename)
{
if (SDL_Surface *tmp = IMG_Load(filename))
--- 622,626 ----
! Surface* px::LoadImage (const char* filename)
{
if (SDL_Surface *tmp = IMG_Load(filename))
***************
*** 668,673 ****
}
! Surface *
! px::MakeSurface(int w, int h, int bipp, const RGBA_Mask &mask)
{
SDL_Surface* sfc;
--- 647,651 ----
}
! Surface * px::MakeSurface(int w, int h, int bipp, const RGBA_Mask &mask)
{
SDL_Surface* sfc;
***************
*** 682,691 ****
/* Create a surface from image data that is already somewhere in
memory. */
! Surface *
! px::MakeSurface(void */*data*/, int w, int h, int bipp, int pitch,
! const RGBA_Mask &mask)
{
SDL_Surface* sfc;
! sfc = SDL_CreateRGBSurfaceFrom(SDL_SWSURFACE, w, h, bipp,
pitch, mask.r, mask.g, mask.b, mask.a);
if (sfc == 0)
--- 660,668 ----
/* Create a surface from image data that is already somewhere in
memory. */
! Surface * px::MakeSurface(void *data, int w, int h, int bipp, int pitch,
! const RGBA_Mask &mask)
{
SDL_Surface* sfc;
! sfc = SDL_CreateRGBSurfaceFrom(data, w, h, bipp,
pitch, mask.r, mask.g, mask.b, mask.a);
if (sfc == 0)
***************
*** 693,695 ****
--- 670,685 ----
return Surface::make_surface (sfc);
}
+
+ Surface *px::MakeSurfaceLike (int w, int h, Surface *surface) {
+ if (surface == 0)
+ return 0;
+ SDL_Surface *sdls = surface->get_surface();
+
+ return MakeSurface (w, h, sdls->format->BitsPerPixel,
+ RGBA_Mask(sdls->format->Rmask,
+ sdls->format->Gmask,
+ sdls->format->Bmask,
+ sdls->format->Amask));
+ }
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Enigma-cvs] enigma/src/px video.cc,1.12,1.13,
Daniel Heck <address@hidden> <=