summaryrefslogtreecommitdiff
path: root/recordmydesktop/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-06-23 18:45:28 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-07-11 13:36:41 -0700
commit939781384a38c4a66b4957c42789743942daae7c (patch)
tree0d6b88bece38aaf108cb10e0ba4374baeb943395 /recordmydesktop/src
parent03b6e730fa502be332e8b99750ec213ba39e9128 (diff)
get_frame: demacroify MARK_BUFFER_AREA
Convert macro to function and format retained macro portion
Diffstat (limited to 'recordmydesktop/src')
-rw-r--r--recordmydesktop/src/rmd_get_frame.c91
1 files changed, 43 insertions, 48 deletions
diff --git a/recordmydesktop/src/rmd_get_frame.c b/recordmydesktop/src/rmd_get_frame.c
index 1666193..3074ef3 100644
--- a/recordmydesktop/src/rmd_get_frame.c
+++ b/recordmydesktop/src/rmd_get_frame.c
@@ -83,53 +83,49 @@
(xrect)->height=(brwin)->rrect.height;\
}
-#define MARK_BUFFER_AREA_C( data,\
- x_tm,\
- y_tm,\
- width_tm,\
- height_tm,\
- buffer_width,\
- __bit_depth__) {\
- int k,i;\
- register u_int##__bit_depth__##_t\
- *datapi=\
- ((u_int##__bit_depth__##_t *)data)+y_tm*buffer_width+x_tm;\
- for(k=0;k<height_tm;k++) {\
- for(i=0;i<width_tm;i++) {\
- *datapi+=1;\
- datapi++;\
- }\
- datapi+=buffer_width-width_tm;\
- }\
+#define MARK_BUFFER_AREA_C( data, \
+ x_tm, \
+ y_tm, \
+ width_tm, \
+ height_tm, \
+ buffer_width, \
+ __depth__) { \
+ \
+ register u_int##__depth__##_t *datapi = \
+ ((u_int##__depth__##_t *)data) + y_tm *buffer_width + x_tm; \
+ \
+ for(int k = 0; k < height_tm; k++) { \
+ for(int i = 0; i < width_tm; i++) { \
+ *datapi += 1; \
+ datapi++; \
+ } \
+ datapi += buffer_width - width_tm; \
+ } \
}
-#define MARK_BUFFER_AREA( data,\
- x_tm,\
- y_tm,\
- width_tm,\
- height_tm,\
- buffer_width,\
- __bit_depth__) {\
- if ((__bit_depth__==24)||(__bit_depth__==32)) {\
- MARK_BUFFER_AREA_C( data,\
- x_tm,\
- y_tm,\
- width_tm,\
- height_tm,\
- buffer_width,\
- 32)\
- }\
- else {\
- MARK_BUFFER_AREA_C( data,\
- x_tm,\
- y_tm,\
- width_tm,\
- height_tm,\
- buffer_width,\
- 16)\
- }\
-}\
-
+static void mark_buffer_area( unsigned char *data,
+ int x_tm, int y_tm,
+ int width_tm, int height_tm,
+ int buffer_width, int depth) {
+
+ if ((depth == 24) || (depth == 32)) {
+ MARK_BUFFER_AREA_C( data,
+ x_tm,
+ y_tm,
+ width_tm,
+ height_tm,
+ buffer_width,
+ 32);
+ } else {
+ MARK_BUFFER_AREA_C( data,
+ x_tm,
+ y_tm,
+ width_tm,
+ height_tm,
+ buffer_width,
+ 16);
+ }
+}
//besides taking the first screenshot, this functions primary purpose is to
//initialize the structures and memory.
@@ -432,8 +428,7 @@ void *rmdGetFrame(ProgData *pdata) {
(img_sel)?((unsigned char*)image->data):
((unsigned char*)image_back->data);
- /* FIXME TODO: why is this a macro? */
- MARK_BUFFER_AREA(
+ mark_buffer_area(
back_buff,
mouse_pos_temp.x - temp_brwin.rrect.x + pdata->enc_data->x_offset,
mouse_pos_temp.y - temp_brwin.rrect.y + pdata->enc_data->y_offset,
@@ -569,7 +564,7 @@ void *rmdGetFrame(ProgData *pdata) {
unsigned char *front_buff = (!img_sel)?((unsigned char*)image->data):
((unsigned char*)image_back->data);
- MARK_BUFFER_AREA(
+ mark_buffer_area(
front_buff,
mouse_pos_temp.x - temp_brwin.rrect.x + pdata->enc_data->x_offset,
mouse_pos_temp.y - temp_brwin.rrect.y + pdata->enc_data->y_offset,
© All Rights Reserved