Ticket #8353: mouse.v2.diff
File mouse.v2.diff, 21.9 KB (added by , 20 years ago) |
---|
-
backends/sdl/graphics.cpp
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/graphics.cpp,v retrieving revision 1.13 diff -u -r1.13 graphics.cpp
41 41 {0, 0, 0} 42 42 }; 43 43 44 // Table of relative scalers magnitudes 45 // [definedScale-1][_scaleFactor-1] 46 static ScalerProc *scalersMagn[3][3] = { 47 { Normal1x, Normal2x, Normal3x }, 48 { Normal1x, Normal1x, Normal1o5x }, 49 { Normal1x, Normal1x, Normal1x } 50 }; 51 44 52 const OSystem::GraphicsMode *OSystem_SDL::getSupportedGraphicsModes() const { 45 53 return s_supportedGraphicsModes; 46 54 } … … 297 305 SDL_FreeSurface(old_screen); 298 306 SDL_FreeSurface(old_tmpscreen); 299 307 308 // Update cursor to new scale 309 blit_cursor(); 310 300 311 // Blit everything to the screen 301 312 internUpdateScreen(); 302 313 … … 327 338 _forceFull = true; 328 339 } 329 340 330 // Make sure the mouse is drawn, if it should be drawn.331 draw_mouse();332 333 341 // Check whether the palette was changed in the meantime and update the 334 342 // screen surface accordingly. 335 343 if (_paletteDirtyEnd != 0) { … … 362 370 } 363 371 #endif 364 372 373 undraw_mouse(); 374 365 375 // Force a full redraw if requested 366 376 if (_forceFull) { 367 377 _num_dirty_rects = 1; … … 457 467 } 458 468 #endif 459 469 470 draw_mouse(); 471 460 472 // Finally, blit all our changes to the screen 461 473 SDL_UpdateRects(_hwscreen, _num_dirty_rects, _dirty_rect_list); 474 } else { 475 draw_mouse(); 476 if (_num_dirty_rects) 477 SDL_UpdateRects(_hwscreen, _num_dirty_rects, _dirty_rect_list); 462 478 } 463 479 464 480 _num_dirty_rects = 0; … … 480 496 assert(_hwscreen != 0); 481 497 _full_screen ^= true; 482 498 483 undraw_mouse();484 485 499 #if defined(MACOSX) && !SDL_VERSION_ATLEAST(1, 2, 6) 486 500 // On OS X, SDL_WM_ToggleFullScreen is currently not implemented. Worse, 487 501 // before SDL 1.2.6 it always returned -1 (which would indicate a … … 544 558 add_dirty_rect(x, y, w, h); 545 559 } 546 560 547 /* FIXME: undraw mouse only if the draw rect intersects with the mouse rect */548 undraw_mouse();549 550 561 // Try to lock the screen surface 551 562 if (SDL_LockSurface(_screen) == -1) 552 563 error("SDL_LockSurface failed: %s", SDL_GetError()); … … 568 579 } 569 580 570 581 571 void OSystem_SDL::add_dirty_rect(int x, int y, int w, int h ) {582 void OSystem_SDL::add_dirty_rect(int x, int y, int w, int h, bool mouseRect) { 572 583 if (_forceFull) 573 584 return; 574 585 586 if (mouseRect) { 587 SDL_Rect *r = &_dirty_rect_list[_num_dirty_rects++]; 588 r->x = x; 589 r->y = y; 590 r->w = w; 591 r->h = h; 592 return; 593 } 594 575 595 if (_num_dirty_rects == NUM_DIRTY_RECT) 576 596 _forceFull = true; 577 597 else { … … 718 738 719 739 if (start + num > _paletteDirtyEnd) 720 740 _paletteDirtyEnd = start + num; 741 742 // Some games blink cursors with palette 743 if (!_overlayVisible) 744 blit_cursor(); 721 745 } 722 746 723 747 void OSystem_SDL::setShakePos(int shake_pos) { … … 730 754 #pragma mark - 731 755 732 756 void OSystem_SDL::showOverlay() { 733 // hide the mouse734 undraw_mouse();735 736 757 _overlayVisible = true; 737 758 clearOverlay(); 738 759 } 739 760 740 761 void OSystem_SDL::hideOverlay() { 741 // hide the mouse742 undraw_mouse();743 744 762 _overlayVisible = false; 745 763 _forceFull = true; 746 764 } … … 751 769 752 770 Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends 753 771 754 // hide the mouse755 undraw_mouse();756 757 772 // Clear the overlay by making the game screen "look through" everywhere. 758 773 SDL_Rect src, dst; 759 774 src.x = src.y = 0; … … 773 788 if (_tmpscreen == NULL) 774 789 return; 775 790 776 // hide the mouse777 undraw_mouse();778 779 791 if (SDL_LockSurface(_tmpscreen) == -1) 780 792 error("SDL_LockSurface failed: %s", SDL_GetError()); 781 793 … … 824 836 cksum_valid = false; 825 837 add_dirty_rect(x, y, w, h); 826 838 827 /* FIXME: undraw mouse only if the draw rect intersects with the mouse rect */828 undraw_mouse();829 830 839 if (SDL_LockSurface(_tmpscreen) == -1) 831 840 error("SDL_LockSurface failed: %s", SDL_GetError()); 832 841 … … 860 869 bool last = _mouseVisible; 861 870 _mouseVisible = visible; 862 871 863 if (visible) 864 draw_mouse(); 865 else 866 undraw_mouse(); 872 updateScreen(); 867 873 868 874 return last; 869 875 } 870 876 871 877 void OSystem_SDL::set_mouse_pos(int x, int y) { 872 878 if (x != _mouseCurState.x || y != _mouseCurState.y) { 873 undraw_mouse();874 879 _mouseCurState.x = x; 875 880 _mouseCurState.y = y; 876 881 updateScreen(); … … 892 897 } 893 898 } 894 899 895 void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor) { 896 897 undraw_mouse(); 898 899 assert(w <= MAX_MOUSE_W); 900 assert(h <= MAX_MOUSE_H); 901 _mouseCurState.w = w; 902 _mouseCurState.h = h; 903 900 void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor, int cursorTargetScale) { 904 901 _mouseHotspotX = hotspot_x; 905 902 _mouseHotspotY = hotspot_y; 906 903 907 904 _mouseKeycolor = keycolor; 908 905 906 _cursorTargetScale = cursorTargetScale; 907 908 if (_mouseCurState.w != (int)w || _mouseCurState.h != (int)h) { 909 _mouseCurState.w = w; 910 _mouseCurState.h = h; 911 912 if (_mouseOrigSurface) 913 SDL_FreeSurface(_mouseOrigSurface); 914 915 _mouseOrigSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, 916 _mouseCurState.w, 917 _mouseCurState.h, 918 16, 919 _hwscreen->format->Rmask, 920 _hwscreen->format->Gmask, 921 _hwscreen->format->Bmask, 922 _hwscreen->format->Amask); 923 924 if (_mouseOrigSurface == NULL) 925 error("allocating _mouseOrigSurface failed"); 926 SDL_SetColorKey(_mouseOrigSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, kMouseColorKey); 927 } 928 909 929 if (_mouseData) 910 930 free(_mouseData); 911 931 912 932 _mouseData = (byte *)malloc(w * h); 933 913 934 memcpy(_mouseData, buf, w * h); 935 blit_cursor(); 914 936 } 915 937 916 void OSystem_SDL::toggleMouseGrab() { 917 if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF) 918 SDL_WM_GrabInput(SDL_GRAB_ON); 919 else 920 SDL_WM_GrabInput(SDL_GRAB_OFF); 921 } 938 void OSystem_SDL::blit_cursor() { 939 byte *dstPtr; 940 const byte *srcPtr = _mouseData; 941 byte color; 942 int w, h; 922 943 923 void OSystem_SDL::draw_mouse() { 924 if (_mouseDrawn || !_mouseVisible) 944 if (!_mouseOrigSurface) 925 945 return; 926 946 927 int x = _mouseCurState.x - _mouseHotspotX; 928 int y = _mouseCurState.y - _mouseHotspotY; 929 int w = _mouseCurState.w; 930 int h = _mouseCurState.h; 931 byte color; 932 const byte *src = _mouseData; // Image representing the mouse 947 w = _mouseCurState.w; 948 h = _mouseCurState.h; 933 949 934 // clip the mouse rect, and addjust the src pointer accordingly 935 if (x < 0) { 936 w += x; 937 src -= x; 938 x = 0; 950 SDL_LockSurface(_mouseOrigSurface); 951 dstPtr = (byte *)_mouseOrigSurface->pixels; 952 953 for (int i = 0; i < h; i++) { 954 for (int j = 0; j < w; j++) { 955 color = *srcPtr; 956 if (color != _mouseKeycolor) { // transparent, don't draw 957 *(uint16 *)dstPtr = SDL_MapRGB(_mouseOrigSurface->format, _currentPalette[color].r, 958 _currentPalette[color].g, _currentPalette[color].b); 959 } else { 960 *(uint16 *)dstPtr = kMouseColorKey; 961 } 962 dstPtr += 2; 963 srcPtr++; 964 } 965 dstPtr += _mouseOrigSurface->pitch - w * 2; 939 966 } 940 if (y < 0) { 941 h += y; 942 src -= y * _mouseCurState.w; 943 y = 0; 967 968 int hW, hH, hH1; 969 970 if (_cursorTargetScale >= _scaleFactor) { 971 hW = w; 972 hH = hH1 = h; 973 } else { 974 hW = w * _scaleFactor / _cursorTargetScale; 975 hH = hH1 = h * _scaleFactor / _cursorTargetScale; 944 976 } 945 977 946 if (w > _screenWidth - x) 947 w = _screenWidth - x; 948 if (h > _screenHeight - y) 949 h = _screenHeight - y; 978 if (_adjustAspectRatio) 979 hH = real2Aspect(hH - 1) + 1; 950 980 951 // Quick check to see if anything has to be drawn at all952 if (w <= 0 || h <= 0)953 return;981 if (_mouseCurState.hW != hW || _mouseCurState.hH != hH) { 982 _mouseCurState.hW = hW; 983 _mouseCurState.hH = hH; 954 984 955 // Draw the mouse cursor; backup the covered area in "bak" 956 if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1) 957 error("SDL_LockSurface failed: %s", SDL_GetError()); 985 if (_mouseSurface) 986 SDL_FreeSurface(_mouseSurface); 958 987 959 // Mark as dirty 960 add_dirty_rect(x, y, w, h); 988 _mouseSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, 989 _mouseCurState.hW, 990 _mouseCurState.hH, 991 16, 992 _hwscreen->format->Rmask, 993 _hwscreen->format->Gmask, 994 _hwscreen->format->Bmask, 995 _hwscreen->format->Amask); 961 996 962 if (!_overlayVisible) { 963 byte *bak = _mouseBackup; // Surface used to backup the area obscured by the mouse 964 byte *dst; // Surface we are drawing into 965 966 dst = (byte *)_screen->pixels + y * _screenWidth + x; 967 while (h > 0) { 968 int width = w; 969 while (width > 0) { 970 *bak++ = *dst; 971 color = *src++; 972 if (color != _mouseKeycolor) // transparent, don't draw 973 *dst = color; 974 dst++; 975 width--; 976 } 977 src += _mouseCurState.w - w; 978 bak += MAX_MOUSE_W - w; 979 dst += _screenWidth - w; 980 h--; 981 } 982 983 } else { 984 uint16 *bak = (uint16 *)_mouseBackup; // Surface used to backup the area obscured by the mouse 985 byte *dst; // Surface we are drawing into 986 987 dst = (byte *)_tmpscreen->pixels + (y + 1) * _tmpscreen->pitch + (x + 1) * 2; 988 while (h > 0) { 989 int width = w; 990 while (width > 0) { 991 *bak++ = *(uint16 *)dst; 992 color = *src++; 993 if (color != 0xFF) // 0xFF = transparent, don't draw 994 *(uint16 *)dst = RGBToColor(_currentPalette[color].r, _currentPalette[color].g, _currentPalette[color].b); 995 dst += 2; 996 width--; 997 } 998 src += _mouseCurState.w - w; 999 bak += MAX_MOUSE_W - w; 1000 dst += _tmpscreen->pitch - w * 2; 1001 h--; 1002 } 997 if (_mouseSurface == NULL) 998 error("allocating _mouseSurface failed"); 999 SDL_SetColorKey(_mouseSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, kMouseColorKey); 1003 1000 } 1004 1001 1005 SDL_UnlockSurface(_overlayVisible ? _tmpscreen : _screen); 1002 SDL_LockSurface(_mouseSurface); 1003 (scalersMagn[_cursorTargetScale-1][_scaleFactor-1])((byte *)_mouseOrigSurface->pixels, 1004 _mouseOrigSurface->pitch, (byte *)_mouseSurface->pixels, _mouseSurface->pitch, 1005 _mouseCurState.w, _mouseCurState.h); 1006 1007 if (_adjustAspectRatio) 1008 stretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, hW, hH1, 0, 0, 0); 1006 1009 1007 // Finally, set the flag to indicate the mouse has been drawn 1008 _mouseDrawn = true; 1010 SDL_UnlockSurface(_mouseSurface); 1011 SDL_UnlockSurface(_mouseOrigSurface); 1012 } 1013 1014 void OSystem_SDL::toggleMouseGrab() { 1015 if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF) 1016 SDL_WM_GrabInput(SDL_GRAB_ON); 1017 else 1018 SDL_WM_GrabInput(SDL_GRAB_OFF); 1009 1019 } 1010 1020 1011 1021 void OSystem_SDL::undraw_mouse() { 1012 if (!_mouseDrawn) 1022 if (_mouseBackup.w) { 1023 if (_adjustAspectRatio) 1024 add_dirty_rect(_mouseBackup.x, aspect2Real(_mouseBackup.y), _mouseBackup.w, 1025 _mouseBackup.h); 1026 else 1027 add_dirty_rect(_mouseBackup.x, _mouseBackup.y, _mouseBackup.w, 1028 _mouseBackup.h); 1029 } 1030 } 1031 1032 void OSystem_SDL::draw_mouse() { 1033 if (!_mouseVisible) { 1034 _mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0; 1013 1035 return; 1014 _mouseDrawn = false;1036 } 1015 1037 1016 if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1) 1017 error("SDL_LockSurface failed: %s", SDL_GetError()); 1038 SDL_Rect src, dst; 1039 bool scale; 1040 1041 scale = (_scaleFactor > _cursorTargetScale); 1042 1043 dst.x = _mouseCurState.x - _mouseHotspotX; 1044 dst.y = _mouseCurState.y - _mouseHotspotY; 1045 1046 dst.w = _mouseCurState.hW; 1047 dst.h = _mouseCurState.hH; 1048 src.x = src.y = 0; 1049 1050 // clip the mouse rect, and adjust the src pointer accordingly 1051 int dx, dy; 1018 1052 1019 int old_mouse_x = _mouseCurState.x - _mouseHotspotX; 1020 int old_mouse_y = _mouseCurState.y - _mouseHotspotY; 1021 int old_mouse_w = _mouseCurState.w; 1022 int old_mouse_h = _mouseCurState.h; 1023 1024 // clip the mouse rect, and addjust the src pointer accordingly 1025 if (old_mouse_x < 0) { 1026 old_mouse_w += old_mouse_x; 1027 old_mouse_x = 0; 1028 } 1029 if (old_mouse_y < 0) { 1030 old_mouse_h += old_mouse_y; 1031 old_mouse_y = 0; 1032 } 1033 1034 if (old_mouse_w > _screenWidth - old_mouse_x) 1035 old_mouse_w = _screenWidth - old_mouse_x; 1036 if (old_mouse_h > _screenHeight - old_mouse_y) 1037 old_mouse_h = _screenHeight - old_mouse_y; 1053 dx = scale ? dst.x * _scaleFactor / _cursorTargetScale : dst.x; 1054 dy = scale ? dst.y * _scaleFactor / _cursorTargetScale : dst.y; 1055 1056 if (dst.x < 0) { 1057 dst.w += dx; 1058 src.x -= dx; 1059 dst.x = 0; 1060 } 1061 if (dst.y < 0) { 1062 dst.h += dy; 1063 src.y -= dy; 1064 dst.y = 0; 1065 } 1038 1066 1039 1067 // Quick check to see if anything has to be drawn at all 1040 if ( old_mouse_w <= 0 || old_mouse_h <= 0)1068 if (dst.w <= 0 || dst.h <= 0) 1041 1069 return; 1042 1070 1071 src.w = dst.w; 1072 src.h = dst.h; 1043 1073 1044 int x, y; 1045 if (!_overlayVisible) { 1046 byte *dst, *bak = _mouseBackup; 1047 1048 // No need to do clipping here, since draw_mouse() did that already 1049 dst = (byte *)_screen->pixels + old_mouse_y * _screenWidth + old_mouse_x; 1050 for (y = 0; y < old_mouse_h; ++y, bak += MAX_MOUSE_W, dst += _screenWidth) { 1051 for (x = 0; x < old_mouse_w; ++x) { 1052 dst[x] = bak[x]; 1053 } 1054 } 1055 1056 } else { 1074 if (_adjustAspectRatio) 1075 dst.y = real2Aspect(dst.y); 1057 1076 1058 byte *dst; 1059 uint16 *bak = (uint16 *)_mouseBackup; 1060 1061 // No need to do clipping here, since draw_mouse() did that already 1062 dst = (byte *)_tmpscreen->pixels + (old_mouse_y + 1) * _tmpscreen->pitch + (old_mouse_x + 1) * 2; 1063 for (y = 0; y < old_mouse_h; ++y, bak += MAX_MOUSE_W, dst += _tmpscreen->pitch) { 1064 for (x = 0; x < old_mouse_w; ++x) { 1065 *((uint16 *)dst + x) = bak[x]; 1066 } 1067 } 1068 } 1077 _mouseBackup.x = dst.x; 1078 _mouseBackup.y = dst.y; 1079 _mouseBackup.w = dst.w; 1080 _mouseBackup.h = dst.h; 1069 1081 1070 add_dirty_rect(old_mouse_x, old_mouse_y, old_mouse_w, old_mouse_h); 1082 dst.x *= _scaleFactor; 1083 dst.y *= _scaleFactor; 1071 1084 1072 SDL_UnlockSurface(_overlayVisible ? _tmpscreen : _screen);1073 } 1085 if (SDL_BlitSurface(_mouseSurface, &src, _hwscreen, &dst) != 0) 1086 error("SDL_BlitSurface failed: %s", SDL_GetError()); 1074 1087 1088 add_dirty_rect(dst.x, dst.y, dst.w, dst.h, true); 1089 } 1075 1090 1076 1091 #pragma mark - 1077 1092 #pragma mark --- Mouse --- -
backends/sdl/sdl-common.h
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v retrieving revision 1.64 diff -u -r1.64 sdl-common.h
64 64 void warpMouse(int x, int y); 65 65 66 66 // Set the bitmap that's used when drawing the cursor. 67 void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor );67 void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor, int cursorTargetScale); 68 68 69 69 // Shaking is used in SCUMM. Set current shake position. 70 70 void setShakePos(int shake_pos); … … 213 213 } km; 214 214 215 215 struct MousePos { 216 int16 x, y, w, h ;217 MousePos() : x(0), y(0), w(0), h(0) {}216 int16 x, y, w, h, hW, hH; 217 MousePos() : x(0), y(0), w(0), h(0), hW(0), hH(0) {} 218 218 }; 219 219 220 220 // mouse 221 221 bool _mouseVisible; 222 222 bool _mouseDrawn; 223 223 byte *_mouseData; 224 byte *_mouseBackup;224 SDL_Rect _mouseBackup; 225 225 MousePos _mouseCurState; 226 226 int16 _mouseHotspotX; 227 227 int16 _mouseHotspotY; 228 228 byte _mouseKeycolor; 229 int _cursorTargetScale; 230 SDL_Surface *_mouseOrigSurface; 231 SDL_Surface *_mouseSurface; 232 enum { 233 kMouseColorKey = 1 234 }; 229 235 230 236 // joystick 231 237 SDL_Joystick *_joystick; … … 248 254 void add_dirty_rgn_auto(const byte *buf); 249 255 void mk_checksums(const byte *buf); 250 256 251 virtual void add_dirty_rect(int x, int y, int w, int h );257 virtual void add_dirty_rect(int x, int y, int w, int h, bool mouseRect = false); 252 258 253 259 void draw_mouse(); 254 260 void undraw_mouse(); 261 void blit_cursor(); 255 262 /** Set the position of the virtual mouse cursor. */ 256 263 void set_mouse_pos(int x, int y); 257 264 void fillMouseEvent(Event &event, int x, int y); -
backends/sdl/sdl.cpp
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl.cpp,v retrieving revision 1.73 diff -u -r1.73 sdl.cpp
97 97 _tmpscreen(0), _overlayVisible(false), 98 98 _samplesPerSec(0), 99 99 _cdrom(0), _scaler_proc(0), _modeChanged(false), _dirty_checksums(0), 100 _mouseVisible(false), _mouseDrawn(false), _mouseData(0), 101 _mouse HotspotX(0), _mouseHotspotY(0),100 _mouseVisible(false), _mouseDrawn(false), _mouseData(0), _mouseSurface(0), 101 _mouseOrigSurface(0), _mouseHotspotX(0), _mouseHotspotY(0), _cursorTargetScale(1), 102 102 _currentShakePos(0), _newShakePos(0), 103 103 _paletteDirtyStart(0), _paletteDirtyEnd(0), 104 104 _graphicsMutex(0) { … … 106 106 // allocate palette storage 107 107 _currentPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256); 108 108 109 // allocate the dirty rect storage 110 _mouseBackup = (byte *)malloc(MAX_MOUSE_W * MAX_MOUSE_H * MAX_SCALING * 2); 109 _mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0; 111 110 112 111 // reset mouse state 113 112 memset(&km, 0, sizeof(km)); … … 121 120 if (_dirty_checksums) 122 121 free(_dirty_checksums); 123 122 free(_currentPalette); 124 free(_mouseBackup);125 123 deleteMutex(_graphicsMutex); 126 124 127 125 SDL_ShowCursor(SDL_ENABLE); -
common/scaler.cpp
RCS file: /cvsroot/scummvm/scummvm/common/scaler.cpp,v retrieving revision 1.63 diff -u -r1.63 scaler.cpp
169 169 } 170 170 } 171 171 172 #define INTERPOLATE INTERPOLATE<bitFormat> 173 #define Q_INTERPOLATE Q_INTERPOLATE<bitFormat> 174 175 /** 176 * Trivial nearest-neighbour 1.5x scaler. 177 */ 178 template<int bitFormat> 179 void Normal1o5xTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, 180 int width, int height) { 181 uint8 *r; 182 const uint32 dstPitch2 = dstPitch * 2; 183 const uint32 dstPitch3 = dstPitch * 3; 184 const uint32 srcPitch2 = srcPitch * 2; 185 186 assert(((int)dstPtr & 1) == 0); 187 while (height) { 188 r = dstPtr; 189 for (int i = 0; i < width; i += 2, r += 6) { 190 uint16 color0 = *(((const uint16 *)srcPtr) + i); 191 uint16 color1 = *(((const uint16 *)srcPtr) + i + 1); 192 uint16 color2 = *(((const uint16 *)(srcPtr + srcPitch)) + i); 193 uint16 color3 = *(((const uint16 *)(srcPtr + srcPitch)) + i + 1); 194 195 *(uint16 *)(r + 0) = color0; 196 *(uint16 *)(r + 2) = INTERPOLATE(color0, color1); 197 *(uint16 *)(r + 4) = color1; 198 *(uint16 *)(r + 0 + dstPitch) = INTERPOLATE(color0, color2); 199 *(uint16 *)(r + 2 + dstPitch) = Q_INTERPOLATE(color0, color1, color2, color3); 200 *(uint16 *)(r + 4 + dstPitch) = INTERPOLATE(color1, color3); 201 *(uint16 *)(r + 0 + dstPitch2) = color2; 202 *(uint16 *)(r + 2 + dstPitch2) = INTERPOLATE(color2, color3); 203 *(uint16 *)(r + 4 + dstPitch2) = color3; 204 } 205 srcPtr += srcPitch2; 206 dstPtr += dstPitch3; 207 height -= 2; 208 } 209 } 210 MAKE_WRAPPER(Normal1o5x) 211 172 212 /** 173 213 * The Scale2x filter, also known as AdvMame2x. 174 214 * See also http://scale2x.sourceforge.net -
common/scaler.h
RCS file: /cvsroot/scummvm/scummvm/common/scaler.h,v retrieving revision 1.26 diff -u -r1.26 scaler.h
41 41 DECLARE_SCALER(Normal1x); 42 42 DECLARE_SCALER(Normal2x); 43 43 DECLARE_SCALER(Normal3x); 44 DECLARE_SCALER(Normal1o5x); 44 45 DECLARE_SCALER(TV2x); 45 46 DECLARE_SCALER(DotMatrix); 46 47 DECLARE_SCALER(HQ2x); -
common/system.h
RCS file: /cvsroot/scummvm/scummvm/common/system.h,v retrieving revision 1.70 diff -u -r1.70 system.h
338 338 /** 339 339 * Set the bitmap used for drawing the cursor. 340 340 * 341 * @param buf the pixmap data to be used (8bit/pixel) 342 * @param w width of the mouse cursor 343 * @param h height of the mouse cursor 344 * @param hotspotX horizontal offset from the left side to the hotspot 345 * @param hotspotY vertical offset from the top side to the hotspot 346 * @param keycolor transparency color index 341 * @param buf the pixmap data to be used (8bit/pixel) 342 * @param w width of the mouse cursor 343 * @param h height of the mouse cursor 344 * @param hotspotX horizontal offset from the left side to the hotspot 345 * @param hotspotY vertical offset from the top side to the hotspot 346 * @param keycolor transparency color index 347 * @param cursorTargetScale scale factor which cursor is designed for 347 348 */ 348 virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255 ) = 0;349 virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1) = 0; 349 350 350 351 //@} 351 352 -
scumm/cursor.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/cursor.cpp,v retrieving revision 2.18 diff -u -r2.18 cursor.cpp
111 111 112 112 void ScummEngine::updateCursor() { 113 113 _system->setMouseCursor(_grabbedCursor, _cursor.width, _cursor.height, 114 _cursor.hotspotX, _cursor.hotspotY); 114 _cursor.hotspotX, _cursor.hotspotY, 255, 115 (_features & GF_2X_CURSORS ? 2 : 1)); 115 116 } 116 117 117 118 void ScummEngine_v6::grabCursor(int x, int y, int w, int h) { -
scumm/scumm.cpp
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v retrieving revision 1.236 diff -u -r1.236 scumm.cpp
2809 2809 // Games starting freddi use 640x480 2810 2810 if (game.heversion >= 71) { 2811 2811 game.features |= GF_DEFAULT_TO_1X_SCALER; 2812 } else if (game.heversion == 70) { 2813 game.features |= GF_2X_CURSORS; 2812 2814 } 2813 2815 2814 2816 switch (game.version) { -
scumm/scumm.h
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v retrieving revision 1.502 diff -u -r1.502 scumm.h
112 112 GF_FEW_LOCALS = 1 << 13, 113 113 GF_HUMONGOUS = 1 << 14, 114 114 GF_MULTIPLE_VERSIONS = 1 << 15, 115 GF_2X_CURSORS = 1 << 16, 115 116 116 117 GF_FMTOWNS = 1 << 17, 117 118 GF_AMIGA = 1 << 18,