comparison TaskManager/Test/test_render/spe/DrawSpan.cpp @ 177:e742053c4c87

zRow の生成、初期化の変更
author gongo@localhost.localdomain
date Tue, 16 Dec 2008 17:16:35 +0900
parents 559b48b69b76
children 5cde66c926b4
comparison
equal deleted inserted replaced
176:08e2bb36639b 177:e742053c4c87
77 DrawSpan::linebuf_init(int *buf, int x, int rgb) 77 DrawSpan::linebuf_init(int *buf, int x, int rgb)
78 { 78 {
79 for (int i = 0; i < x; i++) { 79 for (int i = 0; i < x; i++) {
80 buf[i] = rgb; 80 buf[i] = rgb;
81 } 81 }
82 }
83
84 float*
85 DrawSpan::zRow_init(int w, int h)
86 {
87 float *zRow = NULL;
88 float z = 65535.0f;
89 int length = w*h;
90
91 zRow = (float*)smanager->allocate(sizeof(float)*length);
92
93 for (int i = 0; i < length; i++) {
94 zRow[i] = z;
95 }
96
97 return zRow;
98 } 82 }
99 83
100 Uint32 84 Uint32
101 DrawSpan::get_rgb(int tx, int ty, uint32 *addr) 85 DrawSpan::get_rgb(int tx, int ty, uint32 *addr)
102 { 86 {
151 135
152 int rangex_start = get_param(0); // Υô x ϰϤλ 136 int rangex_start = get_param(0); // Υô x ϰϤλ
153 int rangex_end = get_param(1); // (start <= x <= end) 137 int rangex_end = get_param(1); // (start <= x <= end)
154 int rangey = get_param(2); // y ϰ (render_y + rangey - 1) 138 int rangey = get_param(2); // y ϰ (render_y + rangey - 1)
155 int rangex = rangex_end - rangex_start + 1; 139 int rangex = rangex_end - rangex_start + 1;
156 140
157 float *zRow = zRow_init(rangex, rangey); 141 float *zRow = (float*)smanager->get_input(1);
158 int **linebuf = (int**)smanager->allocate(sizeof(int*)*rangey); 142 int **linebuf = (int**)smanager->allocate(sizeof(int*)*rangey);
159 143
160 for (int i = 0; i < rangey; i++) { 144 for (int i = 0; i < rangey; i++) {
161 linebuf[i] = (int*)smanager->get_output(i); 145 linebuf[i] = (int*)smanager->get_output(i);
162 linebuf_init(linebuf[i], rangex, 0xffffffff); 146 linebuf_init(linebuf[i], rangex, 0xffffffff);
272 next_sp = tmp_sp; 256 next_sp = tmp_sp;
273 } while (sp); 257 } while (sp);
274 258
275 free(free_sp); 259 free(free_sp);
276 free(linebuf); 260 free(linebuf);
277 free(zRow);
278 261
279 return 0; 262 return 0;
280 } 263 }