Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: ports/xaos/nacl-ui-driver/ui_nacl.c

Issue 1491453003: Fix Xaos port (Closed) Base URL: https://chromium.googlesource.com/external/naclports.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ports/xaos/nacl-ui-driver/ui_nacl.h ('k') | ports/xaos/xaos.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "aconfig.h" 7 #include "aconfig.h"
8 #include "fconfig.h"
8 9
9 #include "ui_nacl.h" 10 #include "ui_nacl.h"
10 11
11 /*includes */ 12 /*includes */
12 #include <ui.h> 13 #include <ui.h>
14 #include <stdarg.h>
13 #include <stdio.h> 15 #include <stdio.h>
14 #include <stdlib.h> 16 #include <stdlib.h>
15 #include <string.h> 17 #include <string.h>
16 18
17 char* getcwd(char* buf, size_t size) { 19 char* getcwd(char* buf, size_t size) {
18 NaClLog(LOG_INFO, "getcwd\n"); 20 NaClLog(LOG_INFO, "getcwd\n");
19 strcpy(buf, "/tmp"); 21 strcpy(buf, "/tmp");
20 return buf; 22 return buf;
21 } 23 }
22 24
23 int kill() { 25 int kill() {
24 NaClLog(LOG_INFO, "kill\n"); 26 NaClLog(LOG_INFO, "kill\n");
25 return -1; 27 return -1;
26 } 28 }
27 29
30 #ifdef NDEBUG
31 static int log_level = LOG_INFO;
32 #else
33 static int log_level = LOG_TRACE;
34 #endif
35
36 void NaClLog(int level, char* fmt, ...) {
37 if (level > log_level)
38 return;
39 va_list ap;
40 va_start(ap, fmt);
41 vfprintf(stderr, fmt, ap);
42 va_end(ap);
43 }
44
28 struct { 45 struct {
29 void* buffers[2]; 46 void* buffers[2];
30 int current_buffer; 47 int current_buffer;
31 } VideoBuffers; 48 } VideoBuffers;
32 49
33 static void nacl_setpalette(ui_palette pal, int start, int end) { 50 static void nacl_setpalette(ui_palette pal, int start, int end) {
34 NaClLog(LOG_INFO, "nacl_setpalette\n"); 51 NaClLog(LOG_INFO, "nacl_setpalette\n");
35 } 52 }
36 53
37 static void nacl_print(int x, int y, CONST char* text) { 54 static void nacl_print(int x, int y, CONST char* text) {
38 if (text[0]) { 55 if (text[0]) {
39 NaClLog(LOG_INFO, "nacl_print [%s]\n", text); 56 NaClLog(LOG_INFO, "nacl_print [%s]\n", text);
40 } 57 }
41 } 58 }
42 59
43 static void nacl_flush(void) { 60 static void nacl_flush(void) {
44 void* data = VideoBuffers.buffers[VideoBuffers.current_buffer]; 61 void* data = VideoBuffers.buffers[VideoBuffers.current_buffer];
45 NaClLog(LOG_INFO, "nacl_flush %d %p\n", VideoBuffers.current_buffer, data); 62 NaClLog(LOG_TRACE, "nacl_flush %d\n", VideoBuffers.current_buffer);
46 if (!data) 63 if (!data)
47 return; 64 return;
48 CHECK(data != NULL);
49 CopyImageDataToVideo(data); 65 CopyImageDataToVideo(data);
50 } 66 }
51 67
52 static void nacl_display() { 68 static void nacl_display() {
53 NaClLog(LOG_INFO, "nacl_display\n"); 69 NaClLog(LOG_TRACE, "nacl_display\n");
54 nacl_flush(); 70 nacl_flush();
55 } 71 }
56 72
57 static void nacl_flip_buffers() { 73 static void nacl_flip_buffers() {
58 NaClLog(LOG_INFO, "nacl_flip_buffers\n"); 74 NaClLog(LOG_TRACE, "nacl_flip_buffers\n");
59 VideoBuffers.current_buffer ^= 1; 75 VideoBuffers.current_buffer ^= 1;
60 } 76 }
61 77
62 static void nacl_free_buffers(char* b1, char* b2) { 78 static void nacl_free_buffers(char* b1, char* b2) {
63 NaClLog(LOG_INFO, "nacl_free_buffers\n"); 79 NaClLog(LOG_INFO, "nacl_free_buffers\n");
64 } 80 }
65 81
66 static int nacl_alloc_buffers(char** b1, char** b2) { 82 static int nacl_alloc_buffers(char** b1, char** b2) {
67 NaClLog(LOG_INFO, "nacl_alloc_buffers\n"); 83 NaClLog(LOG_INFO, "nacl_alloc_buffers\n");
68 const int image_byte_size = GetHeight() * GetWidth() * BYTES_PER_PIXEL; 84 const int image_byte_size = GetHeight() * GetWidth() * BYTES_PER_PIXEL;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 params, /* params */ 191 params, /* params */
176 0, /* flags...see ui.h */ 192 0, /* flags...see ui.h */
177 0.0, 0.0, /* width/height of screen in centimeters */ 193 0.0, 0.0, /* width/height of screen in centimeters */
178 0, 0, /* resolution of screen for windowed systems */ 194 0, 0, /* resolution of screen for windowed systems */
179 UI_TRUECOLOR, /* Image type */ 195 UI_TRUECOLOR, /* Image type */
180 0, 255, 255, /* start, end of palette and maximum allocatable */ 196 0, 255, 255, /* start, end of palette and maximum allocatable */
181 0x00ff0000, /* Rgb mask */ 197 0x00ff0000, /* Rgb mask */
182 0x0000ff00, /* rGb mask */ 198 0x0000ff00, /* rGb mask */
183 0x000000ff /* rgB mask */ 199 0x000000ff /* rgB mask */
184 }; 200 };
OLDNEW
« no previous file with comments | « ports/xaos/nacl-ui-driver/ui_nacl.h ('k') | ports/xaos/xaos.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698