diff --git a/VisualC/SDL/SDL_VS2008.vcproj b/VisualC/SDL/SDL_VS2008.vcproj
index 8c583a11e..e1725b197 100644
--- a/VisualC/SDL/SDL_VS2008.vcproj
+++ b/VisualC/SDL/SDL_VS2008.vcproj
@@ -607,7 +607,7 @@
>
+
-
+
@@ -339,7 +340,6 @@ echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_r
-
@@ -365,6 +365,8 @@ echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_r
+
+
@@ -452,8 +454,6 @@ echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_r
-
-
diff --git a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
index 63aae640b..bc3ce005a 100755
--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
+++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
@@ -73,6 +73,10 @@
043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */; };
043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */; };
043DD77210FD8A0000DED673 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76E10FD8A0000DED673 /* SDL_drawrect.c */; };
+ 04409BA612FA989600FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA212FA989600FB9AA8 /* mmx.h */; };
+ 04409BA712FA989600FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */; };
+ 04409BA812FA989600FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */; };
+ 04409BA912FA989600FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */; };
04461DEE0EA76BA3006C462D /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04461DED0EA76BA3006C462D /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; };
044E5FB511E6069F0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5FB311E6069F0076F181 /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; };
044E5FB611E6069F0076F181 /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5FB411E6069F0076F181 /* SDL_input.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -223,9 +227,6 @@
FDA684660DF2374E00F98A1A /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683190DF2374E00F98A1A /* SDL_surface.c */; };
FDA684670DF2374E00F98A1A /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */; };
FDA684680DF2374E00F98A1A /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6831B0DF2374E00F98A1A /* SDL_video.c */; };
- FDA684690DF2374E00F98A1A /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6831C0DF2374E00F98A1A /* SDL_yuv_mmx.c */; };
- FDA6846A0DF2374E00F98A1A /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6831D0DF2374E00F98A1A /* SDL_yuv_sw.c */; };
- FDA6846B0DF2374E00F98A1A /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA6831E0DF2374E00F98A1A /* SDL_yuv_sw_c.h */; };
FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F50DF244C800F98A1A /* SDL_nullevents.c */; };
FDA685FC0DF244C800F98A1A /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA685F60DF244C800F98A1A /* SDL_nullevents_c.h */; };
FDA685FF0DF244C800F98A1A /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F90DF244C800F98A1A /* SDL_nullvideo.c */; };
@@ -328,6 +329,10 @@
043DD76C10FD8A0000DED673 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = ""; };
043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = ""; };
043DD76E10FD8A0000DED673 /* SDL_drawrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawrect.c; sourceTree = ""; };
+ 04409BA212FA989600FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = ""; };
+ 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = ""; };
+ 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = ""; };
+ 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = ""; };
04461DED0EA76BA3006C462D /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic.h; path = ../../include/SDL_haptic.h; sourceTree = SOURCE_ROOT; };
044E5FB311E6069F0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; };
044E5FB411E6069F0076F181 /* SDL_input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_input.h; path = ../../include/SDL_input.h; sourceTree = SOURCE_ROOT; };
@@ -505,9 +510,6 @@
FDA683190DF2374E00F98A1A /* SDL_surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_surface.c; sourceTree = ""; };
FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysvideo.h; sourceTree = ""; };
FDA6831B0DF2374E00F98A1A /* SDL_video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_video.c; sourceTree = ""; };
- FDA6831C0DF2374E00F98A1A /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = ""; };
- FDA6831D0DF2374E00F98A1A /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = ""; };
- FDA6831E0DF2374E00F98A1A /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = ""; };
FDA685F50DF244C800F98A1A /* SDL_nullevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullevents.c; sourceTree = ""; };
FDA685F60DF244C800F98A1A /* SDL_nullevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullevents_c.h; sourceTree = ""; };
FDA685F90DF244C800F98A1A /* SDL_nullvideo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullvideo.c; sourceTree = ""; };
@@ -659,9 +661,13 @@
isa = PBXGroup;
children = (
041B2CE812FA0F680087D585 /* opengles */,
+ 041B2CEC12FA0F680087D585 /* software */,
+ 04409BA212FA989600FB9AA8 /* mmx.h */,
041B2CEA12FA0F680087D585 /* SDL_render.c */,
041B2CEB12FA0F680087D585 /* SDL_sysrender.h */,
- 041B2CEC12FA0F680087D585 /* software */,
+ 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */,
+ 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */,
+ 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */,
);
name = render;
path = ../../src/render;
@@ -1113,9 +1119,6 @@
FDA683190DF2374E00F98A1A /* SDL_surface.c */,
FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */,
FDA6831B0DF2374E00F98A1A /* SDL_video.c */,
- FDA6831C0DF2374E00F98A1A /* SDL_yuv_mmx.c */,
- FDA6831D0DF2374E00F98A1A /* SDL_yuv_sw.c */,
- FDA6831E0DF2374E00F98A1A /* SDL_yuv_sw_c.h */,
);
name = video;
path = ../../src/video;
@@ -1179,7 +1182,6 @@
FDA6845D0DF2374E00F98A1A /* SDL_pixels_c.h in Headers */,
FDA684630DF2374E00F98A1A /* SDL_RLEaccel_c.h in Headers */,
FDA684670DF2374E00F98A1A /* SDL_sysvideo.h in Headers */,
- FDA6846B0DF2374E00F98A1A /* SDL_yuv_sw_c.h in Headers */,
FDA685FC0DF244C800F98A1A /* SDL_nullevents_c.h in Headers */,
FDA686000DF244C800F98A1A /* SDL_nullvideo.h in Headers */,
FD5F9D300E0E08B3008E885B /* SDL_joystick_c.h in Headers */,
@@ -1220,6 +1222,8 @@
04FFAB9812E23BDC00BA343D /* SDL_shape.h in Headers */,
041B2CD912FA0E9E0087D585 /* SDL_render.h in Headers */,
041B2CF212FA0F680087D585 /* SDL_sysrender.h in Headers */,
+ 04409BA612FA989600FB9AA8 /* mmx.h in Headers */,
+ 04409BA812FA989600FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1427,8 +1431,6 @@
FDA684640DF2374E00F98A1A /* SDL_stretch.c in Sources */,
FDA684660DF2374E00F98A1A /* SDL_surface.c in Sources */,
FDA684680DF2374E00F98A1A /* SDL_video.c in Sources */,
- FDA684690DF2374E00F98A1A /* SDL_yuv_mmx.c in Sources */,
- FDA6846A0DF2374E00F98A1A /* SDL_yuv_sw.c in Sources */,
FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */,
FDA685FF0DF244C800F98A1A /* SDL_nullvideo.c in Sources */,
FD5F9D2F0E0E08B3008E885B /* SDL_joystick.c in Sources */,
@@ -1469,6 +1471,8 @@
041B2CF012FA0F680087D585 /* SDL_renderer_gles.c in Sources */,
041B2CF112FA0F680087D585 /* SDL_render.c in Sources */,
041B2CF312FA0F680087D585 /* SDL_renderer_sw.c in Sources */,
+ 04409BA712FA989600FB9AA8 /* SDL_yuv_mmx.c in Sources */,
+ 04409BA912FA989600FB9AA8 /* SDL_yuv_sw.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
index 882a2dd7a..9c774375e 100755
--- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
@@ -131,6 +131,14 @@
041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; };
041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; };
041B2CAD12FA0D680087D585 /* SDL_renderer_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2CA112FA0D680087D585 /* SDL_renderer_sw.c */; };
+ 04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; };
+ 04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; };
+ 04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; };
+ 04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; };
+ 04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; };
+ 04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; };
+ 04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; };
+ 04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; };
044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; };
044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; };
0469A10B12EE4BF100B846D6 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0469A10912EE4BF100B846D6 /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -244,7 +252,6 @@
04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; };
04BD011B12E6671800899322 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; };
04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; };
- 04BD013212E6671800899322 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF0412E6671800899322 /* mmx.h */; };
04BD016F12E6671800899322 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4812E6671800899322 /* SDL_alphamult.c */; };
04BD017012E6671800899322 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4912E6671800899322 /* SDL_alphamult.h */; };
04BD017112E6671800899322 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */; };
@@ -285,9 +292,6 @@
04BD019B12E6671800899322 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; };
04BD019C12E6671800899322 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; };
04BD019D12E6671800899322 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; };
- 04BD019E12E6671800899322 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7712E6671800899322 /* SDL_yuv_mmx.c */; };
- 04BD019F12E6671800899322 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7812E6671800899322 /* SDL_yuv_sw.c */; };
- 04BD01A012E6671800899322 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7912E6671800899322 /* SDL_yuv_sw_c.h */; };
04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; };
04BD01DC12E6671800899322 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; };
04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; };
@@ -457,7 +461,6 @@
04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; };
04BD033512E6671800899322 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; };
04BD033612E6671800899322 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; };
- 04BD034C12E6671800899322 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF0412E6671800899322 /* mmx.h */; };
04BD038912E6671800899322 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4812E6671800899322 /* SDL_alphamult.c */; };
04BD038A12E6671800899322 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4912E6671800899322 /* SDL_alphamult.h */; };
04BD038B12E6671800899322 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */; };
@@ -498,9 +501,6 @@
04BD03B512E6671800899322 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; };
04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; };
04BD03B712E6671800899322 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; };
- 04BD03B812E6671800899322 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7712E6671800899322 /* SDL_yuv_mmx.c */; };
- 04BD03B912E6671800899322 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7812E6671800899322 /* SDL_yuv_sw.c */; };
- 04BD03BA12E6671800899322 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7912E6671800899322 /* SDL_yuv_sw_c.h */; };
04BD03F312E6671800899322 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; };
04BD03F412E6671800899322 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; };
04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; };
@@ -701,6 +701,10 @@
041B2C9E12FA0D680087D585 /* SDL_render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render.c; sourceTree = ""; };
041B2C9F12FA0D680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = ""; };
041B2CA112FA0D680087D585 /* SDL_renderer_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_renderer_sw.c; sourceTree = ""; };
+ 04409B8D12FA97ED00FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = ""; };
+ 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = ""; };
+ 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = ""; };
+ 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = ""; };
044E5F8411E6051C0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; };
0469A10912EE4BF100B846D6 /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendmode.h; path = ../../include/SDL_blendmode.h; sourceTree = SOURCE_ROOT; };
04BDFD7412E6671700899322 /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_atomic.c; sourceTree = ""; };
@@ -814,7 +818,6 @@
04BDFEE912E6671800899322 /* SDL_nullevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullevents_c.h; sourceTree = ""; };
04BDFEEC12E6671800899322 /* SDL_nullvideo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullvideo.c; sourceTree = ""; };
04BDFEED12E6671800899322 /* SDL_nullvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullvideo.h; sourceTree = ""; };
- 04BDFF0412E6671800899322 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = ""; };
04BDFF4812E6671800899322 /* SDL_alphamult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_alphamult.c; sourceTree = ""; };
04BDFF4912E6671800899322 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = ""; };
04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = ""; };
@@ -855,9 +858,6 @@
04BDFF7412E6671800899322 /* SDL_surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_surface.c; sourceTree = ""; };
04BDFF7512E6671800899322 /* SDL_sysvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysvideo.h; sourceTree = ""; };
04BDFF7612E6671800899322 /* SDL_video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_video.c; sourceTree = ""; };
- 04BDFF7712E6671800899322 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = ""; };
- 04BDFF7812E6671800899322 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = ""; };
- 04BDFF7912E6671800899322 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = ""; };
04BDFFB812E6671800899322 /* imKStoUCS.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = imKStoUCS.c; sourceTree = ""; };
04BDFFB912E6671800899322 /* imKStoUCS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imKStoUCS.h; sourceTree = ""; };
04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11clipboard.c; sourceTree = ""; };
@@ -1188,8 +1188,12 @@
children = (
041B2C9A12FA0D680087D585 /* opengl */,
041B2CA012FA0D680087D585 /* software */,
+ 04409B8D12FA97ED00FB9AA8 /* mmx.h */,
041B2C9E12FA0D680087D585 /* SDL_render.c */,
041B2C9F12FA0D680087D585 /* SDL_sysrender.h */,
+ 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */,
+ 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */,
+ 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */,
);
name = render;
path = ../../src/render;
@@ -1483,7 +1487,6 @@
04BDFEE712E6671800899322 /* dummy */,
04BDFFB712E6671800899322 /* x11 */,
04BDFFD712E6671800899322 /* Xext */,
- 04BDFF0412E6671800899322 /* mmx.h */,
04BDFF4812E6671800899322 /* SDL_alphamult.c */,
04BDFF4912E6671800899322 /* SDL_alphamult.h */,
04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */,
@@ -1524,9 +1527,6 @@
04BDFF7412E6671800899322 /* SDL_surface.c */,
04BDFF7512E6671800899322 /* SDL_sysvideo.h */,
04BDFF7612E6671800899322 /* SDL_video.c */,
- 04BDFF7712E6671800899322 /* SDL_yuv_mmx.c */,
- 04BDFF7812E6671800899322 /* SDL_yuv_sw.c */,
- 04BDFF7912E6671800899322 /* SDL_yuv_sw_c.h */,
);
name = video;
path = ../../src/video;
@@ -1893,7 +1893,6 @@
04BD010312E6671800899322 /* SDL_cocoawindow.h in Headers */,
04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */,
04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */,
- 04BD013212E6671800899322 /* mmx.h in Headers */,
04BD017012E6671800899322 /* SDL_alphamult.h in Headers */,
04BD017612E6671800899322 /* SDL_blit.h in Headers */,
04BD017B12E6671800899322 /* SDL_blit_auto.h in Headers */,
@@ -1907,7 +1906,6 @@
04BD019712E6671800899322 /* SDL_RLEaccel_c.h in Headers */,
04BD019912E6671800899322 /* SDL_shape_internals.h in Headers */,
04BD019C12E6671800899322 /* SDL_sysvideo.h in Headers */,
- 04BD01A012E6671800899322 /* SDL_yuv_sw_c.h in Headers */,
04BD01DC12E6671800899322 /* imKStoUCS.h in Headers */,
04BD01DE12E6671800899322 /* SDL_x11clipboard.h in Headers */,
04BD01E012E6671800899322 /* SDL_x11dyn.h in Headers */,
@@ -1942,6 +1940,8 @@
0469A10B12EE4BF100B846D6 /* SDL_blendmode.h in Headers */,
041B2C9512FA0D2A0087D585 /* SDL_render.h in Headers */,
041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */,
+ 04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */,
+ 04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2016,7 +2016,6 @@
04BD031D12E6671800899322 /* SDL_cocoawindow.h in Headers */,
04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */,
04BD033612E6671800899322 /* SDL_nullvideo.h in Headers */,
- 04BD034C12E6671800899322 /* mmx.h in Headers */,
04BD038A12E6671800899322 /* SDL_alphamult.h in Headers */,
04BD039012E6671800899322 /* SDL_blit.h in Headers */,
04BD039512E6671800899322 /* SDL_blit_auto.h in Headers */,
@@ -2030,7 +2029,6 @@
04BD03B112E6671800899322 /* SDL_RLEaccel_c.h in Headers */,
04BD03B312E6671800899322 /* SDL_shape_internals.h in Headers */,
04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */,
- 04BD03BA12E6671800899322 /* SDL_yuv_sw_c.h in Headers */,
04BD03F412E6671800899322 /* imKStoUCS.h in Headers */,
04BD03F612E6671800899322 /* SDL_x11clipboard.h in Headers */,
04BD03F812E6671800899322 /* SDL_x11dyn.h in Headers */,
@@ -2065,6 +2063,8 @@
0469A10D12EE4BF100B846D6 /* SDL_blendmode.h in Headers */,
041B2C9612FA0D2A0087D585 /* SDL_render.h in Headers */,
041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */,
+ 04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */,
+ 04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2412,8 +2412,6 @@
04BD019A12E6671800899322 /* SDL_stretch.c in Sources */,
04BD019B12E6671800899322 /* SDL_surface.c in Sources */,
04BD019D12E6671800899322 /* SDL_video.c in Sources */,
- 04BD019E12E6671800899322 /* SDL_yuv_mmx.c in Sources */,
- 04BD019F12E6671800899322 /* SDL_yuv_sw.c in Sources */,
04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */,
04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */,
04BD01DF12E6671800899322 /* SDL_x11dyn.c in Sources */,
@@ -2443,6 +2441,8 @@
041B2CA312FA0D680087D585 /* SDL_renderer_gl.c in Sources */,
041B2CA512FA0D680087D585 /* SDL_render.c in Sources */,
041B2CA712FA0D680087D585 /* SDL_renderer_sw.c in Sources */,
+ 04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */,
+ 04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2539,8 +2539,6 @@
04BD03B412E6671800899322 /* SDL_stretch.c in Sources */,
04BD03B512E6671800899322 /* SDL_surface.c in Sources */,
04BD03B712E6671800899322 /* SDL_video.c in Sources */,
- 04BD03B812E6671800899322 /* SDL_yuv_mmx.c in Sources */,
- 04BD03B912E6671800899322 /* SDL_yuv_sw.c in Sources */,
04BD03F312E6671800899322 /* imKStoUCS.c in Sources */,
04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */,
04BD03F712E6671800899322 /* SDL_x11dyn.c in Sources */,
@@ -2570,6 +2568,8 @@
041B2CA912FA0D680087D585 /* SDL_renderer_gl.c in Sources */,
041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */,
041B2CAD12FA0D680087D585 /* SDL_renderer_sw.c in Sources */,
+ 04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */,
+ 04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/include/SDL_pixels.h b/include/SDL_pixels.h
index 766350783..ddf65355d 100644
--- a/include/SDL_pixels.h
+++ b/include/SDL_pixels.h
@@ -122,18 +122,26 @@ enum
#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
-#define SDL_BYTESPERPIXEL(X) (((X) >> 0) & 0xFF)
+#define SDL_BYTESPERPIXEL(X) \
+ (SDL_ISPIXELFORMAT_FOURCC(X) ? \
+ ((((X) == SDL_PIXELFORMAT_YV12) || \
+ ((X) == SDL_PIXELFORMAT_IYUV) || \
+ ((X) == SDL_PIXELFORMAT_YUY2) || \
+ ((X) == SDL_PIXELFORMAT_UYVY) || \
+ ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
#define SDL_ISPIXELFORMAT_INDEXED(format) \
- ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
- (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))
+ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
+ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
#define SDL_ISPIXELFORMAT_ALPHA(format) \
- ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
- (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
- (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
- (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))
+ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
+ ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))
#define SDL_ISPIXELFORMAT_FOURCC(format) \
((format) && !((format) & 0x80000000))
diff --git a/include/SDL_rect.h b/include/SDL_rect.h
index d4f3b626c..4229d34db 100644
--- a/include/SDL_rect.h
+++ b/include/SDL_rect.h
@@ -69,25 +69,6 @@ typedef struct SDL_Rect
int w, h;
} SDL_Rect;
-/**
- * \brief A structure used to track dirty rectangles
- *
- * \sa SDL_AddDirtyRect
- * \sa SDL_ClearDirtyRects
- * \sa SDL_FreeDirtyRects
- */
-typedef struct SDL_DirtyRect
-{
- SDL_Rect rect;
- struct SDL_DirtyRect *next;
-} SDL_DirtyRect;
-
-typedef struct SDL_DirtyRectList
-{
- SDL_DirtyRect *list;
- SDL_DirtyRect *free;
-} SDL_DirtyRectList;
-
/**
* \brief Returns true if the rectangle has no area.
*/
@@ -143,22 +124,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
int *Y1, int *X2,
int *Y2);
-/**
- * \brief Add a rectangle to a dirty rectangle list
- */
-extern DECLSPEC void SDLCALL SDL_AddDirtyRect(SDL_DirtyRectList * list, const SDL_Rect * rect);
-
-/**
- * \brief Remove all rectangles associated with a dirty rectangle list
- */
-extern DECLSPEC void SDLCALL SDL_ClearDirtyRects(SDL_DirtyRectList * list);
-
-/**
- * \brief Free memory associated with a dirty rectangle list
- */
-extern DECLSPEC void SDLCALL SDL_FreeDirtyRects(SDL_DirtyRectList * list);
-
-
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
diff --git a/include/SDL_render.h b/include/SDL_render.h
index 8fe862392..e48119f72 100644
--- a/include/SDL_render.h
+++ b/include/SDL_render.h
@@ -61,7 +61,7 @@ typedef struct SDL_RendererInfo
const char *name; /**< The name of the renderer */
Uint32 flags; /**< Supported ::SDL_RendererFlags */
Uint32 num_texture_formats; /**< The number of available texture formats */
- Uint32 texture_formats[50]; /**< The available texture formats */
+ Uint32 texture_formats[16]; /**< The available texture formats */
int max_texture_width; /**< The maximimum texture width */
int max_texture_height; /**< The maximimum texture height */
} SDL_RendererInfo;
@@ -203,22 +203,6 @@ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
Uint32 * format, int *access,
int *w, int *h);
-/**
- * \brief Query the pixels of a texture, if the texture does not need to be
- * locked for pixel access.
- *
- * \param texture A texture to be queried, which was created with
- * ::SDL_TEXTUREACCESS_STREAMING.
- * \param pixels A pointer filled with a pointer to the pixels for the
- * texture.
- * \param pitch A pointer filled in with the pitch of the pixel data.
- *
- * \return 0 on success, or -1 if the texture is not valid, or must be locked
- * for pixel access.
- */
-extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_Texture * texture,
- void **pixels, int *pitch);
-
/**
* \brief Set an additional color value used in render copy operations.
*
@@ -299,7 +283,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
/**
* \brief Get the blend mode used for texture copy operations.
*
- * \param texture The texture to query.
+ * \param texture The texture to query.
* \param blendMode A pointer filled in with the current blend mode.
*
* \return 0 on success, or -1 if the texture is not valid.
@@ -312,7 +296,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
/**
* \brief Update the given texture rectangle with new pixel data.
*
- * \param texture The texture to update
+ * \param texture The texture to update
* \param rect A pointer to the rectangle of pixels to update, or NULL to
* update the entire texture.
* \param pixels The raw pixel data.
@@ -329,50 +313,29 @@ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
/**
* \brief Lock a portion of the texture for pixel access.
*
- * \param texture The texture to lock for access, which was created with
+ * \param texture The texture to lock for access, which was created with
* ::SDL_TEXTUREACCESS_STREAMING.
* \param rect A pointer to the rectangle to lock for access. If the rect
* is NULL, the entire texture will be locked.
- * \param markDirty If this is nonzero, the locked area will be marked dirty
- * when the texture is unlocked.
* \param pixels This is filled in with a pointer to the locked pixels,
* appropriately offset by the locked area.
* \param pitch This is filled in with the pitch of the locked pixels.
*
- * \return 0 on success, or -1 if the texture is not valid or was created with
- * ::SDL_TEXTUREACCESS_STATIC.
+ * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
*
- * \sa SDL_DirtyTexture()
* \sa SDL_UnlockTexture()
*/
extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
const SDL_Rect * rect,
- int markDirty, void **pixels,
- int *pitch);
+ void **pixels, int *pitch);
/**
- * \brief Unlock a texture, uploading the changes to renderer memory, if needed.
+ * \brief Unlock a texture, uploading the changes to video memory, if needed.
*
* \sa SDL_LockTexture()
- * \sa SDL_DirtyTexture()
*/
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
-/**
- * \brief Mark the specified rectangles of the texture as dirty.
- *
- * \param texture The texture to mark dirty, which was created with
- * ::SDL_TEXTUREACCESS_STREAMING.
- * \param numrects The number of rectangles pointed to by rects.
- * \param rects The pointer to an array of dirty rectangles.
- *
- * \sa SDL_LockTexture()
- * \sa SDL_UnlockTexture()
- */
-extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_Texture * texture,
- int numrects,
- const SDL_Rect * rects);
-
/**
* \brief Set the color used for drawing operations (Fill and Line).
*
diff --git a/src/SDL_compat.c b/src/SDL_compat.c
index ee0427ab3..96fadcb31 100644
--- a/src/SDL_compat.c
+++ b/src/SDL_compat.c
@@ -28,7 +28,6 @@
#include "video/SDL_sysvideo.h"
#include "video/SDL_pixels_c.h"
-#include "video/SDL_yuv_sw_c.h"
static SDL_Window *SDL_VideoWindow = NULL;
static SDL_Renderer *SDL_VideoRenderer = NULL;
@@ -344,13 +343,10 @@ GetEnvironmentWindowPosition(int w, int h, int *x, int *y)
static SDL_Surface *
CreateVideoSurface(SDL_Texture * texture)
{
- SDL_Surface *surface;
Uint32 format;
int w, h;
int bpp;
Uint32 Rmask, Gmask, Bmask, Amask;
- void *pixels;
- int pitch;
if (SDL_QueryTexture(texture, &format, NULL, &w, &h) < 0) {
return NULL;
@@ -362,15 +358,7 @@ CreateVideoSurface(SDL_Texture * texture)
return NULL;
}
- if (SDL_QueryTexturePixels(texture, &pixels, &pitch) == 0) {
- surface =
- SDL_CreateRGBSurfaceFrom(pixels, w, h, bpp, pitch, Rmask, Gmask,
- Bmask, Amask);
- } else {
- surface =
- SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask);
- }
- return surface;
+ return SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask);
}
static void
@@ -412,8 +400,6 @@ SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags)
int w, h;
Uint32 format;
int access;
- void *pixels;
- int pitch;
/* We can't resize something we don't have... */
if (!SDL_VideoWindow) {
@@ -454,15 +440,10 @@ SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags)
SDL_VideoSurface->w = width;
SDL_VideoSurface->h = height;
- if (SDL_QueryTexturePixels(SDL_VideoTexture, &pixels, &pitch) == 0) {
- SDL_VideoSurface->pixels = pixels;
- SDL_VideoSurface->pitch = pitch;
- } else {
- SDL_CalculatePitch(SDL_VideoSurface);
- SDL_VideoSurface->pixels =
- SDL_realloc(SDL_VideoSurface->pixels,
- SDL_VideoSurface->h * SDL_VideoSurface->pitch);
- }
+ SDL_CalculatePitch(SDL_VideoSurface);
+ SDL_VideoSurface->pixels =
+ SDL_realloc(SDL_VideoSurface->pixels,
+ SDL_VideoSurface->h * SDL_VideoSurface->pitch);
SDL_SetClipRect(SDL_VideoSurface, NULL);
SDL_InvalidateMap(SDL_VideoSurface->map);
@@ -830,20 +811,15 @@ SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects)
screen = SDL_VideoSurface;
}
if (screen == SDL_VideoSurface) {
- if (screen->flags & SDL_PREALLOC) {
- /* The surface memory is maintained by the renderer */
- SDL_DirtyTexture(SDL_VideoTexture, numrects, rects);
- } else {
- /* The surface memory needs to be copied to texture */
- int pitch = screen->pitch;
- int psize = screen->format->BytesPerPixel;
- for (i = 0; i < numrects; ++i) {
- const SDL_Rect *rect = &rects[i];
- void *pixels =
- (Uint8 *) screen->pixels + rect->y * pitch +
- rect->x * psize;
- SDL_UpdateTexture(SDL_VideoTexture, rect, pixels, pitch);
- }
+ /* The surface memory needs to be copied to texture */
+ int pitch = screen->pitch;
+ int psize = screen->format->BytesPerPixel;
+ for (i = 0; i < numrects; ++i) {
+ const SDL_Rect *rect = &rects[i];
+ void *pixels =
+ (Uint8 *) screen->pixels + rect->y * pitch +
+ rect->x * psize;
+ SDL_UpdateTexture(SDL_VideoTexture, rect, pixels, pitch);
}
rect.x = 0;
rect.y = 0;
@@ -1459,8 +1435,6 @@ struct private_yuvhwdata
Uint16 pitches[3];
Uint8 *planes[3];
- SDL_SW_YUVTexture *sw;
-
SDL_Texture *texture;
Uint32 texture_format;
};
@@ -1545,24 +1519,6 @@ SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display)
overlay->hwdata->texture =
SDL_CreateTexture(SDL_VideoRenderer, texture_format,
SDL_TEXTUREACCESS_STREAMING, w, h);
- if (overlay->hwdata->texture) {
- overlay->hwdata->sw = NULL;
- } else {
- SDL_DisplayMode current_mode;
-
- overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h);
- if (!overlay->hwdata->sw) {
- SDL_FreeYUVOverlay(overlay);
- return NULL;
- }
-
- /* Create a supported RGB format texture for display */
- SDL_GetCurrentDisplayMode(¤t_mode);
- texture_format = current_mode.format;
- overlay->hwdata->texture =
- SDL_CreateTexture(SDL_VideoRenderer, texture_format,
- SDL_TEXTUREACCESS_STREAMING, w, h);
- }
if (!overlay->hwdata->texture) {
SDL_FreeYUVOverlay(overlay);
return NULL;
@@ -1582,17 +1538,8 @@ SDL_LockYUVOverlay(SDL_Overlay * overlay)
SDL_SetError("Passed a NULL overlay");
return -1;
}
- if (overlay->hwdata->sw) {
- if (SDL_SW_QueryYUVTexturePixels(overlay->hwdata->sw, &pixels, &pitch)
- < 0) {
- return -1;
- }
- } else {
- if (SDL_LockTexture
- (overlay->hwdata->texture, NULL, 1, &pixels, &pitch)
- < 0) {
- return -1;
- }
+ if (SDL_LockTexture(overlay->hwdata->texture, NULL, &pixels, &pitch) < 0) {
+ return -1;
}
overlay->pixels[0] = (Uint8 *) pixels;
overlay->pitches[0] = pitch;
@@ -1620,25 +1567,7 @@ SDL_UnlockYUVOverlay(SDL_Overlay * overlay)
if (!overlay) {
return;
}
- if (overlay->hwdata->sw) {
- void *pixels;
- int pitch;
- if (SDL_LockTexture
- (overlay->hwdata->texture, NULL, 1, &pixels, &pitch) == 0) {
- SDL_Rect srcrect;
-
- srcrect.x = 0;
- srcrect.y = 0;
- srcrect.w = overlay->w;
- srcrect.h = overlay->h;
- SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect,
- overlay->hwdata->texture_format,
- overlay->w, overlay->h, pixels, pitch);
- SDL_UnlockTexture(overlay->hwdata->texture);
- }
- } else {
- SDL_UnlockTexture(overlay->hwdata->texture);
- }
+ SDL_UnlockTexture(overlay->hwdata->texture);
}
int
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 0bcc6ee83..1b3d9ba36 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -152,6 +152,34 @@ SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info)
return 0;
}
+static SDL_bool
+IsSupportedFormat(SDL_Renderer * renderer, Uint32 format)
+{
+ Uint32 i;
+
+ for (i = 0; i < renderer->info.num_texture_formats; ++i) {
+ if (renderer->info.texture_formats[i] == format) {
+ return SDL_TRUE;
+ }
+ }
+ return SDL_FALSE;
+}
+
+static Uint32
+GetClosestSupportedFormat(SDL_Renderer * renderer, Uint32 format)
+{
+ Uint32 i;
+ SDL_bool hasAlpha = SDL_ISPIXELFORMAT_ALPHA(format);
+
+ /* We just want to match the first format that has the same channels */
+ for (i = 0; i < renderer->info.num_texture_formats; ++i) {
+ if (SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == hasAlpha) {
+ return renderer->info.texture_formats[i];
+ }
+ }
+ return renderer->info.texture_formats[0];
+}
+
SDL_Texture *
SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int h)
{
@@ -159,14 +187,18 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int
CHECK_RENDERER_MAGIC(renderer, NULL);
+ if (SDL_ISPIXELFORMAT_INDEXED(format)) {
+ SDL_SetError("Palettized textures are not supported");
+ return NULL;
+ }
if (w <= 0 || h <= 0) {
SDL_SetError("Texture dimensions can't be 0");
- return 0;
+ return NULL;
}
texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
if (!texture) {
SDL_OutOfMemory();
- return 0;
+ return NULL;
}
texture->magic = &texture_magic;
texture->format = format;
@@ -184,9 +216,35 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int
}
renderer->textures = texture;
- if (renderer->CreateTexture(renderer, texture) < 0) {
- SDL_DestroyTexture(texture);
- return 0;
+ if (IsSupportedFormat(renderer, format)) {
+ if (renderer->CreateTexture(renderer, texture) < 0) {
+ SDL_DestroyTexture(texture);
+ return 0;
+ }
+ } else {
+ texture->native = SDL_CreateTexture(renderer,
+ GetClosestSupportedFormat(renderer, format),
+ access, w, h);
+ if (!texture->native) {
+ SDL_DestroyTexture(texture);
+ return NULL;
+ }
+
+ if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
+ texture->yuv = SDL_SW_CreateYUVTexture(format, w, h);
+ if (!texture->yuv) {
+ SDL_DestroyTexture(texture);
+ return NULL;
+ }
+ } else if (access == SDL_TEXTUREACCESS_STREAMING) {
+ /* The pitch is 4 byte aligned */
+ texture->pitch = (((w * SDL_BYTESPERPIXEL(format)) + 3) & ~3);
+ texture->pixels = SDL_malloc(texture->pitch * h);
+ if (!texture->pixels) {
+ SDL_DestroyTexture(texture);
+ return NULL;
+ }
+ }
}
return texture;
}
@@ -500,21 +558,6 @@ SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access,
return 0;
}
-int
-SDL_QueryTexturePixels(SDL_Texture * texture, void **pixels, int *pitch)
-{
- SDL_Renderer *renderer;
-
- CHECK_TEXTURE_MAGIC(texture, -1);
-
- renderer = texture->renderer;
- if (!renderer->QueryTexturePixels) {
- SDL_Unsupported();
- return -1;
- }
- return renderer->QueryTexturePixels(renderer, texture, pixels, pitch);
-}
-
int
SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b)
{
@@ -531,7 +574,9 @@ SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b)
texture->r = r;
texture->g = g;
texture->b = b;
- if (renderer->SetTextureColorMod) {
+ if (texture->native) {
+ return SDL_SetTextureColorMod(texture->native, r, g, b);
+ } else if (renderer->SetTextureColorMod) {
return renderer->SetTextureColorMod(renderer, texture);
} else {
return 0;
@@ -573,7 +618,9 @@ SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha)
texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA;
}
texture->a = alpha;
- if (renderer->SetTextureAlphaMod) {
+ if (texture->native) {
+ return SDL_SetTextureAlphaMod(texture->native, alpha);
+ } else if (renderer->SetTextureAlphaMod) {
return renderer->SetTextureAlphaMod(renderer, texture);
} else {
return 0;
@@ -600,7 +647,9 @@ SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode)
renderer = texture->renderer;
texture->blendMode = blendMode;
- if (renderer->SetTextureBlendMode) {
+ if (texture->native) {
+ return SDL_SetTextureBlendMode(texture, blendMode);
+ } else if (renderer->SetTextureBlendMode) {
return renderer->SetTextureBlendMode(renderer, texture);
} else {
return 0;
@@ -618,6 +667,91 @@ SDL_GetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode *blendMode)
return 0;
}
+static int
+SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect,
+ const void *pixels, int pitch)
+{
+ SDL_Texture *native = texture->native;
+ SDL_Rect full_rect;
+
+ if (SDL_SW_UpdateYUVTexture(texture->yuv, rect, pixels, pitch) < 0) {
+ return -1;
+ }
+
+ full_rect.x = 0;
+ full_rect.y = 0;
+ full_rect.w = texture->w;
+ full_rect.h = texture->h;
+ rect = &full_rect;
+
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ /* We can lock the texture and copy to it */
+ void *native_pixels;
+ int native_pitch;
+
+ if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
+ return -1;
+ }
+ SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
+ rect->w, rect->h, native_pixels, native_pitch);
+ SDL_UnlockTexture(native);
+ } else {
+ /* Use a temporary buffer for updating */
+ void *temp_pixels;
+ int temp_pitch;
+
+ temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3);
+ temp_pixels = SDL_malloc(rect->h * temp_pitch);
+ if (!temp_pixels) {
+ SDL_OutOfMemory();
+ return -1;
+ }
+ SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
+ rect->w, rect->h, temp_pixels, temp_pitch);
+ SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch);
+ SDL_free(temp_pixels);
+ }
+ return 0;
+}
+
+static int
+SDL_UpdateTextureNative(SDL_Texture * texture, const SDL_Rect * rect,
+ const void *pixels, int pitch)
+{
+ SDL_Texture *native = texture->native;
+
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ /* We can lock the texture and copy to it */
+ void *native_pixels;
+ int native_pitch;
+
+ if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
+ return -1;
+ }
+ SDL_ConvertPixels(rect->w, rect->h,
+ texture->format, pixels, pitch,
+ native->format, native_pixels, native_pitch);
+ SDL_UnlockTexture(native);
+ } else {
+ /* Use a temporary buffer for updating */
+ void *temp_pixels;
+ int temp_pitch;
+
+ temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3);
+ temp_pixels = SDL_malloc(rect->h * temp_pitch);
+ if (!temp_pixels) {
+ SDL_OutOfMemory();
+ return -1;
+ }
+ SDL_ConvertPixels(rect->w, rect->h,
+ texture->format, pixels, pitch,
+ native->format, temp_pixels, temp_pitch);
+ SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch);
+ SDL_free(temp_pixels);
+ }
+ return 0;
+}
+
int
SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect,
const void *pixels, int pitch)
@@ -627,11 +761,6 @@ SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect,
CHECK_TEXTURE_MAGIC(texture, -1);
- renderer = texture->renderer;
- if (!renderer->UpdateTexture) {
- SDL_Unsupported();
- return -1;
- }
if (!rect) {
full_rect.x = 0;
full_rect.y = 0;
@@ -639,11 +768,38 @@ SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect,
full_rect.h = texture->h;
rect = &full_rect;
}
- return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
+
+ if (texture->yuv) {
+ return SDL_UpdateTextureYUV(texture, rect, pixels, pitch);
+ } else if (texture->native) {
+ return SDL_UpdateTextureNative(texture, rect, pixels, pitch);
+ } else {
+ renderer = texture->renderer;
+ return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
+ }
+}
+
+static int
+SDL_LockTextureYUV(SDL_Texture * texture, const SDL_Rect * rect,
+ void **pixels, int *pitch)
+{
+ return SDL_SW_LockYUVTexture(texture->yuv, rect, pixels, pitch);
+}
+
+static int
+SDL_LockTextureNative(SDL_Texture * texture, const SDL_Rect * rect,
+ void **pixels, int *pitch)
+{
+ texture->locked_rect = *rect;
+ *pixels = (void *) ((Uint8 *) texture->pixels +
+ rect->y * texture->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ *pitch = texture->pitch;
+ return 0;
}
int
-SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, int markDirty,
+SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect,
void **pixels, int *pitch)
{
SDL_Renderer *renderer;
@@ -655,11 +811,7 @@ SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, int markDirty,
SDL_SetError("SDL_LockTexture(): texture must be streaming");
return -1;
}
- renderer = texture->renderer;
- if (!renderer->LockTexture) {
- SDL_Unsupported();
- return -1;
- }
+
if (!rect) {
full_rect.x = 0;
full_rect.y = 0;
@@ -667,8 +819,57 @@ SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, int markDirty,
full_rect.h = texture->h;
rect = &full_rect;
}
- return renderer->LockTexture(renderer, texture, rect, markDirty, pixels,
- pitch);
+
+ if (texture->yuv) {
+ return SDL_LockTextureYUV(texture, rect, pixels, pitch);
+ } else if (texture->native) {
+ return SDL_LockTextureNative(texture, rect, pixels, pitch);
+ } else {
+ renderer = texture->renderer;
+ return renderer->LockTexture(renderer, texture, rect, pixels, pitch);
+ }
+}
+
+static void
+SDL_UnlockTextureYUV(SDL_Texture * texture)
+{
+ SDL_Texture *native = texture->native;
+ void *native_pixels;
+ int native_pitch;
+ SDL_Rect rect;
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = texture->w;
+ rect.h = texture->h;
+
+ if (SDL_LockTexture(native, &rect, &native_pixels, &native_pitch) < 0) {
+ return;
+ }
+ SDL_SW_CopyYUVToRGB(texture->yuv, &rect, native->format,
+ rect.w, rect.h, native_pixels, native_pitch);
+ SDL_UnlockTexture(native);
+}
+
+void
+SDL_UnlockTextureNative(SDL_Texture * texture)
+{
+ SDL_Texture *native = texture->native;
+ void *native_pixels;
+ int native_pitch;
+ const SDL_Rect *rect = &texture->locked_rect;
+ const void* pixels = (void *) ((Uint8 *) texture->pixels +
+ rect->y * texture->pitch +
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
+ int pitch = texture->pitch;
+
+ if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
+ return;
+ }
+ SDL_ConvertPixels(rect->w, rect->h,
+ texture->format, pixels, pitch,
+ native->format, native_pixels, native_pitch);
+ SDL_UnlockTexture(native);
}
void
@@ -681,29 +882,14 @@ SDL_UnlockTexture(SDL_Texture * texture)
if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
return;
}
- renderer = texture->renderer;
- if (!renderer->UnlockTexture) {
- return;
+ if (texture->yuv) {
+ SDL_UnlockTextureYUV(texture);
+ } else if (texture->native) {
+ SDL_UnlockTextureNative(texture);
+ } else {
+ renderer = texture->renderer;
+ renderer->UnlockTexture(renderer, texture);
}
- renderer->UnlockTexture(renderer, texture);
-}
-
-void
-SDL_DirtyTexture(SDL_Texture * texture, int numrects,
- const SDL_Rect * rects)
-{
- SDL_Renderer *renderer;
-
- CHECK_TEXTURE_MAGIC(texture, );
-
- if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
- return;
- }
- renderer = texture->renderer;
- if (!renderer->DirtyTexture) {
- return;
- }
- renderer->DirtyTexture(renderer, texture, numrects, rects);
}
int
@@ -979,6 +1165,10 @@ SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
}
}
+ if (texture->native) {
+ texture = texture->native;
+ }
+
return renderer->RenderCopy(renderer, texture, &real_srcrect,
&real_dstrect);
}
@@ -1087,6 +1277,16 @@ SDL_DestroyTexture(SDL_Texture * texture)
renderer->textures = texture->next;
}
+ if (texture->native) {
+ SDL_DestroyTexture(texture->native);
+ }
+ if (texture->yuv) {
+ SDL_SW_DestroyYUVTexture(texture->yuv);
+ }
+ if (texture->pixels) {
+ SDL_free(texture->pixels);
+ }
+
renderer->DestroyTexture(renderer, texture);
SDL_free(texture);
}
diff --git a/src/render/SDL_sysrender.h b/src/render/SDL_sysrender.h
index 54e1735cd..94c9b428d 100644
--- a/src/render/SDL_sysrender.h
+++ b/src/render/SDL_sysrender.h
@@ -26,6 +26,7 @@
#include "SDL_render.h"
#include "SDL_events.h"
+#include "SDL_yuv_sw_c.h"
/* The SDL 2D rendering system */
@@ -45,6 +46,13 @@ struct SDL_Texture
SDL_Renderer *renderer;
+ /* Support for formats not supported directly by the renderer */
+ SDL_Texture *native;
+ SDL_SW_YUVTexture *yuv;
+ void *pixels;
+ int pitch;
+ SDL_Rect locked_rect;
+
void *driverdata; /**< Driver specific texture representation */
SDL_Texture *prev;
@@ -58,8 +66,6 @@ struct SDL_Renderer
void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
- int (*QueryTexturePixels) (SDL_Renderer * renderer, SDL_Texture * texture,
- void **pixels, int *pitch);
int (*SetTextureColorMod) (SDL_Renderer * renderer,
SDL_Texture * texture);
int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
@@ -70,11 +76,8 @@ struct SDL_Renderer
const SDL_Rect * rect, const void *pixels,
int pitch);
int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty, void **pixels,
- int *pitch);
+ const SDL_Rect * rect, void **pixels, int *pitch);
void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
- void (*DirtyTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
- int numrects, const SDL_Rect * rects);
int (*RenderClear) (SDL_Renderer * renderer);
int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points,
int count);
diff --git a/src/video/SDL_yuv_mmx.c b/src/render/SDL_yuv_mmx.c
similarity index 100%
rename from src/video/SDL_yuv_mmx.c
rename to src/render/SDL_yuv_mmx.c
diff --git a/src/video/SDL_yuv_sw.c b/src/render/SDL_yuv_sw.c
similarity index 99%
rename from src/video/SDL_yuv_sw.c
rename to src/render/SDL_yuv_sw.c
index 333b44e59..0589e6bf9 100644
--- a/src/video/SDL_yuv_sw.c
+++ b/src/render/SDL_yuv_sw.c
@@ -1155,7 +1155,7 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
int
SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
- int markDirty, void **pixels, int *pitch)
+ void **pixels, int *pitch)
{
switch (swdata->format) {
case SDL_PIXELFORMAT_YV12:
diff --git a/src/video/SDL_yuv_sw_c.h b/src/render/SDL_yuv_sw_c.h
similarity index 96%
rename from src/video/SDL_yuv_sw_c.h
rename to src/render/SDL_yuv_sw_c.h
index c8865f1f6..ac105e12e 100644
--- a/src/video/SDL_yuv_sw_c.h
+++ b/src/render/SDL_yuv_sw_c.h
@@ -22,7 +22,6 @@
#include "SDL_config.h"
#include "SDL_video.h"
-#include "SDL_sysvideo.h"
/* This is the software implementation of the YUV texture support */
@@ -60,7 +59,7 @@ int SDL_SW_QueryYUVTexturePixels(SDL_SW_YUVTexture * swdata, void **pixels,
int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
const void *pixels, int pitch);
int SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
- int markDirty, void **pixels, int *pitch);
+ void **pixels, int *pitch);
void SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture * swdata);
int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect,
Uint32 target_format, int w, int h, void *pixels,
diff --git a/src/render/direct3d/SDL_d3drender.c b/src/render/direct3d/SDL_d3drender.c
old mode 100644
new mode 100755
index 6cc2b40e6..e63b59d81
--- a/src/render/direct3d/SDL_d3drender.c
+++ b/src/render/direct3d/SDL_d3drender.c
@@ -28,7 +28,6 @@
#include "SDL_loadso.h"
#include "SDL_syswm.h"
#include "../SDL_sysrender.h"
-#include "../../video/SDL_yuv_sw_c.h"
#if SDL_VIDEO_RENDER_D3D
#define D3D_DEBUG_INFO
@@ -89,7 +88,8 @@ HRESULT WINAPI
/* Direct3D renderer implementation */
-#if 1 /* This takes more memory but you won't lose your texture data */
+#if 1
+/* This takes more memory but you won't lose your texture data */
#define D3DPOOL_SDL D3DPOOL_MANAGED
#define SDL_MEMORY_POOL_MANAGED
#else
@@ -99,18 +99,12 @@ HRESULT WINAPI
static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags);
static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
-static int D3D_QueryTexturePixels(SDL_Renderer * renderer,
- SDL_Texture * texture, void **pixels,
- int *pitch);
static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels,
int pitch);
static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty,
- void **pixels, int *pitch);
+ const SDL_Rect * rect, void **pixels, int *pitch);
static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
-static void D3D_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- int numrects, const SDL_Rect * rects);
static int D3D_RenderDrawPoints(SDL_Renderer * renderer,
const SDL_Point * points, int count);
static int D3D_RenderDrawLines(SDL_Renderer * renderer,
@@ -134,8 +128,8 @@ SDL_RenderDriver D3D_RenderDriver = {
{
"d3d",
(SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
- 0,
- {0},
+ 1,
+ {SDL_PIXELFORMAT_ARGB8888},
0,
0}
};
@@ -152,7 +146,6 @@ typedef struct
typedef struct
{
- SDL_SW_YUVTexture *yuv;
Uint32 format;
IDirect3DTexture9 *texture;
} D3D_TextureData;
@@ -248,113 +241,30 @@ static D3DFORMAT
PixelFormatToD3DFMT(Uint32 format)
{
switch (format) {
- case SDL_PIXELFORMAT_INDEX8:
- return D3DFMT_P8;
- case SDL_PIXELFORMAT_RGB332:
- return D3DFMT_R3G3B2;
- case SDL_PIXELFORMAT_RGB444:
- return D3DFMT_X4R4G4B4;
- case SDL_PIXELFORMAT_RGB555:
- return D3DFMT_X1R5G5B5;
- case SDL_PIXELFORMAT_ARGB4444:
- return D3DFMT_A4R4G4B4;
- case SDL_PIXELFORMAT_ARGB1555:
- return D3DFMT_A1R5G5B5;
case SDL_PIXELFORMAT_RGB565:
return D3DFMT_R5G6B5;
case SDL_PIXELFORMAT_RGB888:
return D3DFMT_X8R8G8B8;
case SDL_PIXELFORMAT_ARGB8888:
return D3DFMT_A8R8G8B8;
- case SDL_PIXELFORMAT_ARGB2101010:
- return D3DFMT_A2R10G10B10;
- case SDL_PIXELFORMAT_YV12:
- return MAKEFOURCC('Y','V','1','2');
- case SDL_PIXELFORMAT_IYUV:
- return MAKEFOURCC('I','4','2','0');
- case SDL_PIXELFORMAT_UYVY:
- return D3DFMT_UYVY;
- case SDL_PIXELFORMAT_YUY2:
- return D3DFMT_YUY2;
default:
return D3DFMT_UNKNOWN;
}
}
-static SDL_bool
-D3D_IsTextureFormatAvailable(IDirect3D9 * d3d, UINT adapter,
- D3DFORMAT display_format,
- D3DFORMAT texture_format)
+static Uint32
+D3DFMTToPixelFormat(D3DFORMAT format)
{
- HRESULT result;
-
- result = IDirect3D9_CheckDeviceFormat(d3d, adapter,
- D3DDEVTYPE_HAL,
- display_format,
- 0,
- D3DRTYPE_TEXTURE,
- texture_format);
- return FAILED(result) ? SDL_FALSE : SDL_TRUE;
-}
-
-static void
-UpdateYUVTextureData(SDL_Texture * texture)
-{
- D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
- SDL_Rect rect;
- RECT d3drect;
- D3DLOCKED_RECT locked;
- HRESULT result;
-
- d3drect.left = 0;
- d3drect.right = texture->w;
- d3drect.top = 0;
- d3drect.bottom = texture->h;
-
- result =
- IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
- if (FAILED(result)) {
- return;
+ switch (format) {
+ case D3DFMT_R5G6B5:
+ return SDL_PIXELFORMAT_RGB565;
+ case D3DFMT_X8R8G8B8:
+ return SDL_PIXELFORMAT_RGB888;
+ case D3DFMT_A8R8G8B8:
+ return SDL_PIXELFORMAT_ARGB8888;
+ default:
+ return SDL_PIXELFORMAT_UNKNOWN;
}
-
- rect.x = 0;
- rect.y = 0;
- rect.w = texture->w;
- rect.h = texture->h;
- SDL_SW_CopyYUVToRGB(data->yuv, &rect, data->format, texture->w,
- texture->h, locked.pBits, locked.Pitch);
-
- IDirect3DTexture9_UnlockRect(data->texture, 0);
-}
-
-static void
-D3D_AddTextureFormats(D3D_RenderData *data, SDL_RendererInfo *info)
-{
- int i;
- int formats[] = {
- SDL_PIXELFORMAT_RGB332,
- SDL_PIXELFORMAT_RGB444,
- SDL_PIXELFORMAT_RGB555,
- SDL_PIXELFORMAT_ARGB4444,
- SDL_PIXELFORMAT_ARGB1555,
- SDL_PIXELFORMAT_RGB565,
- SDL_PIXELFORMAT_RGB888,
- SDL_PIXELFORMAT_ARGB8888,
- SDL_PIXELFORMAT_ARGB2101010,
- };
-
- info->num_texture_formats = 0;
- for (i = 0; i < SDL_arraysize(formats); ++i) {
- if (D3D_IsTextureFormatAvailable
- (data->d3d, data->adapter, data->pparams.BackBufferFormat, PixelFormatToD3DFMT(formats[i]))) {
- info->texture_formats[info->num_texture_formats++] = formats[i];
- }
- }
- info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YV12;
- info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
- info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YUY2;
- info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_UYVY;
- info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YVYU;
}
SDL_Renderer *
@@ -367,6 +277,9 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
D3DPRESENT_PARAMETERS pparams;
IDirect3DSwapChain9 *chain;
D3DCAPS9 caps;
+ Uint32 window_flags;
+ int w, h;
+ SDL_DisplayMode fullscreen_mode;
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
if (!renderer) {
@@ -404,11 +317,9 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
}
renderer->CreateTexture = D3D_CreateTexture;
- renderer->QueryTexturePixels = D3D_QueryTexturePixels;
renderer->UpdateTexture = D3D_UpdateTexture;
renderer->LockTexture = D3D_LockTexture;
renderer->UnlockTexture = D3D_UnlockTexture;
- renderer->DirtyTexture = D3D_DirtyTexture;
renderer->RenderDrawPoints = D3D_RenderDrawPoints;
renderer->RenderDrawLines = D3D_RenderDrawLines;
renderer->RenderFillRects = D3D_RenderFillRects;
@@ -427,23 +338,27 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_VERSION(&windowinfo.version);
SDL_GetWindowWMInfo(window, &windowinfo);
+ window_flags = SDL_GetWindowFlags(window);
+ SDL_GetWindowSize(window, &w, &h);
+ SDL_GetWindowDisplayMode(window, &fullscreen_mode);
+
SDL_zero(pparams);
pparams.hDeviceWindow = windowinfo.info.win.window;
- pparams.BackBufferWidth = window->w;
- pparams.BackBufferHeight = window->h;
- if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ pparams.BackBufferWidth = w;
+ pparams.BackBufferHeight = h;
+ if (window_flags & SDL_WINDOW_FULLSCREEN) {
pparams.BackBufferFormat =
- PixelFormatToD3DFMT(window->fullscreen_mode.format);
+ PixelFormatToD3DFMT(fullscreen_mode.format);
} else {
pparams.BackBufferFormat = D3DFMT_UNKNOWN;
}
pparams.BackBufferCount = 1;
pparams.SwapEffect = D3DSWAPEFFECT_DISCARD;
- if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ if (window_flags & SDL_WINDOW_FULLSCREEN) {
pparams.Windowed = FALSE;
pparams.FullScreen_RefreshRateInHz =
- window->fullscreen_mode.refresh_rate;
+ fullscreen_mode.refresh_rate;
} else {
pparams.Windowed = TRUE;
pparams.FullScreen_RefreshRateInHz = 0;
@@ -494,8 +409,6 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
}
data->pparams = pparams;
- D3D_AddTextureFormats(data, &renderer->info);
-
IDirect3DDevice9_GetDeviceCaps(data->device, &caps);
renderer->info.max_texture_width = caps.MaxTextureWidth;
renderer->info.max_texture_height = caps.MaxTextureHeight;
@@ -594,22 +507,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
texture->driverdata = data;
- if (SDL_ISPIXELFORMAT_FOURCC(texture->format) &&
- (texture->format != SDL_PIXELFORMAT_YUY2 ||
- !D3D_IsTextureFormatAvailable(renderdata->d3d, renderdata->adapter,
- display_format, PixelFormatToD3DFMT(texture->format)))
- && (texture->format != SDL_PIXELFORMAT_YVYU
- || !D3D_IsTextureFormatAvailable(renderdata->d3d, renderdata->adapter,
- display_format, PixelFormatToD3DFMT(texture->format)))) {
- data->yuv =
- SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
- if (!data->yuv) {
- return -1;
- }
- data->format = SDL_GetWindowPixelFormat(window);
- } else {
- data->format = texture->format;
- }
+ data->format = texture->format;
result =
IDirect3DDevice9_CreateTexture(renderdata->device, texture->w,
@@ -624,20 +522,6 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return 0;
}
-static int
-D3D_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
- void **pixels, int *pitch)
-{
- D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
-
- if (data->yuv) {
- return SDL_SW_QueryYUVTexturePixels(data->yuv, pixels, pitch);
- } else {
- /* D3D textures don't have their pixels hanging out */
- return -1;
- }
-}
-
static int
D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch)
@@ -645,133 +529,112 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
- if (data->yuv) {
- if (SDL_SW_UpdateYUVTexture(data->yuv, rect, pixels, pitch) < 0) {
- return -1;
- }
- UpdateYUVTextureData(texture);
- return 0;
- } else {
#ifdef SDL_MEMORY_POOL_DEFAULT
- IDirect3DTexture9 *temp;
- RECT d3drect;
- D3DLOCKED_RECT locked;
- const Uint8 *src;
- Uint8 *dst;
- int row, length;
- HRESULT result;
+ IDirect3DTexture9 *temp;
+ RECT d3drect;
+ D3DLOCKED_RECT locked;
+ const Uint8 *src;
+ Uint8 *dst;
+ int row, length;
+ HRESULT result;
- result =
- IDirect3DDevice9_CreateTexture(renderdata->device, texture->w,
- texture->h, 1, 0,
- PixelFormatToD3DFMT(texture->
- format),
- D3DPOOL_SYSTEMMEM, &temp, NULL);
- if (FAILED(result)) {
- D3D_SetError("CreateTexture()", result);
- return -1;
- }
+ result =
+ IDirect3DDevice9_CreateTexture(renderdata->device, texture->w,
+ texture->h, 1, 0,
+ PixelFormatToD3DFMT(texture-> format),
+ D3DPOOL_SYSTEMMEM, &temp, NULL);
+ if (FAILED(result)) {
+ D3D_SetError("CreateTexture()", result);
+ return -1;
+ }
- d3drect.left = rect->x;
- d3drect.right = rect->x + rect->w;
- d3drect.top = rect->y;
- d3drect.bottom = rect->y + rect->h;
+ d3drect.left = rect->x;
+ d3drect.right = rect->x + rect->w;
+ d3drect.top = rect->y;
+ d3drect.bottom = rect->y + rect->h;
- result = IDirect3DTexture9_LockRect(temp, 0, &locked, &d3drect, 0);
- if (FAILED(result)) {
- IDirect3DTexture9_Release(temp);
- D3D_SetError("LockRect()", result);
- return -1;
- }
-
- src = pixels;
- dst = locked.pBits;
- length = rect->w * SDL_BYTESPERPIXEL(texture->format);
- for (row = 0; row < rect->h; ++row) {
- SDL_memcpy(dst, src, length);
- src += pitch;
- dst += locked.Pitch;
- }
- IDirect3DTexture9_UnlockRect(temp, 0);
-
- result =
- IDirect3DDevice9_UpdateTexture(renderdata->device,
- (IDirect3DBaseTexture9 *) temp,
- (IDirect3DBaseTexture9 *)
- data->texture);
+ result = IDirect3DTexture9_LockRect(temp, 0, &locked, &d3drect, 0);
+ if (FAILED(result)) {
IDirect3DTexture9_Release(temp);
- if (FAILED(result)) {
- D3D_SetError("UpdateTexture()", result);
- return -1;
- }
+ D3D_SetError("LockRect()", result);
+ return -1;
+ }
+
+ src = pixels;
+ dst = locked.pBits;
+ length = rect->w * SDL_BYTESPERPIXEL(texture->format);
+ for (row = 0; row < rect->h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += pitch;
+ dst += locked.Pitch;
+ }
+ IDirect3DTexture9_UnlockRect(temp, 0);
+
+ result =
+ IDirect3DDevice9_UpdateTexture(renderdata->device,
+ (IDirect3DBaseTexture9 *) temp,
+ (IDirect3DBaseTexture9 *)
+ data->texture);
+ IDirect3DTexture9_Release(temp);
+ if (FAILED(result)) {
+ D3D_SetError("UpdateTexture()", result);
+ return -1;
+ }
#else
- RECT d3drect;
- D3DLOCKED_RECT locked;
- const Uint8 *src;
- Uint8 *dst;
- int row, length;
- HRESULT result;
+ RECT d3drect;
+ D3DLOCKED_RECT locked;
+ const Uint8 *src;
+ Uint8 *dst;
+ int row, length;
+ HRESULT result;
- d3drect.left = rect->x;
- d3drect.right = rect->x + rect->w;
- d3drect.top = rect->y;
- d3drect.bottom = rect->y + rect->h;
+ d3drect.left = rect->x;
+ d3drect.right = rect->x + rect->w;
+ d3drect.top = rect->y;
+ d3drect.bottom = rect->y + rect->h;
- result =
- IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect,
- 0);
- if (FAILED(result)) {
- D3D_SetError("LockRect()", result);
- return -1;
- }
+ result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
+ if (FAILED(result)) {
+ D3D_SetError("LockRect()", result);
+ return -1;
+ }
- src = pixels;
- dst = locked.pBits;
- length = rect->w * SDL_BYTESPERPIXEL(texture->format);
- for (row = 0; row < rect->h; ++row) {
- SDL_memcpy(dst, src, length);
- src += pitch;
- dst += locked.Pitch;
- }
- IDirect3DTexture9_UnlockRect(data->texture, 0);
+ src = pixels;
+ dst = locked.pBits;
+ length = rect->w * SDL_BYTESPERPIXEL(texture->format);
+ for (row = 0; row < rect->h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += pitch;
+ dst += locked.Pitch;
+ }
+ IDirect3DTexture9_UnlockRect(data->texture, 0);
#endif // SDL_MEMORY_POOL_DEFAULT
- return 0;
- }
+ return 0;
}
static int
D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty, void **pixels,
- int *pitch)
+ const SDL_Rect * rect, void **pixels, int *pitch)
{
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
+ RECT d3drect;
+ D3DLOCKED_RECT locked;
+ HRESULT result;
- if (data->yuv) {
- return SDL_SW_LockYUVTexture(data->yuv, rect, markDirty, pixels,
- pitch);
- } else {
- RECT d3drect;
- D3DLOCKED_RECT locked;
- HRESULT result;
+ d3drect.left = rect->x;
+ d3drect.right = rect->x + rect->w;
+ d3drect.top = rect->y;
+ d3drect.bottom = rect->y + rect->h;
- d3drect.left = rect->x;
- d3drect.right = rect->x + rect->w;
- d3drect.top = rect->y;
- d3drect.bottom = rect->y + rect->h;
-
- result =
- IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect,
- markDirty ? 0 :
- D3DLOCK_NO_DIRTY_UPDATE);
- if (FAILED(result)) {
- D3D_SetError("LockRect()", result);
- return -1;
- }
- *pixels = locked.pBits;
- *pitch = locked.Pitch;
- return 0;
+ result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
+ if (FAILED(result)) {
+ D3D_SetError("LockRect()", result);
+ return -1;
}
+ *pixels = locked.pBits;
+ *pitch = locked.Pitch;
+ return 0;
}
static void
@@ -779,32 +642,7 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
- if (data->yuv) {
- SDL_SW_UnlockYUVTexture(data->yuv);
- UpdateYUVTextureData(texture);
- } else {
- IDirect3DTexture9_UnlockRect(data->texture, 0);
- }
-}
-
-static void
-D3D_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
- const SDL_Rect * rects)
-{
- D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
- RECT d3drect;
- int i;
-
- for (i = 0; i < numrects; ++i) {
- const SDL_Rect *rect = &rects[i];
-
- d3drect.left = rect->x;
- d3drect.right = rect->x + rect->w;
- d3drect.top = rect->y;
- d3drect.bottom = rect->y + rect->h;
-
- IDirect3DTexture9_AddDirtyRect(data->texture, &d3drect);
- }
+ IDirect3DTexture9_UnlockRect(data->texture, 0);
}
static void
@@ -1123,8 +961,6 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
Uint32 format, void * pixels, int pitch)
{
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
- SDL_Window *window = renderer->window;
- SDL_VideoDisplay *display = window->display;
D3DSURFACE_DESC desc;
LPDIRECT3DSURFACE9 backBuffer;
LPDIRECT3DSURFACE9 surface;
@@ -1174,7 +1010,7 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
}
SDL_ConvertPixels(rect->w, rect->h,
- display->current_mode.format, locked.pBits, locked.Pitch,
+ D3DFMTToPixelFormat(desc.Format), locked.pBits, locked.Pitch,
format, pixels, pitch);
IDirect3DSurface9_UnlockRect(surface);
@@ -1227,9 +1063,6 @@ D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (!data) {
return;
}
- if (data->yuv) {
- SDL_SW_DestroyYUVTexture(data->yuv);
- }
if (data->texture) {
IDirect3DTexture9_Release(data->texture);
}
diff --git a/src/video/mmx.h b/src/render/mmx.h
similarity index 100%
rename from src/video/mmx.h
rename to src/render/mmx.h
diff --git a/src/render/opengl/SDL_renderer_gl.c b/src/render/opengl/SDL_renderer_gl.c
index a8998e19f..3e9b4d6fc 100644
--- a/src/render/opengl/SDL_renderer_gl.c
+++ b/src/render/opengl/SDL_renderer_gl.c
@@ -37,27 +37,6 @@
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_texturedata/chapter_10_section_2.html
*/
-/* !!! FIXME: this should go in a higher level than the GL renderer. */
-static __inline__ int
-bytes_per_pixel(const Uint32 format)
-{
- if (!SDL_ISPIXELFORMAT_FOURCC(format)) {
- return SDL_BYTESPERPIXEL(format);
- }
-
- /* FOURCC format */
- switch (format) {
- case SDL_PIXELFORMAT_YV12:
- case SDL_PIXELFORMAT_IYUV:
- case SDL_PIXELFORMAT_YUY2:
- case SDL_PIXELFORMAT_UYVY:
- case SDL_PIXELFORMAT_YVYU:
- return 2;
- default:
- return 1; /* shouldn't ever hit this. */
- }
-}
-
/* Used to re-create the window with OpenGL capability */
extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
@@ -67,18 +46,12 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window * window, Uint32 flags);
static void GL_WindowEvent(SDL_Renderer * renderer,
const SDL_WindowEvent *event);
static int GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
-static int GL_QueryTexturePixels(SDL_Renderer * renderer,
- SDL_Texture * texture, void **pixels,
- int *pitch);
static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels,
int pitch);
static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty, void **pixels,
- int *pitch);
+ const SDL_Rect * rect, void **pixels, int *pitch);
static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
-static void GL_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- int numrects, const SDL_Rect * rects);
static int GL_RenderClear(SDL_Renderer * renderer);
static int GL_RenderDrawPoints(SDL_Renderer * renderer,
const SDL_Point * points, int count);
@@ -102,21 +75,8 @@ SDL_RenderDriver GL_RenderDriver = {
{
"opengl",
(SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
- 13,
- {
- SDL_PIXELFORMAT_RGB332,
- SDL_PIXELFORMAT_RGB444,
- SDL_PIXELFORMAT_RGB555,
- SDL_PIXELFORMAT_ARGB4444,
- SDL_PIXELFORMAT_ARGB1555,
- SDL_PIXELFORMAT_RGB565,
- SDL_PIXELFORMAT_RGB24,
- SDL_PIXELFORMAT_BGR24,
- SDL_PIXELFORMAT_RGB888,
- SDL_PIXELFORMAT_BGR888,
- SDL_PIXELFORMAT_ARGB8888,
- SDL_PIXELFORMAT_ABGR8888,
- SDL_PIXELFORMAT_ARGB2101010},
+ 1,
+ {SDL_PIXELFORMAT_ARGB8888},
0,
0}
};
@@ -126,10 +86,6 @@ typedef struct
SDL_GLContext context;
SDL_bool updateSize;
SDL_bool GL_ARB_texture_rectangle_supported;
- SDL_bool GL_EXT_paletted_texture_supported;
- SDL_bool GL_APPLE_ycbcr_422_supported;
- SDL_bool GL_MESA_ycbcr_texture_supported;
- SDL_bool GL_ARB_fragment_program_supported;
int blendMode;
/* OpenGL functions */
@@ -139,33 +95,18 @@ typedef struct
void (*glTextureRangeAPPLE) (GLenum target, GLsizei length,
const GLvoid * pointer);
-
- PFNGLGETPROGRAMIVARBPROC glGetProgramivARB;
- PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB;
- PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB;
- PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB;
- PFNGLGENPROGRAMSARBPROC glGenProgramsARB;
- PFNGLBINDPROGRAMARBPROC glBindProgramARB;
- PFNGLPROGRAMSTRINGARBPROC glProgramStringARB;
-
- /* (optional) fragment programs */
- GLuint fragment_program_UYVY;
} GL_RenderData;
typedef struct
{
GLuint texture;
- GLuint shader;
GLenum type;
GLfloat texw;
GLfloat texh;
GLenum format;
GLenum formattype;
- Uint8 *palette;
void *pixels;
int pitch;
- SDL_DirtyRectList dirty;
- int HACK_RYAN_FIXME;
} GL_TextureData;
@@ -257,11 +198,9 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->WindowEvent = GL_WindowEvent;
renderer->CreateTexture = GL_CreateTexture;
- renderer->QueryTexturePixels = GL_QueryTexturePixels;
renderer->UpdateTexture = GL_UpdateTexture;
renderer->LockTexture = GL_LockTexture;
renderer->UnlockTexture = GL_UnlockTexture;
- renderer->DirtyTexture = GL_DirtyTexture;
renderer->RenderClear = GL_RenderClear;
renderer->RenderDrawPoints = GL_RenderDrawPoints;
renderer->RenderDrawLines = GL_RenderDrawLines;
@@ -317,40 +256,12 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|| SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) {
data->GL_ARB_texture_rectangle_supported = SDL_TRUE;
}
- if (SDL_GL_ExtensionSupported("GL_APPLE_ycbcr_422")) {
- data->GL_APPLE_ycbcr_422_supported = SDL_TRUE;
- }
- if (SDL_GL_ExtensionSupported("GL_MESA_ycbcr_texture")) {
- data->GL_MESA_ycbcr_texture_supported = SDL_TRUE;
- }
if (SDL_GL_ExtensionSupported("GL_APPLE_texture_range")) {
data->glTextureRangeAPPLE =
(void (*)(GLenum, GLsizei, const GLvoid *))
SDL_GL_GetProcAddress("glTextureRangeAPPLE");
}
- /* we might use fragment programs for YUV data, etc. */
- if (SDL_GL_ExtensionSupported("GL_ARB_fragment_program")) {
- /* !!! FIXME: this doesn't check for errors. */
- /* !!! FIXME: this should really reuse the glfuncs.h stuff. */
- data->glGetProgramivARB = (PFNGLGETPROGRAMIVARBPROC)
- SDL_GL_GetProcAddress("glGetProgramivARB");
- data->glGetProgramStringARB = (PFNGLGETPROGRAMSTRINGARBPROC)
- SDL_GL_GetProcAddress("glGetProgramStringARB");
- data->glProgramLocalParameter4fvARB =
- (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)
- SDL_GL_GetProcAddress("glProgramLocalParameter4fvARB");
- data->glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)
- SDL_GL_GetProcAddress("glDeleteProgramsARB");
- data->glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC)
- SDL_GL_GetProcAddress("glGenProgramsARB");
- data->glBindProgramARB = (PFNGLBINDPROGRAMARBPROC)
- SDL_GL_GetProcAddress("glBindProgramARB");
- data->glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)
- SDL_GL_GetProcAddress("glProgramStringARB");
- data->GL_ARB_fragment_program_supported = SDL_TRUE;
- }
-
/* Set up parameters for rendering */
data->blendMode = -1;
data->glDisable(GL_DEPTH_TEST);
@@ -419,240 +330,16 @@ power_of_2(int input)
return value;
}
-
-//#define DEBUG_PROGRAM_COMPILE 1
-
-static void
-set_shader_error(GL_RenderData * data, const char *prefix)
-{
- GLint pos = 0;
- const GLubyte *errstr;
- data->glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &pos);
- errstr = data->glGetString(GL_PROGRAM_ERROR_STRING_ARB);
- SDL_SetError("%s: shader compile error at position %d: %s",
- prefix, (int) pos, (const char *) errstr);
-}
-
-static GLuint
-compile_shader(GL_RenderData * data, GLenum shader_type, const char *_code)
-{
- const int have_texture_rects = data->GL_ARB_texture_rectangle_supported;
- const char *replacement = have_texture_rects ? "RECT" : "2D";
- const size_t replacementlen = SDL_strlen(replacement);
- const char *token = "%TEXTURETARGET%";
- const size_t tokenlen = SDL_strlen(token);
- char *code = NULL;
- char *ptr = NULL;
- GLuint program = 0;
-
- /*
- * The TEX instruction needs a different target depending on what we use.
- * To handle this, we use "%TEXTURETARGET%" and replace the string before
- * compiling the shader.
- */
- code = SDL_strdup(_code);
- if (code == NULL)
- return 0;
-
- for (ptr = SDL_strstr(code, token); ptr; ptr = SDL_strstr(ptr + 1, token)) {
- SDL_memcpy(ptr, replacement, replacementlen);
- SDL_memmove(ptr + replacementlen, ptr + tokenlen,
- SDL_strlen(ptr + tokenlen) + 1);
- }
-
-#if DEBUG_PROGRAM_COMPILE
- printf("compiling shader:\n%s\n\n", code);
-#endif
-
- data->glGetError(); /* flush any existing error state. */
- data->glGenProgramsARB(1, &program);
- data->glBindProgramARB(shader_type, program);
- data->glProgramStringARB(shader_type, GL_PROGRAM_FORMAT_ASCII_ARB,
- (GLsizei)SDL_strlen(code), code);
-
- SDL_free(code);
-
- if (data->glGetError() == GL_INVALID_OPERATION) {
-#if DEBUG_PROGRAM_COMPILE
- GLint pos = 0;
- const GLubyte *errstr;
- data->glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &pos);
- errstr = data->glGetString(GL_PROGRAM_ERROR_STRING_ARB);
- printf("program compile error at position %d: %s\n\n",
- (int) pos, (const char *) errstr);
-#endif
- data->glBindProgramARB(shader_type, 0);
- data->glDeleteProgramsARB(1, &program);
- return 0;
- }
-
- return program;
-}
-
-
-/*
- * Fragment program that renders from UYVY textures.
- * The UYVY to RGB equasion is:
- * R = 1.164(Y-16) + 1.596(Cr-128)
- * G = 1.164(Y-16) - 0.813(Cr-128) - 0.391(Cb-128)
- * B = 1.164(Y-16) + 2.018(Cb-128)
- * Byte layout is Cb, Y1, Cr, Y2, stored in the R, G, B, A channels.
- * 4 bytes == 2 pixels: Y1/Cb/Cr, Y2/Cb/Cr
- *
- * !!! FIXME: this ignores blendmodes, etc.
- * !!! FIXME: this could be more efficient...use a dot product for green, etc.
- */
-static const char *fragment_program_UYVY_source_code = "!!ARBfp1.0\n"
- /* outputs... */
- "OUTPUT outcolor = result.color;\n"
- /* scratch registers... */
- "TEMP uyvy;\n" "TEMP luminance;\n" "TEMP work;\n"
- /* Halve the coordinates to grab the correct 32 bits for the fragment. */
- "MUL work, fragment.texcoord, { 0.5, 1.0, 1.0, 1.0 };\n"
- /* Sample the YUV texture. Cb, Y1, Cr, Y2, are stored in x, y, z, w. */
- "TEX uyvy, work, texture[0], %TEXTURETARGET%;\n"
- /* Do subtractions (128/255, 16/255, 128/255, 16/255) */
- "SUB uyvy, uyvy, { 0.501960784313726, 0.06274509803922, 0.501960784313726, 0.06274509803922 };\n"
- /* Choose the luminance component by texcoord. */
- /* !!! FIXME: laziness wins out for now... just average Y1 and Y2. */
- "ADD luminance, uyvy.yyyy, uyvy.wwww;\n"
- "MUL luminance, luminance, { 0.5, 0.5, 0.5, 0.5 };\n"
- /* Multiply luminance by its magic value. */
- "MUL luminance, luminance, { 1.164, 1.164, 1.164, 1.164 };\n"
- /* uyvy.xyzw becomes Cr/Cr/Cb/Cb, with multiplications. */
- "MUL uyvy, uyvy.zzxx, { 1.596, -0.813, 2.018, -0.391 };\n"
- /* Add luminance to Cr and Cb, store to RGB channels. */
- "ADD work.rgb, luminance, uyvy;\n"
- /* Do final addition for Green channel. (!!! FIXME: this should be a DPH?) */
- "ADD work.g, work.g, uyvy.w;\n"
- /* Make sure alpha channel is fully opaque. (!!! FIXME: blend modes!) */
- "MOV work.a, { 1.0 };\n"
- /* Store out the final fragment color... */
- "MOV outcolor, work;\n"
- /* ...and we're done! */
- "END\n";
-
static __inline__ SDL_bool
convert_format(GL_RenderData *renderdata, Uint32 pixel_format,
GLint* internalFormat, GLenum* format, GLenum* type)
{
switch (pixel_format) {
- case SDL_PIXELFORMAT_RGB332:
- *internalFormat = GL_R3_G3_B2;
- *format = GL_RGB;
- *type = GL_UNSIGNED_BYTE_3_3_2;
- break;
- case SDL_PIXELFORMAT_RGB444:
- *internalFormat = GL_RGB4;
- *format = GL_RGB;
- *type = GL_UNSIGNED_SHORT_4_4_4_4;
- break;
- case SDL_PIXELFORMAT_RGB555:
- *internalFormat = GL_RGB5;
- *format = GL_RGB;
- *type = GL_UNSIGNED_SHORT_5_5_5_1;
- break;
- case SDL_PIXELFORMAT_ARGB4444:
- *internalFormat = GL_RGBA4;
- *format = GL_BGRA;
- *type = GL_UNSIGNED_SHORT_4_4_4_4_REV;
- break;
- case SDL_PIXELFORMAT_ARGB1555:
- *internalFormat = GL_RGB5_A1;
- *format = GL_BGRA;
- *type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
- break;
- case SDL_PIXELFORMAT_RGB565:
- *internalFormat = GL_RGB8;
- *format = GL_RGB;
- *type = GL_UNSIGNED_SHORT_5_6_5;
- break;
- case SDL_PIXELFORMAT_RGB24:
- *internalFormat = GL_RGB8;
- *format = GL_RGB;
- *type = GL_UNSIGNED_BYTE;
- break;
case SDL_PIXELFORMAT_RGB888:
- *internalFormat = GL_RGB8;
- *format = GL_BGRA;
- *type = GL_UNSIGNED_BYTE;
- break;
- case SDL_PIXELFORMAT_BGR24:
- *internalFormat = GL_RGB8;
- *format = GL_BGR;
- *type = GL_UNSIGNED_BYTE;
- break;
- case SDL_PIXELFORMAT_BGR888:
- *internalFormat = GL_RGB8;
- *format = GL_RGBA;
- *type = GL_UNSIGNED_BYTE;
- break;
case SDL_PIXELFORMAT_ARGB8888:
-#ifdef __MACOSX__
- *internalFormat = GL_RGBA;
+ *internalFormat = GL_RGBA8;
*format = GL_BGRA;
*type = GL_UNSIGNED_INT_8_8_8_8_REV;
-#else
- *internalFormat = GL_RGBA8;
- *format = GL_BGRA;
- *type = GL_UNSIGNED_BYTE;
-#endif
- break;
- case SDL_PIXELFORMAT_ABGR8888:
- *internalFormat = GL_RGBA8;
- *format = GL_RGBA;
- *type = GL_UNSIGNED_BYTE;
- break;
- case SDL_PIXELFORMAT_ARGB2101010:
- *internalFormat = GL_RGB10_A2;
- *format = GL_BGRA;
- *type = GL_UNSIGNED_INT_2_10_10_10_REV;
- break;
- case SDL_PIXELFORMAT_UYVY:
- if (renderdata->GL_APPLE_ycbcr_422_supported) {
- *internalFormat = GL_RGB;
- *format = GL_YCBCR_422_APPLE;
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
- *type = GL_UNSIGNED_SHORT_8_8_APPLE;
-#else
- *type = GL_UNSIGNED_SHORT_8_8_REV_APPLE;
-#endif
- } else if (renderdata->GL_MESA_ycbcr_texture_supported) {
- *internalFormat = GL_YCBCR_MESA;
- *format = GL_YCBCR_MESA;
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
- *type = GL_UNSIGNED_SHORT_8_8_MESA;
-#else
- *type = GL_UNSIGNED_SHORT_8_8_REV_MESA;
-#endif
- } else if (renderdata->GL_ARB_fragment_program_supported) {
- *internalFormat = GL_RGBA;
- *format = GL_RGBA;
- *type = GL_UNSIGNED_BYTE;
- } else {
- return SDL_FALSE;
- }
- break;
- case SDL_PIXELFORMAT_YUY2:
- if (renderdata->GL_APPLE_ycbcr_422_supported) {
- *internalFormat = GL_RGB;
- *format = GL_YCBCR_422_APPLE;
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
- *type = GL_UNSIGNED_SHORT_8_8_REV_APPLE;
-#else
- *type = GL_UNSIGNED_SHORT_8_8_APPLE;
-#endif
- } else if (renderdata->GL_MESA_ycbcr_texture_supported) {
- *internalFormat = GL_YCBCR_MESA;
- *format = GL_YCBCR_MESA;
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
- *type = GL_UNSIGNED_SHORT_8_8_REV_MESA;
-#else
- *type = GL_UNSIGNED_SHORT_8_8_MESA;
-#endif
- } else {
- return SDL_FALSE;
- }
break;
default:
return SDL_FALSE;
@@ -668,7 +355,6 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
GLint internalFormat;
GLenum format, type;
int texture_w, texture_h;
- GLuint shader = 0;
GLenum result;
GL_ActivateRenderer(renderer);
@@ -679,21 +365,6 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
SDL_GetPixelFormatName(texture->format));
return -1;
}
- if (texture->format == SDL_PIXELFORMAT_UYVY &&
- !renderdata->GL_APPLE_ycbcr_422_supported &&
- !renderdata->GL_MESA_ycbcr_texture_supported &&
- renderdata->GL_ARB_fragment_program_supported) {
- if (renderdata->fragment_program_UYVY == 0) {
- renderdata->fragment_program_UYVY =
- compile_shader(renderdata, GL_FRAGMENT_PROGRAM_ARB,
- fragment_program_UYVY_source_code);
- if (renderdata->fragment_program_UYVY == 0) {
- set_shader_error(renderdata, "UYVY");
- return -1;
- }
- }
- shader = renderdata->fragment_program_UYVY;
- }
data = (GL_TextureData *) SDL_calloc(1, sizeof(*data));
if (!data) {
@@ -701,10 +372,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return -1;
}
- data->shader = shader;
-
if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
- data->pitch = texture->w * bytes_per_pixel(texture->format);
+ data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
data->pixels = SDL_malloc(texture->h * data->pitch);
if (!data->pixels) {
SDL_OutOfMemory();
@@ -731,17 +400,6 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
data->texh = (GLfloat) texture->h / texture_h;
}
- /* YUV formats use RGBA but are really two bytes per pixel */
- if (internalFormat == GL_RGBA && bytes_per_pixel(texture->format) < 4) {
- texture_w /= 2;
- if (data->type == GL_TEXTURE_2D) {
- data->texw *= 2.0f;
- }
- data->HACK_RYAN_FIXME = 2;
- } else {
- data->HACK_RYAN_FIXME = 1;
- }
-
data->format = format;
data->formattype = type;
renderdata->glEnable(data->type);
@@ -771,22 +429,13 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
renderdata->glTexParameteri(data->type, GL_TEXTURE_STORAGE_HINT_APPLE,
GL_STORAGE_CACHED_APPLE);
}
-/* This causes a crash in testoverlay for some reason. Apple bug? */
-#if 0
if (texture->access == SDL_TEXTUREACCESS_STREAMING
&& texture->format == SDL_PIXELFORMAT_ARGB8888) {
- /*
- if (renderdata->glTextureRangeAPPLE) {
- renderdata->glTextureRangeAPPLE(data->type,
- texture->h * data->pitch,
- data->pixels);
- }
- */
renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
texture_h, 0, format, type, data->pixels);
- } else
-#endif
+ }
+ else
#endif
{
renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
@@ -801,26 +450,13 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return 0;
}
-static int
-GL_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
- void **pixels, int *pitch)
-{
- GL_TextureData *data = (GL_TextureData *) texture->driverdata;
-
- *pixels = data->pixels;
- *pitch = data->pitch;
- return 0;
-}
-
static void
SetupTextureUpdate(GL_RenderData * renderdata, SDL_Texture * texture,
int pitch)
{
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH,
- (pitch / bytes_per_pixel(texture->format)) /
- ((GL_TextureData *) texture->driverdata)->
- HACK_RYAN_FIXME);
+ (pitch / SDL_BYTESPERPIXEL(texture->format)));
}
static int
@@ -851,18 +487,13 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static int
GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty, void **pixels,
- int *pitch)
+ const SDL_Rect * rect, void **pixels, int *pitch)
{
GL_TextureData *data = (GL_TextureData *) texture->driverdata;
- if (markDirty) {
- SDL_AddDirtyRect(&data->dirty, rect);
- }
-
*pixels =
(void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
- rect->x * bytes_per_pixel(texture->format));
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
*pitch = data->pitch;
return 0;
}
@@ -870,18 +501,17 @@ GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static void
GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
-}
-
-static void
-GL_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
- const SDL_Rect * rects)
-{
+ GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
GL_TextureData *data = (GL_TextureData *) texture->driverdata;
- int i;
- for (i = 0; i < numrects; ++i) {
- SDL_AddDirtyRect(&data->dirty, &rects[i]);
- }
+ GL_ActivateRenderer(renderer);
+
+ SetupTextureUpdate(renderdata, texture, data->pitch);
+ renderdata->glEnable(data->type);
+ renderdata->glBindTexture(data->type, data->texture);
+ renderdata->glTexSubImage2D(data->type, 0, 0, 0, texture->w, texture->h,
+ data->format, data->formattype, data->pixels);
+ renderdata->glDisable(data->type);
}
static void
@@ -1056,28 +686,6 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
GL_ActivateRenderer(renderer);
- if (texturedata->dirty.list) {
- SDL_DirtyRect *dirty;
- void *pixels;
- int bpp = bytes_per_pixel(texture->format);
- int pitch = texturedata->pitch;
-
- SetupTextureUpdate(data, texture, pitch);
- data->glEnable(texturedata->type);
- data->glBindTexture(texturedata->type, texturedata->texture);
- for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
- SDL_Rect *rect = &dirty->rect;
- pixels =
- (void *) ((Uint8 *) texturedata->pixels + rect->y * pitch +
- rect->x * bpp);
- data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y,
- rect->w / texturedata->HACK_RYAN_FIXME,
- rect->h, texturedata->format,
- texturedata->formattype, pixels);
- }
- SDL_ClearDirtyRects(&texturedata->dirty);
- }
-
minx = dstrect->x;
miny = dstrect->y;
maxx = dstrect->x + dstrect->w;
@@ -1106,12 +714,6 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
GL_SetBlendMode(data, texture->blendMode);
- /* Set up the shader for the copy, if any */
- if (texturedata->shader) {
- data->glEnable(GL_FRAGMENT_PROGRAM_ARB);
- data->glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, texturedata->shader);
- }
-
data->glBegin(GL_TRIANGLE_STRIP);
data->glTexCoord2f(minu, minv);
data->glVertex2f((GLfloat) minx, (GLfloat) miny);
@@ -1123,10 +725,6 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
data->glVertex2f((GLfloat) maxx, (GLfloat) maxy);
data->glEnd();
- if (texturedata->shader) {
- data->glDisable(GL_FRAGMENT_PROGRAM_ARB);
- }
-
data->glDisable(texturedata->type);
return 0;
@@ -1155,13 +753,13 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
data->glPixelStorei(GL_PACK_ROW_LENGTH,
- (pitch / bytes_per_pixel(pixel_format)));
+ (pitch / SDL_BYTESPERPIXEL(pixel_format)));
data->glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h,
format, type, pixels);
/* Flip the rows to be top-down */
- length = rect->w * bytes_per_pixel(pixel_format);
+ length = rect->w * SDL_BYTESPERPIXEL(pixel_format);
src = (Uint8*)pixels + (rect->h-1)*pitch;
dst = (Uint8*)pixels;
tmp = SDL_stack_alloc(Uint8, length);
@@ -1201,7 +799,7 @@ GL_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
data->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
data->glPixelStorei(GL_UNPACK_ROW_LENGTH,
- (pitch / bytes_per_pixel(pixel_format)));
+ (pitch / SDL_BYTESPERPIXEL(pixel_format)));
/* Flip the rows to be bottom-up */
length = rect->h * rect->w * pitch;
@@ -1244,13 +842,9 @@ GL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (data->texture) {
renderdata->glDeleteTextures(1, &data->texture);
}
- if (data->palette) {
- SDL_free(data->palette);
- }
if (data->pixels) {
SDL_free(data->pixels);
}
- SDL_FreeDirtyRects(&data->dirty);
SDL_free(data);
texture->driverdata = NULL;
}
@@ -1262,16 +856,6 @@ GL_DestroyRenderer(SDL_Renderer * renderer)
if (data) {
if (data->context) {
- if (data->GL_ARB_fragment_program_supported) {
- data->glDisable(GL_FRAGMENT_PROGRAM_ARB);
- data->glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
- if (data->fragment_program_UYVY &&
- data->fragment_program_UYVY != ~0) {
- data->glDeleteProgramsARB(1,
- &data->fragment_program_UYVY);
- }
- }
-
/* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */
SDL_GL_DeleteContext(data->context);
}
diff --git a/src/render/opengles/SDL_renderer_gles.c b/src/render/opengles/SDL_renderer_gles.c
index 2e5d89dc8..750ea23ef 100644
--- a/src/render/opengles/SDL_renderer_gles.c
+++ b/src/render/opengles/SDL_renderer_gles.c
@@ -49,19 +49,13 @@ static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags);
static void GLES_WindowEvent(SDL_Renderer * renderer,
const SDL_WindowEvent *event);
static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
-static int GLES_QueryTexturePixels(SDL_Renderer * renderer,
- SDL_Texture * texture, void **pixels,
- int *pitch);
static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels,
int pitch);
static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty,
- void **pixels, int *pitch);
+ const SDL_Rect * rect, void **pixels, int *pitch);
static void GLES_UnlockTexture(SDL_Renderer * renderer,
SDL_Texture * texture);
-static void GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- int numrects, const SDL_Rect * rects);
static int GLES_RenderDrawPoints(SDL_Renderer * renderer,
const SDL_Point * points, int count);
static int GLES_RenderDrawLines(SDL_Renderer * renderer,
@@ -82,15 +76,8 @@ SDL_RenderDriver GL_ES_RenderDriver = {
{
"opengl_es",
(SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
- 6,
- {
- /* OpenGL ES 1.x supported formats list */
- SDL_PIXELFORMAT_RGBA4444,
- SDL_PIXELFORMAT_RGBA5551,
- SDL_PIXELFORMAT_RGB565,
- SDL_PIXELFORMAT_RGB24,
- SDL_PIXELFORMAT_BGR888,
- SDL_PIXELFORMAT_ABGR8888},
+ 1,
+ {SDL_PIXELFORMAT_ABGR8888},
0,
0}
};
@@ -125,7 +112,6 @@ typedef struct
GLenum formattype;
void *pixels;
int pitch;
- SDL_DirtyRectList dirty;
} GLES_TextureData;
static void
@@ -205,11 +191,9 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->WindowEvent = GLES_WindowEvent;
renderer->CreateTexture = GLES_CreateTexture;
- renderer->QueryTexturePixels = GLES_QueryTexturePixels;
renderer->UpdateTexture = GLES_UpdateTexture;
renderer->LockTexture = GLES_LockTexture;
renderer->UnlockTexture = GLES_UnlockTexture;
- renderer->DirtyTexture = GLES_DirtyTexture;
renderer->RenderDrawPoints = GLES_RenderDrawPoints;
renderer->RenderDrawLines = GLES_RenderDrawLines;
renderer->RenderFillRects = GLES_RenderFillRects;
@@ -343,32 +327,11 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
GLES_ActivateRenderer(renderer);
switch (texture->format) {
- case SDL_PIXELFORMAT_RGB24:
- internalFormat = GL_RGB;
- format = GL_RGB;
- type = GL_UNSIGNED_BYTE;
- break;
- case SDL_PIXELFORMAT_BGR888:
case SDL_PIXELFORMAT_ABGR8888:
internalFormat = GL_RGBA;
format = GL_RGBA;
type = GL_UNSIGNED_BYTE;
break;
- case SDL_PIXELFORMAT_RGB565:
- internalFormat = GL_RGB;
- format = GL_RGB;
- type = GL_UNSIGNED_SHORT_5_6_5;
- break;
- case SDL_PIXELFORMAT_RGBA5551:
- internalFormat = GL_RGBA;
- format = GL_RGBA;
- type = GL_UNSIGNED_SHORT_5_5_5_1;
- break;
- case SDL_PIXELFORMAT_RGBA4444:
- internalFormat = GL_RGBA;
- format = GL_RGBA;
- type = GL_UNSIGNED_SHORT_4_4_4_4;
- break;
default:
SDL_SetError("Texture format %s not supported by OpenGL ES",
SDL_GetPixelFormatName(texture->format));
@@ -428,23 +391,10 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return 0;
}
-static int
-GLES_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
- void **pixels, int *pitch)
-{
- GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
-
- *pixels = data->pixels;
- *pitch = data->pitch;
- return 0;
-}
-
static void
SetupTextureUpdate(GLES_RenderData * renderdata, SDL_Texture * texture,
int pitch)
{
- GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
- renderdata->glBindTexture(data->type, data->texture);
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
}
@@ -463,8 +413,9 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
GLES_ActivateRenderer(renderer);
renderdata->glGetError();
- renderdata->glEnable(data->type);
SetupTextureUpdate(renderdata, texture, pitch);
+ renderdata->glEnable(data->type);
+ renderdata->glBindTexture(data->type, data->texture);
if( rect->w * bpp == pitch ) {
temp_buffer = (void *)pixels; /* No need to reformat */
@@ -498,15 +449,10 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static int
GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty, void **pixels,
- int *pitch)
+ const SDL_Rect * rect, void **pixels, int *pitch)
{
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
- if (markDirty) {
- SDL_AddDirtyRect(&data->dirty, rect);
- }
-
*pixels =
(void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
rect->x * SDL_BYTESPERPIXEL(texture->format));
@@ -517,18 +463,18 @@ GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static void
GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
-}
-
-static void
-GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- int numrects, const SDL_Rect * rects)
-{
+ GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
- int i;
- for (i = 0; i < numrects; ++i) {
- SDL_AddDirtyRect(&data->dirty, &rects[i]);
- }
+ GLES_ActivateRenderer(renderer);
+
+ SetupTextureUpdate(renderdata, texture, data->pitch);
+ renderdata->glEnable(data->type);
+ renderdata->glBindTexture(data->type, data->texture);
+ renderdata->glTexSubImage2D(data->type, 0, 0, 0, texture->w,
+ texture->h, data->format, data->formattype,
+ data->pixels);
+ renderdata->glDisable(data->type);
}
static void
@@ -676,49 +622,6 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
data->glEnable(GL_TEXTURE_2D);
- if (texturedata->dirty.list) {
- SDL_DirtyRect *dirty;
- void *pixels;
- int bpp = SDL_BYTESPERPIXEL(texture->format);
- int pitch = texturedata->pitch;
-
- SetupTextureUpdate(data, texture, pitch);
-
- data->glBindTexture(texturedata->type, texturedata->texture);
- for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
- SDL_Rect *rect = &dirty->rect;
- pixels =
- (void *) ((Uint8 *) texturedata->pixels + rect->y * pitch +
- rect->x * bpp);
- /* There is no GL_UNPACK_ROW_LENGTH in OpenGLES
- we must do this reformatting ourselves(!)
-
- maybe it'd be a good idea to keep a temp buffer around
- for this purpose rather than allocating it each time
- */
- if( rect->x == 0 && rect->w * bpp == pitch ) {
- temp_buffer = pixels; /* Updating whole texture, no need to reformat */
- } else {
- temp_buffer = SDL_malloc(rect->w * rect->h * bpp);
- temp_ptr = temp_buffer;
- for (i = 0; i < rect->h; i++) {
- SDL_memcpy(temp_ptr, pixels, rect->w * bpp);
- temp_ptr += rect->w * bpp;
- pixels += pitch;
- }
- }
-
- data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y,
- rect->w, rect->h, texturedata->format,
- texturedata->formattype, temp_buffer);
-
- if( temp_buffer != pixels ) {
- SDL_free(temp_buffer);
- }
- }
- SDL_ClearDirtyRects(&texturedata->dirty);
- }
-
data->glBindTexture(texturedata->type, texturedata->texture);
if (texture->modMode) {
@@ -818,7 +721,6 @@ GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (data->pixels) {
SDL_free(data->pixels);
}
- SDL_FreeDirtyRects(&data->dirty);
SDL_free(data);
texture->driverdata = NULL;
}
diff --git a/src/render/software/SDL_renderer_sw.c b/src/render/software/SDL_renderer_sw.c
index 64dbc5a6a..a774752eb 100644
--- a/src/render/software/SDL_renderer_sw.c
+++ b/src/render/software/SDL_renderer_sw.c
@@ -23,7 +23,6 @@
#include "../SDL_sysrender.h"
#include "../../video/SDL_pixels_c.h"
-#include "../../video/SDL_yuv_sw_c.h"
/* SDL surface based renderer implementation */
@@ -32,9 +31,6 @@ static SDL_Renderer *SW_CreateRenderer(SDL_Window * window, Uint32 flags);
static void SW_WindowEvent(SDL_Renderer * renderer,
const SDL_WindowEvent *event);
static int SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
-static int SW_QueryTexturePixels(SDL_Renderer * renderer,
- SDL_Texture * texture, void **pixels,
- int *pitch);
static int SW_SetTextureColorMod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int SW_SetTextureAlphaMod(SDL_Renderer * renderer,
@@ -45,8 +41,7 @@ static int SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels,
int pitch);
static int SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty, void **pixels,
- int *pitch);
+ const SDL_Rect * rect, void **pixels, int *pitch);
static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int SW_RenderDrawPoints(SDL_Renderer * renderer,
const SDL_Point * points, int count);
@@ -70,7 +65,7 @@ SDL_RenderDriver SW_RenderDriver = {
{
"software",
(SDL_RENDERER_PRESENTVSYNC),
- 13,
+ 8,
{
SDL_PIXELFORMAT_RGB555,
SDL_PIXELFORMAT_RGB565,
@@ -79,12 +74,8 @@ SDL_RenderDriver SW_RenderDriver = {
SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_RGBA8888,
SDL_PIXELFORMAT_ABGR8888,
- SDL_PIXELFORMAT_BGRA8888,
- SDL_PIXELFORMAT_YV12,
- SDL_PIXELFORMAT_IYUV,
- SDL_PIXELFORMAT_YUY2,
- SDL_PIXELFORMAT_UYVY,
- SDL_PIXELFORMAT_YVYU},
+ SDL_PIXELFORMAT_BGRA8888
+ },
0,
0}
};
@@ -96,7 +87,6 @@ typedef struct
SDL_Texture *texture;
SDL_Surface surface;
SDL_Renderer *renderer;
- SDL_DirtyRectList dirty;
} SW_RenderData;
static SDL_Texture *
@@ -136,6 +126,7 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_Renderer *renderer;
SW_RenderData *data;
int i;
+ int w, h;
Uint32 format;
int bpp;
Uint32 Rmask, Gmask, Bmask, Amask;
@@ -163,7 +154,6 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
}
renderer->WindowEvent = SW_WindowEvent;
renderer->CreateTexture = SW_CreateTexture;
- renderer->QueryTexturePixels = SW_QueryTexturePixels;
renderer->SetTextureColorMod = SW_SetTextureColorMod;
renderer->SetTextureAlphaMod = SW_SetTextureAlphaMod;
renderer->SetTextureBlendMode = SW_SetTextureBlendMode;
@@ -217,8 +207,8 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
}
/* Create the textures we'll use for display */
- data->texture =
- CreateTexture(data->renderer, data->format, window->w, window->h);
+ SDL_GetWindowSize(window, &w, &h);
+ data->texture = CreateTexture(data->renderer, data->format, w, h);
if (!data->texture) {
SW_DestroyRenderer(renderer);
return NULL;
@@ -243,11 +233,12 @@ SW_ActivateRenderer(SDL_Renderer * renderer)
if (data->updateSize) {
/* Recreate the textures for the new window size */
+ int w, h;
if (data->texture) {
DestroyTexture(data->renderer, data->texture);
}
- data->texture = CreateTexture(data->renderer, data->format,
- window->w, window->h);
+ SDL_GetWindowSize(window, &w, &h);
+ data->texture = CreateTexture(data->renderer, data->format, w, h);
if (data->texture) {
data->updateSize = SDL_FALSE;
}
@@ -268,30 +259,25 @@ SW_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
static int
SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
- if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
- texture->driverdata =
- SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
- } else {
- int bpp;
- Uint32 Rmask, Gmask, Bmask, Amask;
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
- if (!SDL_PixelFormatEnumToMasks
- (texture->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
- SDL_SetError("Unknown texture format");
- return -1;
- }
+ if (!SDL_PixelFormatEnumToMasks
+ (texture->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
+ SDL_SetError("Unknown texture format");
+ return -1;
+ }
- texture->driverdata =
- SDL_CreateRGBSurface(0, texture->w, texture->h, bpp, Rmask, Gmask,
- Bmask, Amask);
- SDL_SetSurfaceColorMod(texture->driverdata, texture->r, texture->g,
- texture->b);
- SDL_SetSurfaceAlphaMod(texture->driverdata, texture->a);
- SDL_SetSurfaceBlendMode(texture->driverdata, texture->blendMode);
+ texture->driverdata =
+ SDL_CreateRGBSurface(0, texture->w, texture->h, bpp, Rmask, Gmask,
+ Bmask, Amask);
+ SDL_SetSurfaceColorMod(texture->driverdata, texture->r, texture->g,
+ texture->b);
+ SDL_SetSurfaceAlphaMod(texture->driverdata, texture->a);
+ SDL_SetSurfaceBlendMode(texture->driverdata, texture->blendMode);
- if (texture->access == SDL_TEXTUREACCESS_STATIC) {
- SDL_SetSurfaceRLE(texture->driverdata, 1);
- }
+ if (texture->access == SDL_TEXTUREACCESS_STATIC) {
+ SDL_SetSurfaceRLE(texture->driverdata, 1);
}
if (!texture->driverdata) {
@@ -300,23 +286,6 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return 0;
}
-static int
-SW_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
- void **pixels, int *pitch)
-{
- if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
- return SDL_SW_QueryYUVTexturePixels((SDL_SW_YUVTexture *)
- texture->driverdata, pixels,
- pitch);
- } else {
- SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
-
- *pixels = surface->pixels;
- *pitch = surface->pitch;
- return 0;
- }
-}
-
static int
SW_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
@@ -343,56 +312,40 @@ static int
SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch)
{
- if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
- return SDL_SW_UpdateYUVTexture((SDL_SW_YUVTexture *)
- texture->driverdata, rect, pixels,
- pitch);
- } else {
- SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
- Uint8 *src, *dst;
- int row;
- size_t length;
+ SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
+ Uint8 *src, *dst;
+ int row;
+ size_t length;
- src = (Uint8 *) pixels;
- dst =
- (Uint8 *) surface->pixels + rect->y * surface->pitch +
- rect->x * surface->format->BytesPerPixel;
- length = rect->w * surface->format->BytesPerPixel;
- for (row = 0; row < rect->h; ++row) {
- SDL_memcpy(dst, src, length);
- src += pitch;
- dst += surface->pitch;
- }
- return 0;
+ src = (Uint8 *) pixels;
+ dst = (Uint8 *) surface->pixels +
+ rect->y * surface->pitch +
+ rect->x * surface->format->BytesPerPixel;
+ length = rect->w * surface->format->BytesPerPixel;
+ for (row = 0; row < rect->h; ++row) {
+ SDL_memcpy(dst, src, length);
+ src += pitch;
+ dst += surface->pitch;
}
+ return 0;
}
static int
SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty, void **pixels,
- int *pitch)
+ const SDL_Rect * rect, void **pixels, int *pitch)
{
- if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
- return SDL_SW_LockYUVTexture((SDL_SW_YUVTexture *)
- texture->driverdata, rect, markDirty,
- pixels, pitch);
- } else {
- SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
+ SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
- *pixels =
- (void *) ((Uint8 *) surface->pixels + rect->y * surface->pitch +
- rect->x * surface->format->BytesPerPixel);
- *pitch = surface->pitch;
- return 0;
- }
+ *pixels =
+ (void *) ((Uint8 *) surface->pixels + rect->y * surface->pitch +
+ rect->x * surface->format->BytesPerPixel);
+ *pitch = surface->pitch;
+ return 0;
}
static void
SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
- if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
- SDL_SW_UnlockYUVTexture((SDL_SW_YUVTexture *) texture->driverdata);
- }
}
static int
@@ -420,7 +373,7 @@ SW_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points,
return 0;
}
- if (data->renderer->LockTexture(data->renderer, texture, &rect, 1,
+ if (data->renderer->LockTexture(data->renderer, texture, &rect,
&data->surface.pixels,
&data->surface.pitch) < 0) {
return -1;
@@ -484,7 +437,7 @@ SW_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
return 0;
}
- if (data->renderer->LockTexture(data->renderer, texture, &rect, 1,
+ if (data->renderer->LockTexture(data->renderer, texture, &rect,
&data->surface.pixels,
&data->surface.pitch) < 0) {
return -1;
@@ -558,7 +511,7 @@ SW_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects,
continue;
}
- if (data->renderer->LockTexture(data->renderer, texture, &rect, 1,
+ if (data->renderer->LockTexture(data->renderer, texture, &rect,
&data->surface.pixels,
&data->surface.pitch) < 0) {
return -1;
@@ -586,38 +539,31 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_Rect * dstrect)
{
SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
+ SDL_Surface *surface;
+ SDL_Rect real_srcrect;
+ SDL_Rect real_dstrect;
int status;
if (!SW_ActivateRenderer(renderer)) {
return -1;
}
- if (data->renderer->LockTexture(data->renderer, data->texture,
- dstrect, 1, &data->surface.pixels,
+ if (data->renderer->LockTexture(data->renderer, data->texture, dstrect,
+ &data->surface.pixels,
&data->surface.pitch) < 0) {
return -1;
}
- if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
- status =
- SDL_SW_CopyYUVToRGB((SDL_SW_YUVTexture *) texture->driverdata,
- srcrect, data->format, dstrect->w, dstrect->h,
- data->surface.pixels, data->surface.pitch);
- } else {
- SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
- SDL_Rect real_srcrect = *srcrect;
- SDL_Rect real_dstrect;
+ surface = (SDL_Surface *) texture->driverdata;
+ real_srcrect = *srcrect;
- data->surface.w = dstrect->w;
- data->surface.h = dstrect->h;
- data->surface.clip_rect.w = dstrect->w;
- data->surface.clip_rect.h = dstrect->h;
- real_dstrect = data->surface.clip_rect;
+ data->surface.w = dstrect->w;
+ data->surface.h = dstrect->h;
+ data->surface.clip_rect.w = dstrect->w;
+ data->surface.clip_rect.h = dstrect->h;
+ real_dstrect = data->surface.clip_rect;
- status =
- SDL_LowerBlit(surface, &real_srcrect, &data->surface,
- &real_dstrect);
- }
+ status = SDL_LowerBlit(surface, &real_srcrect, &data->surface, &real_dstrect);
data->renderer->UnlockTexture(data->renderer, data->texture);
return status;
}
@@ -632,8 +578,8 @@ SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
return -1;
}
- if (data->renderer->LockTexture(data->renderer, data->texture,
- rect, 0, &data->surface.pixels,
+ if (data->renderer->LockTexture(data->renderer, data->texture, rect,
+ &data->surface.pixels,
&data->surface.pitch) < 0) {
return -1;
}
@@ -656,8 +602,8 @@ SW_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
return -1;
}
- if (data->renderer->LockTexture(data->renderer, data->texture,
- rect, 1, &data->surface.pixels,
+ if (data->renderer->LockTexture(data->renderer, data->texture, rect,
+ &data->surface.pixels,
&data->surface.pitch) < 0) {
return -1;
}
@@ -692,13 +638,9 @@ SW_RenderPresent(SDL_Renderer * renderer)
static void
SW_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
- if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
- SDL_SW_DestroyYUVTexture((SDL_SW_YUVTexture *) texture->driverdata);
- } else {
- SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
+ SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
- SDL_FreeSurface(surface);
- }
+ SDL_FreeSurface(surface);
}
static void
@@ -717,7 +659,6 @@ SW_DestroyRenderer(SDL_Renderer * renderer)
if (data->renderer) {
data->renderer->DestroyRenderer(data->renderer);
}
- SDL_FreeDirtyRects(&data->dirty);
SDL_free(data);
}
SDL_free(renderer);
diff --git a/src/video/SDL_leaks.h b/src/video/SDL_leaks.h
index 8e017c89b..1564545e4 100644
--- a/src/video/SDL_leaks.h
+++ b/src/video/SDL_leaks.h
@@ -29,4 +29,5 @@
#ifdef CHECK_LEAKS
extern int surfaces_allocated;
#endif
+
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/SDL_rect.c b/src/video/SDL_rect.c
index a4cd6b861..5f96124f6 100644
--- a/src/video/SDL_rect.c
+++ b/src/video/SDL_rect.c
@@ -339,66 +339,4 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2,
return SDL_TRUE;
}
-void
-SDL_AddDirtyRect(SDL_DirtyRectList * list, const SDL_Rect * rect)
-{
- SDL_DirtyRect *dirty;
-
- /* FIXME: At what point is this optimization too expensive? */
- for (dirty = list->list; dirty; dirty = dirty->next) {
- if (SDL_HasIntersection(&dirty->rect, rect)) {
- SDL_UnionRect(&dirty->rect, rect, &dirty->rect);
- return;
- }
- }
-
- if (list->free) {
- dirty = list->free;
- list->free = dirty->next;
- } else {
- dirty = (SDL_DirtyRect *) SDL_malloc(sizeof(*dirty));
- if (!dirty) {
- return;
- }
- }
- dirty->rect = *rect;
- dirty->next = list->list;
- list->list = dirty;
-}
-
-void
-SDL_ClearDirtyRects(SDL_DirtyRectList * list)
-{
- SDL_DirtyRect *prev, *curr;
-
- /* Skip to the end of the free list */
- prev = NULL;
- for (curr = list->free; curr; curr = curr->next) {
- prev = curr;
- }
-
- /* Add the list entries to the end */
- if (prev) {
- prev->next = list->list;
- } else {
- list->free = list->list;
- }
- list->list = NULL;
-}
-
-void
-SDL_FreeDirtyRects(SDL_DirtyRectList * list)
-{
- while (list->list) {
- SDL_DirtyRect *elem = list->list;
- list->list = elem->next;
- SDL_free(elem);
- }
- while (list->free) {
- SDL_DirtyRect *elem = list->free;
- list->free = elem->next;
- SDL_free(elem);
- }
-}
-
/* vi: set ts=4 sw=4 expandtab: */