Commit Graph

3063 Commits

Author SHA1 Message Date
Sam Lantinga
159e0ed15f Fixed building on iPhone 2009-12-12 00:55:13 +00:00
Sam Lantinga
d3941d1098 Allow points to be outside the window bounds, stress testing the clipping code. 2009-12-12 00:08:45 +00:00
Sam Lantinga
a127883a56 Added mouse position for button handling 2009-12-12 00:08:02 +00:00
Sam Lantinga
1ab0809779 minor notes to self 2009-12-12 00:07:26 +00:00
Sam Lantinga
54af8f9682 Fixed X11 line implementation - clip lines that are going to go outside the window. 2009-12-11 09:59:36 +00:00
Sam Lantinga
c0e3ce55fd Make sure we fully clip the first point before starting to adjust the second point. 2009-12-11 09:57:54 +00:00
Sam Lantinga
0a3768436b Added an automated test for rectangle routines, currently only testing line clipping.
Use the Cohen-Sutherland algorithm for line clipping which uses integer math and preserves ordering of clipped points.

Removed getopt() support in testsdl.c, replaced with simple argv scanning.
2009-12-11 09:22:34 +00:00
Sam Lantinga
862fd5857b Fixed constness in RenderRects() parameter 2009-12-11 09:13:51 +00:00
Sam Lantinga
e053affd71 Fixed bug #896
John Popplewell      2009-12-08 23:05:50 PST

Originally reported by AKFoerster on the mailing list.

Error decoding UTF8 Russian text to UTF-16LE on Windows, but specifically on
platforms without iconv support (the default on Windows).

Valid UTF8 characters are flagged as being overlong and then substituted by the
UNKNOWN_UNICODE character.

