forked from Mirrors/wine-wine
gdiplus: Simplify modulo 8 math used for rendering origin.
Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Esme Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>master
parent
c80b236366
commit
47b0155f96
|
@ -159,8 +159,8 @@ static HBITMAP create_hatch_bitmap(const GpHatch *hatch, INT origin_x, INT origi
|
||||||
* degree of shading needed. */
|
* degree of shading needed. */
|
||||||
for (y = 0; y < 8; y++)
|
for (y = 0; y < 8; y++)
|
||||||
{
|
{
|
||||||
const int hy = (((y + origin_y) % 8) + 8) % 8;
|
const int hy = (y + origin_y) & 7;
|
||||||
const int hx = ((origin_x % 8) + 8) % 8;
|
const int hx = origin_x & 7;
|
||||||
unsigned int row = (0x10101 * hatch_data[hy]) >> hx;
|
unsigned int row = (0x10101 * hatch_data[hy]) >> hx;
|
||||||
|
|
||||||
for (x = 0; x < 8; x++, row >>= 1)
|
for (x = 0; x < 8; x++, row >>= 1)
|
||||||
|
@ -1198,13 +1198,13 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
|
||||||
/* See create_hatch_bitmap for an explanation of how index is derived. */
|
/* See create_hatch_bitmap for an explanation of how index is derived. */
|
||||||
for (y = 0; y < fill_area->Height; y++, argb_pixels += cdwStride)
|
for (y = 0; y < fill_area->Height; y++, argb_pixels += cdwStride)
|
||||||
{
|
{
|
||||||
const int hy = (7 - ((y + fill_area->Y - graphics->origin_y) % 8)) % 8;
|
const int hy = ~(y + fill_area->Y - graphics->origin_y) & 7;
|
||||||
const int hx = ((graphics->origin_x % 8) + 8) % 8;
|
const int hx = graphics->origin_x & 7;
|
||||||
const unsigned int row = (0x10101 * hatch_data[hy]) >> hx;
|
const unsigned int row = (0x10101 * hatch_data[hy]) >> hx;
|
||||||
|
|
||||||
for (x = 0; x < fill_area->Width; x++)
|
for (x = 0; x < fill_area->Width; x++)
|
||||||
{
|
{
|
||||||
const unsigned int srow = row >> (7 - ((x + fill_area->X) % 8));
|
const unsigned int srow = row >> (~(x + fill_area->X) & 7);
|
||||||
int index;
|
int index;
|
||||||
if (hatch_data[8])
|
if (hatch_data[8])
|
||||||
index = (srow & 1) ? 2 : (srow & 0x82) ? 1 : 0;
|
index = (srow & 1) ? 2 : (srow & 0x82) ? 1 : 0;
|
||||||
|
|
|
@ -1814,8 +1814,8 @@ static void test_renderingOrigin(void)
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||||
{
|
{
|
||||||
const INT exp_x = ((tests[i][0] % 8) + 8) % 8;
|
const INT exp_x = tests[i][0] & 7;
|
||||||
const INT exp_y = ((tests[i][1] % 8) + 8) % 8;
|
const INT exp_y = tests[i][1] & 7;
|
||||||
|
|
||||||
status = GdipSetRenderingOrigin(graphics_image, tests[i][0], tests[i][1]);
|
status = GdipSetRenderingOrigin(graphics_image, tests[i][0], tests[i][1]);
|
||||||
expect(Ok, status);
|
expect(Ok, status);
|
||||||
|
|
Loading…
Reference in New Issue