MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / drawLine

Method drawLine

source/x11/xdrawable.cpp:173–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173int XDrawable::drawLine(KThread* thread, const std::shared_ptr<XGC>& gc, S32 x1, S32 y1, S32 x2, S32 y2) {
174 if (x1 == x2) {
175 if (x1 >= (S32)w) {
176 return Success;
177 }
178 if (visual->bits_per_rgb == 32) {
179 U32* p = (U32*)data;
180 U32 color = gc->values.foreground;
181 p += bytes_per_line / 4 * y1;
182 p += x1;
183 for (S32 y = y1; y < y2 && y < (S32)h; y++) {
184 *p = color;
185 p += bytes_per_line / 4;
186 }
187 } else {
188 kpanic_fmt("XDrawable::drawLine depth %d not supported", visual->bits_per_rgb);
189 }
190 } else if (y1 == y2) {
191 if (y1 >= (S32)h) {
192 return Success;
193 }
194 if (visual->bits_per_rgb == 32) {
195 U32* p = (U32*)data;
196 U32 color = 0xff00;
197 p += bytes_per_line / 4 * y1;
198 for (S32 x = x1; x < x2 && x < (S32)w; x++) {
199 *p = color;
200 p++;
201 }
202 } else {
203 kwarn_fmt("XDrawable::drawLine depth %d not supported", visual->bits_per_rgb);
204 }
205 } else {
206 klog("XDrawable::drawLine diag line not supported");
207 }
208 return Success;
209}
210
211int XDrawable::fillRectangle(KThread* thread, const std::shared_ptr<XGC>& gc, S32 x, S32 y, U32 width, U32 height) {
212 if (gc->clip_rects.size() || gc->values.clip_mask || gc->values.clip_x_origin || gc->values.clip_y_origin) {

Callers 1

x11_DrawLineFunction · 0.80

Calls 3

kpanic_fmtFunction · 0.85
kwarn_fmtFunction · 0.85
klogFunction · 0.85

Tested by

no test coverage detected