wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src display.cpp display.hpp show_dialog...


From: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth/src display.cpp display.hpp show_dialog...
Date: Tue, 15 Mar 2005 17:14:04 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    05/03/15 22:14:04

Modified files:
        src            : display.cpp display.hpp show_dialog.cpp 
                         titlescreen.cpp video.cpp video.hpp 
        src/widgets    : button.cpp menu.cpp scrollbar.cpp slider.cpp 

Log message:
        moved blit_surface() from display to video, more cleanup of deps 
against display

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.297&tr2=1.298&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.hpp.diff?tr1=1.95&tr2=1.96&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/show_dialog.cpp.diff?tr1=1.114&tr2=1.115&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/titlescreen.cpp.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.cpp.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.hpp.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/button.cpp.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.82&tr2=1.83&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.cpp.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/slider.cpp.diff?tr1=1.37&tr2=1.38&r1=text&r2=text

Patches:
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.297 wesnoth/src/display.cpp:1.298
--- wesnoth/src/display.cpp:1.297       Tue Mar 15 20:01:30 2005
+++ wesnoth/src/display.cpp     Tue Mar 15 22:14:04 2005
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.297 2005/03/15 20:01:30 ydirson Exp $ */
+/* $Id: display.cpp,v 1.298 2005/03/15 22:14:04 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -546,18 +546,18 @@
 
 namespace {
 
-void draw_panel(display& disp, const theme::panel& panel, 
std::vector<gui::button>& buttons)
+void draw_panel(CVideo& video, const theme::panel& panel, 
std::vector<gui::button>& buttons)
 {
        //log_scope("draw panel");
        surface surf(image::get_image(panel.image(),image::UNSCALED));
 
-       const SDL_Rect screen = disp.screen_area();
+       const SDL_Rect screen = screen_area();
        SDL_Rect& loc = panel.location(screen);
        if(surf->w != loc.w || surf->h != loc.h) {
                surf.assign(scale_surface(surf,loc.w,loc.h));
        }
 
-       disp.blit_surface(loc.x,loc.y,surf);
+       video.blit_surface(loc.x,loc.y,surf);
        update_rect(loc);
 
        for(std::vector<gui::button>::iterator b = buttons.begin(); b != 
buttons.end(); ++b) {
@@ -608,7 +608,7 @@
 
                const std::vector<theme::panel>& panels = theme_.panels();
                for(std::vector<theme::panel>::const_iterator p = 
panels.begin(); p != panels.end(); ++p) {
-                       draw_panel(*this,*p,buttons_);
+                       draw_panel(video(),*p,buttons_);
                }
 
                const std::vector<theme::label>& labels = theme_.labels();
@@ -1301,7 +1301,7 @@
                surface 
crown(image::get_image("misc/leader-crown.png",image::SCALED,image::NO_ADJUST_COLOUR));
                if(!crown.null()) {
                        SDL_Rect r = {0, 0, crown->w, crown->h};
-                       blit_surface(xpos,ypos,crown,&r);
+                       video().blit_surface(xpos,ypos,crown,&r);
                }
        }
 
@@ -1342,8 +1342,8 @@
        SDL_Rect bot = {0,bar_loc.y+skip_rows,surf->w,0};
        bot.h = surf->w - bot.y;
 
-       blit_surface(xpos,ypos,surf,&top);
-       blit_surface(xpos,ypos+top.h,surf,&bot);
+       video().blit_surface(xpos,ypos,surf,&top);
+       video().blit_surface(xpos,ypos+top.h,surf,&bot);
 
        const size_t unfilled = (const size_t)(height*(1.0 - filled));
 
@@ -1775,19 +1775,6 @@
        return surface(NULL);
 }
 
-void display::blit_surface(int x, int y, surface surf, SDL_Rect* srcrect, 
SDL_Rect* clip_rect)
-{
-       const surface target(video().getSurface());
-       SDL_Rect dst = {x,y,0,0};
-       
-       if(clip_rect != NULL) {
-               const clip_rect_setter clip_setter(target,*clip_rect);
-               SDL_BlitSurface(surf,srcrect,target,&dst);
-       } else {
-               SDL_BlitSurface(surf,srcrect,target,&dst);
-       }
-}
-
 surface display::get_minimap(int w, int h)
 {
        if(minimap_ != NULL && (minimap_->w != w || minimap_->h != h)) {
@@ -1884,7 +1871,7 @@
 
        SDL_Rect clip_rect = map_area();
        SDL_Rect srcrect = {0,0,surf->w,submerge_height};
-       blit_surface(x,y,surf,&srcrect,&clip_rect);
+       video().blit_surface(x,y,surf,&srcrect,&clip_rect);
 
        if(submerge_height != surf->h) {
                surf.assign(adjust_surface_alpha(surf,ftofxp(0.2)));
@@ -1893,7 +1880,7 @@
                srcrect.h = surf->h-submerge_height;
                y += submerge_height;
 
-               blit_surface(x,y,surf,&srcrect,&clip_rect);
+               video().blit_surface(x,y,surf,&srcrect,&clip_rect);
        }
 
        if(ellipse_front != NULL) {
Index: wesnoth/src/display.hpp
diff -u wesnoth/src/display.hpp:1.95 wesnoth/src/display.hpp:1.96
--- wesnoth/src/display.hpp:1.95        Mon Mar 14 22:26:38 2005
+++ wesnoth/src/display.hpp     Tue Mar 15 22:14:04 2005
@@ -1,4 +1,4 @@
-/* $Id: display.hpp,v 1.95 2005/03/14 22:26:38 gruikya Exp $ */
+/* $Id: display.hpp,v 1.96 2005/03/15 22:14:04 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -14,7 +14,6 @@
 #define DISPLAY_H_INCLUDED
 
 class config;
-class CVideo;
 #include "gamestatus.hpp"
 #include "image.hpp"
 #include "key.hpp"
@@ -26,6 +25,7 @@
 #include "team.hpp"
 #include "theme.hpp"
 #include "unit.hpp"
+#include "video.hpp"
 #include "widgets/button.hpp"
 
 #include "SDL.h"
@@ -206,9 +206,6 @@
        //gets the underlying screen object.
        CVideo& video() { return screen_; }
 
-       //blits a surface with black as alpha
-       void blit_surface(int x, int y, surface surface, SDL_Rect* 
srcrect=NULL, SDL_Rect* clip_rect=NULL);
-
        //function to invalidate all tiles.
        void invalidate_all();
 
Index: wesnoth/src/show_dialog.cpp
diff -u wesnoth/src/show_dialog.cpp:1.114 wesnoth/src/show_dialog.cpp:1.115
--- wesnoth/src/show_dialog.cpp:1.114   Tue Mar 15 20:01:31 2005
+++ wesnoth/src/show_dialog.cpp Tue Mar 15 22:14:04 2005
@@ -1,4 +1,4 @@
-/* $Id: show_dialog.cpp,v 1.114 2005/03/15 20:01:31 ydirson Exp $ */
+/* $Id: show_dialog.cpp,v 1.115 2005/03/15 22:14:04 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -117,25 +117,25 @@
        surface top_image(scale_surface(top,w,top->h));
 
        if(top_image != NULL) {
-               disp.blit_surface(x,y-top->h,top_image);
+               disp.video().blit_surface(x,y-top->h,top_image);
        }
 
        surface bot_image(scale_surface(bot,w,bot->h));
 
        if(bot_image != NULL) {
-               disp.blit_surface(x,y+h,bot_image);
+               disp.video().blit_surface(x,y+h,bot_image);
        }
 
        surface left_image(scale_surface(left,left->w,h));
 
        if(left_image != NULL) {
-               disp.blit_surface(x-left->w,y,left_image);
+               disp.video().blit_surface(x-left->w,y,left_image);
        }
 
        surface right_image(scale_surface(right,right->w,h));
 
        if(right_image != NULL) {
-               disp.blit_surface(x+w,y,right_image);
+               disp.video().blit_surface(x+w,y,right_image);
        }
 
        update_rect(x-left->w,y-top->h,w+left->w+right->w,h+top->h+bot->h);
@@ -148,10 +148,10 @@
                return;
        }
 
-       disp.blit_surface(x-top_left->w,y-top_left->h,top_left);
-       disp.blit_surface(x-bot_left->w,y+h,bot_left);
-       disp.blit_surface(x+w,y-top_right->h,top_right);
-       disp.blit_surface(x+w,y+h,bot_right);
+       disp.video().blit_surface(x-top_left->w,y-top_left->h,top_left);
+       disp.video().blit_surface(x-bot_left->w,y+h,bot_left);
+       disp.video().blit_surface(x+w,y-top_right->h,top_right);
+       disp.video().blit_surface(x+w,y+h,bot_right);
 }
 
 void draw_dialog_background(int x, int y, int w, int h, display& disp, const 
std::string& style)
@@ -711,7 +711,7 @@
                const int x = xloc + left_padding;
                const int y = yloc + top_padding;
 
-               disp.blit_surface(x,y,image);
+               disp.video().blit_surface(x,y,image);
 
                font::draw_text(&disp.video(), clipRect, caption_font_size,
                                font::NORMAL_COLOUR, caption,
Index: wesnoth/src/titlescreen.cpp
diff -u wesnoth/src/titlescreen.cpp:1.35 wesnoth/src/titlescreen.cpp:1.36
--- wesnoth/src/titlescreen.cpp:1.35    Tue Mar 15 20:01:31 2005
+++ wesnoth/src/titlescreen.cpp Tue Mar 15 22:14:04 2005
@@ -154,7 +154,7 @@
        if(title_surface == NULL) {
                ERR_DP << "Could not find title image\n";
        } else {
-               screen.blit_surface(0,0,title_surface);
+               screen.video().blit_surface(0,0,title_surface);
                update_rect(screen_area());
 
                LOG_DP << "displayed title image\n";
Index: wesnoth/src/video.cpp
diff -u wesnoth/src/video.cpp:1.58 wesnoth/src/video.cpp:1.59
--- wesnoth/src/video.cpp:1.58  Tue Mar 15 21:47:40 2005
+++ wesnoth/src/video.cpp       Tue Mar 15 22:14:04 2005
@@ -1,4 +1,4 @@
-/* $Id: video.cpp,v 1.58 2005/03/15 21:47:40 ydirson Exp $ */
+/* $Id: video.cpp,v 1.59 2005/03/15 22:14:04 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -235,6 +235,19 @@
        LOG_DP << "called SDL_Quit()\n";
 }
 
+void CVideo::blit_surface(int x, int y, surface surf, SDL_Rect* srcrect, 
SDL_Rect* clip_rect)
+{
+       const surface target(getSurface());
+       SDL_Rect dst = {x,y,0,0};
+       
+       if(clip_rect != NULL) {
+               const clip_rect_setter clip_setter(target,*clip_rect);
+               SDL_BlitSurface(surf,srcrect,target,&dst);
+       } else {
+               SDL_BlitSurface(surf,srcrect,target,&dst);
+       }
+}
+
 void CVideo::make_fake()
 {
        fake_screen = true;
Index: wesnoth/src/video.hpp
diff -u wesnoth/src/video.hpp:1.30 wesnoth/src/video.hpp:1.31
--- wesnoth/src/video.hpp:1.30  Tue Mar 15 21:47:40 2005
+++ wesnoth/src/video.hpp       Tue Mar 15 22:14:04 2005
@@ -1,4 +1,4 @@
-/* $Id: video.hpp,v 1.30 2005/03/15 21:47:40 ydirson Exp $ */
+/* $Id: video.hpp,v 1.31 2005/03/15 22:14:04 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -60,6 +60,8 @@
        void unlock();
        int mustLock();
 
+       //blits a surface with black as alpha
+       void blit_surface(int x, int y, surface surf, SDL_Rect* srcrect=NULL, 
SDL_Rect* clip_rect=NULL);
        void flip();
 
        surface getSurface( void );
Index: wesnoth/src/widgets/button.cpp
diff -u wesnoth/src/widgets/button.cpp:1.59 wesnoth/src/widgets/button.cpp:1.60
--- wesnoth/src/widgets/button.cpp:1.59 Tue Mar 15 21:47:41 2005
+++ wesnoth/src/widgets/button.cpp      Tue Mar 15 22:14:04 2005
@@ -1,4 +1,4 @@
-/* $Id: button.cpp,v 1.59 2005/03/15 21:47:41 ydirson Exp $ */
+/* $Id: button.cpp,v 1.60 2005/03/15 22:14:04 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -170,7 +170,7 @@
        if (!enabled_)
                image = greyscale_image(image);
 
-       disp().blit_surface(loc.x, loc.y, image);
+       video().blit_surface(loc.x, loc.y, image);
        const std::string etext = font::make_text_ellipsis(label_, font_size, 
loc.w);
        font::draw_text(&video(), clipArea, font_size, font::BUTTON_COLOUR, 
etext, textx, texty);
 
Index: wesnoth/src/widgets/menu.cpp
diff -u wesnoth/src/widgets/menu.cpp:1.82 wesnoth/src/widgets/menu.cpp:1.83
--- wesnoth/src/widgets/menu.cpp:1.82   Tue Mar 15 21:47:41 2005
+++ wesnoth/src/widgets/menu.cpp        Tue Mar 15 22:14:04 2005
@@ -421,7 +421,7 @@
                                if(img != NULL && (xpos - rect.x) + img->w < 
max_width
                                   && rect.y + img->h < area.h) {
                                        const size_t y = rect.y + (rect.h - 
img->h)/2;
-                                       disp().blit_surface(xpos,y,img);
+                                       video().blit_surface(xpos,y,img);
                                        xpos += img->w + 5;
                                }
                        } else {
Index: wesnoth/src/widgets/scrollbar.cpp
diff -u wesnoth/src/widgets/scrollbar.cpp:1.29 
wesnoth/src/widgets/scrollbar.cpp:1.30
--- wesnoth/src/widgets/scrollbar.cpp:1.29      Tue Mar 15 21:47:41 2005
+++ wesnoth/src/widgets/scrollbar.cpp   Tue Mar 15 22:14:04 2005
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.cpp,v 1.29 2005/03/15 21:47:41 ydirson Exp $*/
+/* $Id: scrollbar.cpp,v 1.30 2005/03/15 22:14:04 ydirson Exp $*/
 /*
    Copyright (C) 2003 by David White <address@hidden>
                  2004 by Guillaume Melquiond <address@hidden>
@@ -239,14 +239,14 @@
        surface const screen = video().getSurface();
 
        // draw scrollbar "groove"
-       disp().blit_surface(groove.x, groove.y, top_grv);
-       disp().blit_surface(groove.x, groove.y + top_grv->h, groove_scaled_);
-       disp().blit_surface(groove.x, groove.y + top_grv->h + groove_height, 
bottom_grv);
+       video().blit_surface(groove.x, groove.y, top_grv);
+       video().blit_surface(groove.x, groove.y + top_grv->h, groove_scaled_);
+       video().blit_surface(groove.x, groove.y + top_grv->h + groove_height, 
bottom_grv);
 
        // draw scrollbar "grip"
-       disp().blit_surface(grip.x, grip.y, top_img);
-       disp().blit_surface(grip.x, grip.y + top_img->h, mid_scaled_);
-       disp().blit_surface(grip.x, grip.y + top_img->h + mid_height, 
bottom_img);
+       video().blit_surface(grip.x, grip.y, top_img);
+       video().blit_surface(grip.x, grip.y + top_img->h, mid_scaled_);
+       video().blit_surface(grip.x, grip.y + top_img->h + mid_height, 
bottom_img);
 
        update_rect(groove);
 }
Index: wesnoth/src/widgets/slider.cpp
diff -u wesnoth/src/widgets/slider.cpp:1.37 wesnoth/src/widgets/slider.cpp:1.38
--- wesnoth/src/widgets/slider.cpp:1.37 Tue Mar 15 21:47:41 2005
+++ wesnoth/src/widgets/slider.cpp      Tue Mar 15 22:14:04 2005
@@ -1,4 +1,4 @@
-/* $Id: slider.cpp,v 1.37 2005/03/15 21:47:41 ydirson Exp $ */
+/* $Id: slider.cpp,v 1.38 2005/03/15 22:14:04 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -126,7 +126,7 @@
        SDL_FillRect(screen, &line_rect, SDL_MapRGB(screen->format, 255, 255, 
255));
 
        SDL_Rect const &slider = slider_area();
-       disp().blit_surface(slider.x, slider.y, image);
+       video().blit_surface(slider.x, slider.y, image);
 }
 
 void slider::set_slider_position(int x)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]