[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src sdl_utils.cpp widgets/scrollbar.cpp...
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src sdl_utils.cpp widgets/scrollbar.cpp... |
Date: |
Mon, 23 Aug 2004 21:16:53 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 04/08/24 01:12:03
Modified files:
src : sdl_utils.cpp
src/widgets : scrollbar.cpp scrollbar.hpp
Log message:
optimized menu scrolling
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.cpp.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.cpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.hpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
Patches:
Index: wesnoth/src/sdl_utils.cpp
diff -u wesnoth/src/sdl_utils.cpp:1.54 wesnoth/src/sdl_utils.cpp:1.55
--- wesnoth/src/sdl_utils.cpp:1.54 Sun Aug 15 19:42:44 2004
+++ wesnoth/src/sdl_utils.cpp Tue Aug 24 01:12:03 2004
@@ -1,4 +1,4 @@
-/* $Id: sdl_utils.cpp,v 1.54 2004/08/15 19:42:44 gruikya Exp $ */
+/* $Id: sdl_utils.cpp,v 1.55 2004/08/24 01:12:03 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -62,7 +62,7 @@
SDL_FreeSurface(surf);
}
-/*explicit*/ surface::surface(SDL_Surface* surf) : surface_(surf)
+surface::surface(SDL_Surface* surf) : surface_(surf)
{
}
Index: wesnoth/src/widgets/scrollbar.cpp
diff -u wesnoth/src/widgets/scrollbar.cpp:1.13
wesnoth/src/widgets/scrollbar.cpp:1.14
--- wesnoth/src/widgets/scrollbar.cpp:1.13 Sun Aug 22 21:13:16 2004
+++ wesnoth/src/widgets/scrollbar.cpp Tue Aug 24 01:12:03 2004
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.cpp,v 1.13 2004/08/22 21:13:16 gruikya Exp $*/
+/* $Id: scrollbar.cpp,v 1.14 2004/08/24 01:12:03 Sirp Exp $*/
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -37,7 +37,8 @@
namespace gui {
scrollbar::scrollbar(display& d, scrollable* callback)
- : widget(d), callback_(callback), highlight_(false), clicked_(false),
dragging_(false),
+ : mid_scaled_(NULL), groove_scaled_(NULL),
+ widget(d), callback_(callback), highlight_(false), clicked_(false),
dragging_(false),
grip_position_(0), grip_height_(0), enabled_(false), width_(0),
minimum_grip_height_(0), groove_click_code_(0)
{
@@ -144,17 +145,21 @@
// of a larger problem, I think.
mid_height = 1;
}
- const surface mid_scaled(scale_surface_blended(mid_img,
-
mid_img->w, mid_height));
+
+ if(mid_scaled_.null() || mid_scaled_->h != mid_height) {
+
mid_scaled_.assign(scale_surface_blended(mid_img,mid_img->w,mid_height));
+ }
int groove_height = location().h - top_grv->h - bottom_grv->h;
if (groove_height <= 0) {
groove_height = 1;
}
- const surface groove_scaled(scale_surface_blended(mid_grv,
-
mid_grv->w, groove_height));
- if (mid_scaled == NULL || groove_scaled == NULL) {
+ if(groove_scaled_.null() || groove_scaled_->h != groove_height) {
+
groove_scaled_.assign(scale_surface_blended(mid_grv,mid_grv->w,groove_height));
+ }
+
+ if (mid_scaled_.null() || groove_scaled_.null()) {
std::cerr << "Failure during scrollbar image scale.\n";
return;
}
@@ -172,7 +177,7 @@
// draw scrollbar "groove"
disp().blit_surface(xpos, location().y, top_grv);
- disp().blit_surface(xpos, location().y + top_grv->h, groove_scaled);
+ disp().blit_surface(xpos, location().y + top_grv->h, groove_scaled_);
disp().blit_surface(xpos, location().y + top_grv->h + groove_height,
bottom_grv);
@@ -180,7 +185,7 @@
SDL_Rect scrollbar = scroll_grip_area();
xpos = scrollbar.x;
disp().blit_surface(xpos, scrollbar.y, top_img);
- disp().blit_surface(xpos, scrollbar.y + top_img->h, mid_scaled);
+ disp().blit_surface(xpos, scrollbar.y + top_img->h, mid_scaled_);
disp().blit_surface(xpos, scrollbar.y + top_img->h + mid_height,
bottom_img);
Index: wesnoth/src/widgets/scrollbar.hpp
diff -u wesnoth/src/widgets/scrollbar.hpp:1.5
wesnoth/src/widgets/scrollbar.hpp:1.6
--- wesnoth/src/widgets/scrollbar.hpp:1.5 Sun Aug 22 21:13:16 2004
+++ wesnoth/src/widgets/scrollbar.hpp Tue Aug 24 01:12:03 2004
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.hpp,v 1.5 2004/08/22 21:13:16 gruikya Exp $ */
+/* $Id: scrollbar.hpp,v 1.6 2004/08/24 01:12:03 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -106,6 +106,8 @@
SDL_Rect scroll_grip_area() const;
void draw();
+ surface mid_scaled_, groove_scaled_;
+
scrollable* callback_;
int minimum_grip_height_;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src sdl_utils.cpp widgets/scrollbar.cpp...,
David White <=