- Colour c(0.5,0.5,1,1);
- ObjectRenderer::RenderLineOnCPU(pix_bounds.x, pix_bounds.y, pix_bounds.x+pix_bounds.w, pix_bounds.y, target, c);
- ObjectRenderer::RenderLineOnCPU(pix_bounds.x, pix_bounds.y+pix_bounds.h, pix_bounds.x+pix_bounds.w, pix_bounds.y+pix_bounds.h, target, c);
- ObjectRenderer::RenderLineOnCPU(pix_bounds.x, pix_bounds.y, pix_bounds.x, pix_bounds.y+pix_bounds.h, target, c);
- ObjectRenderer::RenderLineOnCPU(pix_bounds.x+pix_bounds.w, pix_bounds.y, pix_bounds.x+pix_bounds.w, pix_bounds.y+pix_bounds.h, target, c);
+ int64_t x = min_x;
+ while (x <= max_x)
+ {
+ bool start_black = IsBlack(target.pixels, 4*(x+yy));
+ bool black = start_black;
+ segments.push_back({x,x,start_black});
+ while (black == start_black && ++x <= max_x)
+ {
+ black = IsBlack(target.pixels, 4*(x+yy));
+ }
+ segments.back().second = x-1;
+ }
+
+ // Keep only the interior segments
+ list<Segment>::iterator j = segments.begin();
+ //TODO: Magically delete unneeded segments here...
+
+ // Fill in remaining segments
+ for (j=segments.begin(); j != segments.end(); ++j)
+ {
+ Colour c(group.m_fill);
+ if (j->all_black)
+ {
+ c.r = 1;//1; // Change to debug the outline scanning
+ c.g = 0;
+ c.b = 0;
+ c.a = 1;
+ }
+ for (x = max(min_x, j->first); x <= min(max_x, j->second); ++x)
+ {
+ int64_t index = 4*(x+yy);
+ target.pixels[index+0] = 255*c.r;
+ target.pixels[index+1] = 255*c.g;
+ target.pixels[index+2] = 255*c.b;
+ target.pixels[index+3] = 255*c.a;
+ }
+ }
+ }
+ //#endif //SHADING_DUMB
+ if (view.ShowingObjectBounds())
+ {
+ const Colour & c = group.m_fill;
+ ObjectRenderer::RenderLineOnCPU(pix_bounds.x, pix_bounds.y, pix_bounds.x+pix_bounds.w, pix_bounds.y, target, c);
+ ObjectRenderer::RenderLineOnCPU(pix_bounds.x, pix_bounds.y+pix_bounds.h, pix_bounds.x+pix_bounds.w, pix_bounds.y+pix_bounds.h, target, c);
+ ObjectRenderer::RenderLineOnCPU(pix_bounds.x, pix_bounds.y, pix_bounds.x, pix_bounds.y+pix_bounds.h, target, c);
+ ObjectRenderer::RenderLineOnCPU(pix_bounds.x+pix_bounds.w, pix_bounds.y, pix_bounds.x+pix_bounds.w, pix_bounds.y+pix_bounds.h, target, c);
+ }