After studying the testiconv.c example program, reading the RFCs and putting
some printf statements in SDL_iconv.c the problem is in a test for 'Maximum
overlong sequences', specifically 4.2.1, which is carried out by the following
code:

      } else if ( p[0] >= 0xC0 ) {
        if ( (p[0] & 0xE0) != 0xC0 ) {
          /* Skip illegal sequences
            return SDL_ICONV_EILSEQ;
          */
          ch = UNKNOWN_UNICODE;
        } else {
          if ( (p[0] & 0xCE) == 0xC0 ) {    <<<<<<<< here
            overlong = SDL_TRUE;
          }
          ch = (Uint32)(p[0] & 0x1F);
          left = 1;
        }
      } else {

Here is the 2-byte encoding of a character in range 00000080 - 000007FF
    110xxxxx 10xxxxxx

The line in question is supposed to be checking for an overlong sequence which
would be less than
    11000001 10111111

which should be represented as a single byte.

BUT, the mask value (0xCE) is wrong, it isn't checking the top-most bit:
    11000001     value
    11001110     mask (incorrect)
       ^
and should be (0xDE):
    11000001     value
    11011110     mask (correct)

making the above code:

      } else if ( p[0] >= 0xC0 ) {
        if ( (p[0] & 0xE0) != 0xC0 ) {
          /* Skip illegal sequences
            return SDL_ICONV_EILSEQ;
          */
          ch = UNKNOWN_UNICODE;
        } else {
          if ( (p[0] & 0xDE) == 0xC0 ) {    <<<<<<<< here
            overlong = SDL_TRUE;
          }
          ch = (Uint32)(p[0] & 0x1F);
          left = 1;
        }
      } else {

I can supply a test program and/or a patch if required,

best regards,
John Popplewell
2009-12-11 08:03:43 +00:00
Sam Lantinga
bd7e5fd72b X11 driver compiles again, lines are not yet implemented 2009-12-10 09:27:23 +00:00
Sam Lantinga
dd8238d718 Switch to mixed case for consistency with other enumerations 2009-12-10 08:28:26 +00:00
Sam Lantinga
70a40d51b2 Added interfaces for batch drawing of points, lines and rects:
SDL_DrawPoints()
    SDL_BlendPoints()
    SDL_BlendLines()
    SDL_DrawLines()
    SDL_FillRects()
    SDL_BlendRects()
    SDL_RenderPoints()
    SDL_RenderLines()
    SDL_RenderRects()
Renamed SDL_RenderFill() to SDL_RenderRect()
2009-12-09 15:56:56 +00:00
Sam Lantinga
fd2629214e Hey, those automated tests are coming in handy! Fixed GDI rendering semantics 2009-12-07 10:08:24 +00:00
Sam Lantinga
cf1e120bcb Implemented RenderReadPixels() and RenderWritePixels() for GDI renderer. 2009-12-07 09:44:55 +00:00
Sam Lantinga
22a1cf4b25 This fixes the OpenGL rendering test, at least with my ATI card... 2009-12-07 08:02:20 +00:00
Sam Lantinga
8d70d2a2b2 Fixed crash initializing the dummy driver 2009-12-07 08:01:58 +00:00
Sam Lantinga
4969fa9624 On Windows the minimum window size may be larger than 80, so explicitly request the expected rectangle. 2009-12-07 08:01:20 +00:00
Sam Lantinga
3e60082b3f The window position is display relative, at least for now... 2009-12-06 08:39:01 +00:00
Sam Lantinga
2f755299d8 Fixed crash 2009-12-06 08:16:23 +00:00
Sam Lantinga
586f3e0dda Added an API function to query geometry of multiple monitors:
SDL_GetDisplayBounds()

Implemented multi-monitor window positions on Windows
2009-12-06 08:03:38 +00:00
Sam Lantinga
973e6e31d8 Fixed to use the correct display adapter 2009-12-06 06:21:39 +00:00
Sam Lantinga
cbe0bbeb02 Fixed compiler warnings 2009-12-05 22:13:36 +00:00
Sam Lantinga
08dd462d5a Fixed compilation on Mac OS X 10.4 2009-12-05 19:57:49 +00:00
Sam Lantinga
489e0472a0 Allow overriding the number of build jobs 2009-12-05 19:46:24 +00:00
Sam Lantinga
a90e5b78ce Made the window flag comments more consistent 2009-12-05 05:13:17 +00:00
Sam Lantinga
428aa51c43 Added related functions 2009-12-05 04:39:59 +00:00
Sam Lantinga
ab85a49998 Don't add any renderers if you can't add any displays 2009-12-04 09:01:48 +00:00
Sam Lantinga
624f566965 Fixed calls to SDL_AddRenderDriver() 2009-12-04 08:45:08 +00:00
Sam Lantinga
f11bc297a2 Fixed compiling the D3D renderer 2009-12-04 08:26:32 +00:00
Sam Lantinga
1b9db6b1d5 Added support for SDL 1.2 environment variables:
SDL_VIDEO_FULLSCREEN_DISPLAY, SDL_VIDEO_FULLSCREEN_HEAD
2009-12-03 08:43:12 +00:00
Sam Lantinga
6d60a7e907 Fixed mouse events for fullscreen windows on Mac OS X 2009-12-03 08:33:39 +00:00
Sam Lantinga
2c7165c6f4 Restore the video mode after shutting down the renderer, which fixes an error deleting the OpenGL context on Mac OS X. 2009-12-03 05:05:26 +00:00
Sam Lantinga
f6828e88f9 Missing pop over a jump 2009-12-03 04:33:05 +00:00
Sam Lantinga
262da78936 Added Ctrl-Z common key binding 2009-12-02 07:56:09 +00:00
Sam Lantinga
17424210d2 Restore the desktop mode when requested 2009-12-02 07:55:23 +00:00
Sam Lantinga
efacf93c19 If we're fullscreen on a single-head system and lose focus, minimize 2009-12-02 07:42:10 +00:00
Sam Lantinga
932374c12d On multi-display systems it's perfectly reasonable to have focus on a window on another monitor while the application is fullscreen. 2009-12-02 07:38:28 +00:00
Sam Lantinga
147d40ba98 Don't need to hide the menu bar if we're not on the main display 2009-12-02 07:28:58 +00:00
Sam Lantinga
7b253b6d72 Changed so that it's obvious that the two code blocks are related. 2009-12-02 07:25:06 +00:00
Sam Lantinga
98d4ce80cb Fixed mouse coordinates for fullscreen mode 2009-12-02 06:10:18 +00:00
Sam Lantinga
8d573748a7 The window positions are relative to the origin of the windowing system (upper left of the primary display).
Fixed the mouse positions for windowed mouse movement.
2009-12-01 12:08:34 +00:00
Sam Lantinga
3a9270299d Added support for placing windows on different displays 2009-12-01 11:50:00 +00:00
Sam Lantinga
339da23b8c Ensure that the main display is picked up first 2009-12-01 10:41:58 +00:00
Sam Lantinga
67759dc02c Allow mirrored displays, but only the primary display in a mirrored set. 2009-12-01 10:34:01 +00:00
Sam Lantinga
4fb5822326 Explicitly clear fullscreen status rather than relying on the window focus behavior. 2009-12-01 09:04:28 +00:00
Sam Lantinga
fcd49aba49 Whenever a window becomes fullscreen, shown, unminimized, and has input focus it will change the display to the corresponding fullscreen video mode.
If it loses any of those properties the desktop mode will be restored.
2009-12-01 08:56:12 +00:00
Sam Lantinga
2ce40757c1 Removed a little redundancy in the naming 2009-12-01 06:15:10 +00:00
Sam Lantinga
8adb9fc3cc Work in progress on multi-display support:
* Added display parameter to many internal functions so video modes can be set on displays that aren't the public current one.
* The fullscreen mode is associated with fullscreen windows - not displays, so different windows more naturally have a mode associated with them based on their width and height.  It's no longer necessary to specify a fullscreen mode, a default one will be picked automatically for fullscreen windows.
2009-12-01 05:57:15 +00:00
Sam Lantinga
27e8049669 Reduced the push/pop sequence to a single pair, and ported this fix over to the other architectures. 2009-11-30 21:04:25 +00:00
Sam Lantinga
e989a1a23e Fixed crash - need to save and restore rbx around cpuid, since the compiler may be assuming the stack pointer isn't being modified when filling in %0.
I did it around each call to cpuid which isn't strictly necessary, but is definitely future proof. :)
2009-11-30 19:52:34 +00:00