~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/sdl_canvas.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-09-20 22:44:35 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130920224435-apuwj4fsl3fqv1a6
Tags: 1.5.6~20130920~6010666-1
* New snapshot release
* Update the list of supported architectures to the same as libv8
  (Closes: #723129)
* emlibtool has been removed from upstream.
* Fix warning syntax-error-in-dep5-copyright
* Refresh of the patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <stdio.h>
 
2
#include <stdlib.h>
2
3
#include <SDL/SDL.h>
3
4
#include <SDL/SDL_ttf.h>
4
5
#include <emscripten.h>
38
39
 
39
40
  // fill stuff
40
41
  SDL_Rect rect = { 200, 200, 175, 125 };
41
 
  SDL_FillRect(screen, &rect, 0x2222ffff);
 
42
  SDL_FillRect(screen, &rect, SDL_MapRGBA(screen->format, 0x22, 0x22, 0xff, 0xff));
42
43
 
43
44
  SDL_Flip(screen); 
44
45
 
45
46
  SDL_LockSurface(screen);
 
47
 
 
48
  int width, height, isFullscreen;
 
49
  emscripten_get_canvas_size(&width, &height, &isFullscreen);
 
50
 
 
51
  if (width != 600 && height != 450)
 
52
  {
 
53
    printf("error: wrong width/height\n");
 
54
    abort();
 
55
  }
 
56
 
46
57
  int sum = 0;
47
58
  for (int i = 0; i < screen->h; i++) {
48
59
    sum += *((char*)screen->pixels + i*screen->w*4 + i*4 + 0);