Commit 757e7cb4 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

Replace SELECTOR_AllocBlock and SELECTOR_FreeBlock with standard Win16

selector calls.
parent 5de5a443
......@@ -161,15 +161,15 @@ static void SELECTOR_SetEntries( WORD sel, const void *base, DWORD size, unsigne
WORD i, count;
wine_ldt_set_base( &entry, base );
wine_ldt_set_limit( &entry, size - 1 );
wine_ldt_set_flags( &entry, flags );
/* Make sure base and limit are not 0 together if the size is not 0 */
if (!base && size == 1) wine_ldt_set_limit( &entry, 1 );
wine_ldt_set_limit( &entry, (!base && size == 1) ? 1 : size - 1 );
wine_ldt_set_flags( &entry, flags );
count = (size + 0xffff) / 0x10000;
for (i = 0; i < count; i++)
{
wine_ldt_set_entry( sel + (i << __AHSHIFT), &entry );
wine_ldt_set_base( &entry, wine_ldt_get_base(&entry) + 0x10000 );
/* yep, Windows sets limit like that, not 64K sel units */
wine_ldt_set_limit( &entry, wine_ldt_get_limit(&entry) - 0x10000 );
}
}
......
......@@ -443,7 +443,14 @@ BOOL BITMAP_DeleteObject( HBITMAP16 hbitmap, BITMAPOBJ * bmp )
}
HeapFree(GetProcessHeap(), 0, dib);
bmp->dib = NULL;
if (bmp->segptr_bits) SELECTOR_FreeBlock( SELECTOROF(bmp->segptr_bits) );
if (bmp->segptr_bits)
{ /* free its selector array */
WORD sel = SELECTOROF(bmp->segptr_bits);
WORD count = (GetSelectorLimit16(sel) / 0x10000) + 1;
int i;
for (i = 0; i < count; i++) FreeSelector16(sel + (i << __AHSHIFT));
}
}
return GDI_FreeObject( hbitmap, bmp );
}
......
......@@ -895,7 +895,17 @@ HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, BITMAPINFO *bmi, UINT16 usage,
INT size = (bi->biSizeImage && bi->biCompression != BI_RGB) ?
bi->biSizeImage : width_bytes * height;
WORD sel = SELECTOR_AllocBlock( bits32, size, WINE_LDT_FLAGS_DATA );
/* calculate number of sel's needed for size with 64K steps */
WORD count = (size + 0xffff) / 0x10000;
WORD sel = AllocSelectorArray16(count);
int i;
for (i = 0; i < count; i++)
{
SetSelectorBase(sel + (i << __AHSHIFT), (DWORD)bits32 + i * 0x10000);
SetSelectorLimit16(sel + (i << __AHSHIFT), size - 1); /* yep, limit is correct */
size -= 0x10000;
}
bmp->segptr_bits = MAKESEGPTR( sel, 0 );
if (bits16) *bits16 = bmp->segptr_bits;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment