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

Method fillRectangle

source/x11/xdrawable.cpp:211–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) {
213 //klog("XDrawable::fillRectangle clipping not implemented");
214 }
215 if (gc->values.tile) {
216 kpanic("XDrawable::fillRectangle tile not supported");
217 }
218 if (width > w - x) {
219 width = w - x;
220 }
221 if (height > h - y) {
222 height = h - y;
223 }
224
225 if (visual->bits_per_rgb == 32) {
226 U32* p = (U32*)data;
227 U32 color = gc->values.foreground;
228 p += bytes_per_line / 4 * y;
229 for (U32 dstY = 0; dstY < height; dstY++) {
230 for (U32 dstX = 0; dstX < width; dstX++) {
231 p[x + dstX] = color;
232 }
233 p += bytes_per_line/4;
234 }
235 } else {
236 kwarn_fmt("XDrawable::fillRectangle only %d-bit not handled", visual->bits_per_rgb);
237 }
238 setDirty();
239 return Success;
240}
241
242int XDrawable::drawRectangle(KThread* thread, const std::shared_ptr<XGC>& gc, S32 x, S32 y, U32 width, U32 height) {
243 if (gc->clip_rects.size() || gc->values.clip_mask || gc->values.clip_x_origin || gc->values.clip_y_origin) {

Callers 1

x11_FillRectangleFunction · 0.80

Calls 3

kpanicFunction · 0.85
kwarn_fmtFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected