set_dirty_rectangle_marker(3)

πŸ“¦ version 1.6, in fedora 43, fedora 44

πŸ’– set_dirty_rectangle_marker(3) πŸ’–

okay bestie, welcome to the gstream manual, page for set_dirty_rectangle_marker β€” yes that's a whole mouthful, but we're gonna get through it together and honestly? it's lowkey iconic. 🫢


✨ NAME ✨

set_dirty_rectangle_marker β€” the function that tells your gstream how to flag the bits it just drew on. πŸ’…


🌸 SYNOPSIS 🌸

#include <gstream.h>

void set_dirty_rectangle_marker(void (*drm)(int, int, int, int))

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: this sets a function that the gstream is gonna use to mark the areas it draws inside as "dirty". Like, imagine you're in a game and you've got a whole dirty rectangle system going β€” and you're using the gstream to spit out assorted info during the main loop. That's the exact moment this becomes super useful, fr fr. The gstream then automatically tells the system which parts of the bitmap it changed, so you don't have to carry that responsibility around like a heavy little backpack. not you doing all that work manually, no ma'am. πŸ’€

The function you hand over gets given these parameters: x and y coordinates, and width and height of the rectangle β€” in that order, no switching up. So if you're rolling with DRS, you could call it like this (since that function takes these four parameters x, y, width, height directly, it just fits):

set_dirty_rectangle_marker(DRS_add_rectangle);

The marker type function is typedef'ed in the class gbuf, which may come in handy in some situations β€” and honestly that's giving very organized of them:

gbuf::dirty_rectangle_marker tmp_drm;

//...

tmp_drm = gs1.get_dirty_rectangle_marker();
gs1.set_dirty_rectangle_marker(gs2.get_dirty_rectangle_marker());
gs2.set_dirty_rectangle_marker(tmp_drm);

Pass the function a null pointer to stop the gstream from even thinking about dirty rectangles, like:

set_dirty_rectangle_marker(0);  // or perhaps
set_dirty_rectangle_marker(NULL);

πŸŽ€ okay but what even IS the "dirty" principle πŸŽ€

If you don't know what the "dirty" principle is all about: bestie, it's a screen-updating technique similar to double buffering, except instead of blitting everything you mark the areas you've drawn on (which made them dirty), and then later when you need to update the screen you only blit these areas β€” thereby cleaning them ✨ β€” instead of the whole entire buffer. efficiency queen behavior.

I suggest you get your hands on DRS if this has made you curious, since it contains a longer introduction to the principle (and also the routines to make it work, by the way :-). It can be fetched at:

http://sunsite.dk/olau/drs/

The default value of the dirty rectangle marker is the null pointer, so that the gstream will not bother marking any rectangles. it's chill like that by default. πŸ™ˆ

⚠️ Note that only the outputter will mark any rectangles dirty, and not the inputter β€” since it is blocking program anyway, waiting for input, meanwhile preventing the main loop from reaching the place where it updates the rectangles. so like, don't come for the inputter, it's busy. 😭

🌈 SEE ALSO 🌈


mwah that's the whole page, bestie β€” you ate it. πŸ’– This was the gstream manual page, sitting pretty at version 1.6. go forth and mark those rectangles dirty, periodt. πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from