MCPcopy Create free account
hub / github.com/SimHacker/micropolis / drawRect

Method drawRect

MicropolisCore/src/MicropolisEngine/src/map.cpp:841–1007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

839
840
841void Micropolis::drawRect(
842 int pixel,
843 int solid,
844 int x,
845 int y,
846 int w,
847 int h)
848{
849/*
850 int W = view->m_width, H = view->m_height;
851
852 if (x < 0) {
853 if ((w += x) < 0) {
854 w = 0;
855 }
856 x = 0;
857 } else if (x > W) {
858 x = 0;
859 w = 0;
860 }
861 if (x + w > W) {
862 w = W - x;
863 }
864 if (y < 0) {
865 if ((h += y) < 0) {
866 h = 0;
867 }
868 y = 0;
869 } else if (y > H) {
870 y = 0;
871 h = 0;
872 }
873 if (y + h > H) {
874 h = H - y;
875 }
876
877 if (w && h) {
878 int i, j, stipple = (x ^ y) & 1;
879 unsigned char *data =
880 view->x->color ? view->data : view->data8;
881
882 // In the case of black and white, we use an 8 bit buffer and dither it.
883 int pixelBytes =
884 view->x->color ? view->pixel_bytes : 1;
885 Quad line =
886 view->x->color ? view->line_bytes : view->line_bytes8;
887
888 unsigned char *image =
889 &(data[(line * y) + (x * pixelBytes)]);
890
891 switch (pixelBytes) {
892
893 case 1: {
894 unsigned char *data =
895 view->data8;
896 unsigned char *image =
897 &data[(line * y) + (x * pixelBytes)];
898

Callers 1

paintComponentMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected