2022-11-16 18:00:12 +01:00
|
|
|
#include <gint/defs/util.h>
|
2020-07-13 17:47:21 +02:00
|
|
|
#include "render-fx.h"
|
2019-02-21 20:58:38 +01:00
|
|
|
|
|
|
|
void masks(int x1, int x2, uint32_t *masks)
|
|
|
|
{
|
2022-11-16 18:00:12 +01:00
|
|
|
x1 = max(x1, dwindow.left);
|
|
|
|
x2 = min(x2, dwindow.right - 1);
|
2019-02-21 20:58:38 +01:00
|
|
|
|
|
|
|
/* Indexes of the first and last non-empty longs */
|
|
|
|
size_t l1 = x1 >> 5;
|
|
|
|
size_t l2 = x2 >> 5;
|
|
|
|
size_t i = 0;
|
|
|
|
|
|
|
|
while(i < l1) masks[i++] = 0x00000000;
|
|
|
|
while(i <= l2) masks[i++] = 0xffffffff;
|
|
|
|
while(i < 4) masks[i++] = 0x00000000;
|
|
|
|
|
2022-11-16 18:00:12 +01:00
|
|
|
/* Remove the index information in x1 and x2; keep only the offsets */
|
2019-02-21 20:58:38 +01:00
|
|
|
x1 &= 31;
|
|
|
|
x2 = ~x2 & 31;
|
|
|
|
|
|
|
|
masks[l1] &= (0xffffffffu >> x1);
|
|
|
|
masks[l2] &= (0xffffffffu << x2);
|
|
|
|
}
|