Ticket #8419: credits.diff
File credits.diff, 5.6 KB (added by , 19 years ago) |
---|
-
TODO
diff -ur --exclude=CVS --exclude=Makefile ScummVM/TODO ScummVM+hack/TODO
old new 196 196 * Maybe add the ScummVM logo (+typeface?) to the about dialog 197 197 * Unify DirBrowserDialog and FileBrowserDialog. 198 198 * MacOS X version of FileBrowserDialog, since there is one of DirBrowserDialog. 199 * The credits scroll is too CPU intensive. This is because for each time the200 text is redrawn it has to do a full redraw, which causes blendRect() to be201 called twice. Perhaps AboutDialog could keep a private copy of the blended202 background so that it wouldn't have to be re-generated each time? Of course203 we'd probably have to take screen changes into account, but there already is204 a mechanism for that, I believe.205 199 206 200 Launcher 207 201 ======== -
gui/about.cpp
diff -ur --exclude=CVS --exclude=Makefile ScummVM/gui/about.cpp ScummVM+hack/gui/about.cpp
old new 120 120 _scrollPos = 0; 121 121 _modifiers = 0; 122 122 _willClose = false; 123 _canvas.pixels = NULL; 123 124 124 125 Dialog::open(); 125 126 } 126 127 128 void AboutDialog::close() { 129 free(_canvas.pixels); 130 Dialog::close(); 131 } 132 127 133 void AboutDialog::drawDialog() { 128 // Blend over the background 129 g_gui.blendRect(_x, _y, _w, _h, g_gui._bgcolor); 134 if (!_canvas.pixels) { 135 // Blend over the background. Since we can't afford to do that 136 // every time the text is updated (it's horribly CPU intensive) 137 // we do it just once and then use a copy of the result as our 138 // static background for the remainder of the credits. 139 g_gui.blendRect(_x, _y, _w, _h, g_gui._bgcolor); 140 g_gui.getRect(&_canvas, _x, _y, _w, _h); 141 } 142 143 g_gui.putRect(&_canvas, _x, _y); 130 144 131 145 // Draw text 132 146 // TODO: Add a "fade" effect for the top/bottom text lines … … 212 226 } else if ((uint32)_scrollPos > _lines.size() * _lineHeight) { 213 227 _scrollPos = 0; 214 228 _scrollTime += kScrollStartDelay; 215 } else {216 g_gui.addDirtyRect(_x, _y, _w, _h);217 229 } 218 draw (); // Issue a full redraw230 drawDialog(); 219 231 } 220 232 } 221 233 234 void AboutDialog::handleScreenChanged() { 235 // The screen has changed. Do a full redraw to ensure that the canvas 236 // we draw the text on will still have the correct background image. 237 free(_canvas.pixels); 238 _canvas.pixels = NULL; 239 draw(); 240 } 241 222 242 void AboutDialog::handleMouseUp(int x, int y, int button, int clickCount) { 223 243 // Close upon any mouse click 224 244 close(); -
gui/about.h
diff -ur --exclude=CVS --exclude=Makefile ScummVM/gui/about.h ScummVM+hack/gui/about.h
old new 23 23 24 24 #include "gui/dialog.h" 25 25 #include "common/str.h" 26 #include "graphics/surface.h" 26 27 27 28 namespace GUI { 28 29 … … 35 36 uint32 _lineHeight; 36 37 byte _modifiers; 37 38 bool _willClose; 39 Graphics::Surface _canvas; 38 40 39 41 public: 40 42 AboutDialog(); 41 43 42 44 void open(); 45 void close(); 43 46 void drawDialog(); 44 47 void handleTickle(); 48 void handleScreenChanged(); 45 49 void handleMouseUp(int x, int y, int button, int clickCount); 46 50 void handleKeyDown(uint16 ascii, int keycode, int modifiers); 47 51 void handleKeyUp(uint16 ascii, int keycode, int modifiers); -
gui/newgui.cpp
diff -ur --exclude=CVS --exclude=Makefile ScummVM/gui/newgui.cpp ScummVM+hack/gui/newgui.cpp
old new 301 301 _screen.vLine(x * _scaleFactor, y * _scaleFactor, y2 * _scaleFactor, color); 302 302 } 303 303 304 void NewGui::getRect(Graphics::Surface *s, int x, int y, int w, int h) { 305 Common::Rect rect(x * _scaleFactor, y * _scaleFactor, (x + w) * _scaleFactor, (y + h) * _scaleFactor); 306 rect.clip(_screen.w, _screen.h); 307 308 if (!rect.isValidRect()) 309 return; 310 311 s->w = rect.width(); 312 s->h = rect.height(); 313 s->bytesPerPixel = sizeof(OverlayColor); 314 s->pitch = s->w * s->bytesPerPixel; 315 s->pixels = (OverlayColor *)malloc(s->pitch * s->h); 316 317 w = s->w; 318 h = s->h; 319 320 OverlayColor *dst = (OverlayColor *)s->pixels; 321 OverlayColor *src = getBasePtr(rect.left, rect.top); 322 323 while (h--) { 324 memcpy(dst, src, s->pitch); 325 src += _screenPitch; 326 dst += s->w; 327 } 328 } 329 330 void NewGui::putRect(Graphics::Surface *s, int x, int y) { 331 Common::Rect rect(x * _scaleFactor, y * _scaleFactor, x * _scaleFactor + s->w, y * _scaleFactor + s->h); 332 rect.clip(_screen.w, _screen.h); 333 334 if (!rect.isValidRect()) 335 return; 336 337 OverlayColor *src = (OverlayColor *)s->pixels; 338 OverlayColor *dst = getBasePtr(rect.left, rect.top); 339 340 int w = rect.width(); 341 int h = rect.height(); 342 343 while (h--) { 344 memcpy(dst, src, s->pitch); 345 src += w; 346 dst += _screenPitch; 347 } 348 } 349 304 350 void NewGui::blendRect(int x, int y, int w, int h, OverlayColor color, int level) { 305 351 #ifdef NEWGUI_256 306 352 fillRect(x, y, w, h, color); -
gui/newgui.h
diff -ur --exclude=CVS --exclude=Makefile ScummVM/gui/newgui.h ScummVM+hack/gui/newgui.h
old new 134 134 void box(int x, int y, int width, int height, OverlayColor colorA, OverlayColor colorB); 135 135 void hLine(int x, int y, int x2, OverlayColor color); 136 136 void vLine(int x, int y, int y2, OverlayColor color); 137 void getRect(Graphics::Surface *s, int x, int y, int w, int h); 138 void putRect(Graphics::Surface *s, int x, int y); 137 139 void blendRect(int x, int y, int w, int h, OverlayColor color, int level = 3); 138 140 void fillRect(int x, int y, int w, int h, OverlayColor color); 139 141 void frameRect(int x, int y, int w, int h, OverlayColor color);