comparison engine/core/view/renderers/instancerenderer.cpp @ 39:4e68022ed545

fix some pixels wrongly highlighted in outlines
author spq@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 12 Jul 2008 12:35:31 +0000
parents 4a0efb7baf70
children 90005975cdbb
comparison
equal deleted inserted replaced
38:38232a42ff8d 39:4e68022ed545
175 // needs to use SDLImage here, since GlImage does not support drawing primitives atm 175 // needs to use SDLImage here, since GlImage does not support drawing primitives atm
176 SDLImage* img = new SDLImage(outline_surface); 176 SDLImage* img = new SDLImage(outline_surface);
177 177
178 // TODO: optimize... 178 // TODO: optimize...
179 uint8_t r, g, b, a = 0; 179 uint8_t r, g, b, a = 0;
180 int prev_a = a;
181 180
182 // vertical sweep 181 // vertical sweep
183 for (unsigned int x = 0; x < img->getWidth(); x ++) { 182 for (unsigned int x = 0; x < img->getWidth(); x ++) {
183 uint8_t prev_a = 0;
184 for (unsigned int y = 0; y < img->getHeight(); y ++) { 184 for (unsigned int y = 0; y < img->getHeight(); y ++) {
185 vc.image->getPixelRGBA(x, y, &r, &g, &b, &a); 185 vc.image->getPixelRGBA(x, y, &r, &g, &b, &a);
186 if ((a == 0 || prev_a == 0) && (a != prev_a)) { 186 if ((a == 0 || prev_a == 0) && (a != prev_a)) {
187 if (a < prev_a) { 187 if (a < prev_a) {
188 for (unsigned int yy = y; yy < y + info.width; yy++) { 188 for (unsigned int yy = y; yy < y + info.width; yy++) {
197 prev_a = a; 197 prev_a = a;
198 } 198 }
199 } 199 }
200 // horizontal sweep 200 // horizontal sweep
201 for (unsigned int y = 0; y < img->getHeight(); y ++) { 201 for (unsigned int y = 0; y < img->getHeight(); y ++) {
202 uint8_t prev_a = 0;
202 for (unsigned int x = 0; x < img->getWidth(); x ++) { 203 for (unsigned int x = 0; x < img->getWidth(); x ++) {
203 vc.image->getPixelRGBA(x, y, &r, &g, &b, &a); 204 vc.image->getPixelRGBA(x, y, &r, &g, &b, &a);
204 if ((a == 0 || prev_a == 0) && (a != prev_a)) { 205 if ((a == 0 || prev_a == 0) && (a != prev_a)) {
205 if (a < prev_a) { 206 if (a < prev_a) {
206 for (unsigned int xx = x; xx < x + info.width; xx++) { 207 for (unsigned int xx = x; xx < x + info.width; xx++) {