/* ddraw_hline: * Accelerated scanline fill routine. */ static void ddraw_hline(BITMAP *bmp, int x1, int y, int x2, int color) { struct Ph_rect dest_rect; struct BITMAP *parent; if (_drawing_mode != DRAW_MODE_SOLID) { _orig_hline(bmp, x1, y, x2, color); return; } if (x1 > x2) { int tmp = x1; x1 = x2; x2 = tmp; } if (bmp->clip) { if ((y < bmp->ct) || (y >= bmp->cb)) return; if (x1 < bmp->cl) x1 = bmp->cl; if (x2 >= bmp->cr) x2 = bmp->cr-1; if (x2 < x1) return; } dest_rect.ul.x = x1 + bmp->x_ofs; dest_rect.ul.y = y + bmp->y_ofs; dest_rect.lr.x = x2 + bmp->x_ofs; dest_rect.lr.y = y + bmp->y_ofs; /* find parent */ parent = bmp; while (parent->id & BMP_ID_SUB) parent = (BITMAP *)parent->extra; PhDCSetCurrent(BMP_EXTRA(parent)->context); PgDrawLine(&dest_rect.ul, &dest_rect.lr); if (parent == pseudo_screen) ph_update_window(&dest_rect); else PgFlush(); }
/* _xaccel_hline: * Accelerated hline. */ static void _xaccel_hline(BITMAP *bmp, int x1, int y, int x2, int color) { int tmp; if (_drawing_mode != DRAW_MODE_SOLID) { _orig_hline(bmp, x1, y, x2, color); return; } if (x1 > x2) { tmp = x1; x1 = x2; x2 = tmp; } if (bmp->clip) { if ((y < bmp->ct) || (y >= bmp->cb)) return; if (x1 < bmp->cl) x1 = bmp->cl; if (x2 >= bmp->cr) x2 = bmp->cr-1; if (x2 < x1) return; } x1 += bmp->x_ofs; y += bmp->y_ofs; x2 += bmp->x_ofs; XLOCK(); XDGAFillRectangle(_xwin.display, _xwin.screen, x1, y, (x2 - x1) + 1, 1, color); XUNLOCK(); bmp->id &= ~BMP_ID_LOCKED; }
/* ddraw_hline: * Accelerated scanline fill routine. */ static void ddraw_hline(BITMAP *bitmap, int x1, int y, int x2, int color) { RECT dest_rect; HRESULT hr; DDBLTFX blt_fx; BITMAP *parent; if (_drawing_mode != DRAW_MODE_SOLID) { _orig_hline(bitmap, x1, y, x2, color); return; } if (x1 > x2) { int tmp = x1; x1 = x2; x2 = tmp; } if (bitmap->clip) { if ((y < bitmap->ct) || (y >= bitmap->cb)) return; if (x1 < bitmap->cl) x1 = bitmap->cl; if (x2 >= bitmap->cr) x2 = bitmap->cr-1; if (x2 < x1) return; } dest_rect.left = x1 + bitmap->x_ofs; dest_rect.top = y + bitmap->y_ofs; dest_rect.right = x2 + bitmap->x_ofs + 1; dest_rect.bottom = y + bitmap->y_ofs + 1; /* find parent */ parent = bitmap; while (parent->id & BMP_ID_SUB) parent = (BITMAP *)parent->extra; /* set fill color */ blt_fx.dwSize = sizeof(blt_fx); blt_fx.dwDDFX = 0; blt_fx.dwFillColor = color; _enter_gfx_critical(); gfx_directx_release_lock(bitmap); hr = IDirectDrawSurface2_Blt(DDRAW_SURFACE_OF(parent)->id, &dest_rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &blt_fx); _exit_gfx_critical(); if (FAILED(hr)) _TRACE(PREFIX_E "Blt failed (%x)\n", hr); /* only for windowed mode */ if ((gfx_driver->id == GFX_DIRECTX_WIN) && (parent == gfx_directx_forefront_bitmap)) win_gfx_driver->paint(&dest_rect); }