Anonymous avatar Anonymous committed 0b242a7

Comments (0)

Files changed (1)

test/testblitspeed.py

     screenSurface = 0
     dumpfile = None
 
-    # TODO cmdline args
+    i = 1
+    for arg in sys.argv[1:]:
+        if arg[:2] != '--':
+            continue
+        elif arg == '--dstbpp':
+            dstbpp = int(sys.argv[i + 1])
+        elif arg == '--dstrmask':
+            dstrmask = int(sys.argv[i + 1], 16)
+        elif arg == '--dstgmask':
+            dstgmask = int(sys.argv[i + 1], 16)
+        elif arg == '--dstbmask':
+            dstbmask = int(sys.argv[i + 1], 16)
+        elif arg == '--dstamask':
+            dstamask = int(sys.argv[i + 1], 16)
+        elif arg == '--dstwidth':
+            dstw = int(sys.argv[i + 1])
+        elif arg == '--dstheight':
+            dsth = int(sys.argv[i + 1])
+        elif arg == '--dsthwsurface':
+            dstflags |= SDL_HWSURFACE
+        elif arg == '--srcbpp':
+            srcbpp = int(sys.argv[i + 1])
+        elif arg == '--srcrmask':
+            srcrmask = int(sys.argv[i + 1], 16)
+        elif arg == '--srcgmask':
+            srcgmask = int(sys.argv[i + 1], 16)
+        elif arg == '--srcbmask':
+            srcbmask = int(sys.argv[i + 1], 16)
+        elif arg == '--srcamask':
+            srcamask = int(sys.argv[i + 1], 16)
+        elif arg == '--srcwidth':
+            srcw = int(sys.argv[i + 1])
+        elif arg == '--srcheight':
+            srch = int(sys.argv[i + 1])
+        elif arg == '--srchwsurface':
+            srcflags |= SDL_HWSURFACE
+        elif arg == '--seconds':
+            global testSeconds
+            testSeconds = int(sys.argv[i + 1])
+        elif arg == '--screen':
+            screenSurface = 1
+        elif arg == '--dumpfile':
+            dumpfile = sys.argv[i + 1]
+        i += 1
 
     SDL_Init(SDL_INIT_VIDEO)
     bmp = SDL_LoadBMP(SAMPLE_BMP)
     dstalphaflags = (dest.flags & SDL_SRCALPHA) | (dest.flags & SDL_RLEACCEL)
     origsrcalphaflags = srcalphaflags
     origdstalphaflags = dstalphaflags
-    # TODO more cmdline args
+
+    i = 1
+    for arg in sys.argv[1:]:
+        if arg[:2] != '--':
+            continue
+        elif arg == '--srcalpha':
+            srcalpha = int(sys.argv[i + 1])
+        elif arg == '--dstalpha':
+            dstalpha = int(sys.argv[i + 1])
+        elif arg == '--srcsrcalpha':
+            srcalphaflags |= SDL_SRCALPHA
+        elif arg == '--srcnosrcalpha':
+            srcalphaflags &= ~SDL_SRCALPHA
+        elif arg == '--srcrelaccel':
+            srcalphaflags |= SDL_RLEACCEL
+        elif arg == '--srcnorleaccel':
+            srcalphaflags &= ~SDL_RLEACCEL
+        elif arg == '--dstsrcalpha':
+            dstalphaflags |= SDL_SRCALPHA
+        elif arg == '--dstnosrcalpha':
+            dstalphaflags &= ~SDL_SRCALPHA
+        elif arg == '--dstrelaccel':
+            dstalphaflags |= SDL_RLEACCEL
+        elif arg == '--dstnorleaccel':
+            dstalphaflags &= ~SDL_RLEACCEL
 
     if dstalphaflags != origdstalphaflags or dstalpha != dest.format.alpha:
         SDL_SetAlpha(dest, dstalphaflags, dstalpha)
     testms = testSeconds * 1000
     wmax = dest.w - src.w
     hmax = dest.h - src.h
-    isScreen = SDL_GetVideoSurface() == dest
+    isScreen = SDL_GetVideoSurface() is not None
 
     print 'Testing blit speed for %d seconds...' % testSeconds
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.