2011-04-01 16:27:48 +02:00
|
|
|
/*
|
|
|
|
* DIB driver include file.
|
|
|
|
*
|
|
|
|
* Copyright 2011 Huw Davies
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-07 23:48:24 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int bit_count, width, height;
|
2011-11-29 15:12:00 +01:00
|
|
|
int compression;
|
2012-04-27 14:44:53 +02:00
|
|
|
RECT rect; /* visible rectangle relative to bitmap origin */
|
2011-09-07 23:48:24 +02:00
|
|
|
int stride; /* stride in bytes. Will be -ve for bottom-up dibs (see bits). */
|
|
|
|
struct gdi_image_bits bits; /* bits.ptr points to the top-left corner of the dib. */
|
|
|
|
|
|
|
|
DWORD red_mask, green_mask, blue_mask;
|
|
|
|
int red_shift, green_shift, blue_shift;
|
|
|
|
int red_len, green_len, blue_len;
|
|
|
|
|
2011-12-12 15:58:05 +01:00
|
|
|
const RGBQUAD *color_table;
|
2011-09-07 23:48:24 +02:00
|
|
|
DWORD color_table_size;
|
|
|
|
|
|
|
|
const struct primitive_funcs *funcs;
|
|
|
|
} dib_info;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD count;
|
|
|
|
DWORD dashes[16]; /* 16 is the maximum number for a PS_USERSTYLE pen */
|
|
|
|
DWORD total_len; /* total length of the dashes, should be multiplied by 2 if there are an odd number of dash lengths */
|
|
|
|
} dash_pattern;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int left_in_dash;
|
|
|
|
int cur_dash;
|
|
|
|
BOOL mark;
|
|
|
|
} dash_pos;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD and;
|
|
|
|
DWORD xor;
|
|
|
|
} rop_mask;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
void *and;
|
|
|
|
void *xor;
|
|
|
|
} rop_mask_bits;
|
|
|
|
|
2011-12-30 10:17:37 +01:00
|
|
|
struct dibdrv_physdev;
|
2012-11-27 23:19:29 +01:00
|
|
|
struct cached_font;
|
2011-12-30 10:17:37 +01:00
|
|
|
|
|
|
|
typedef struct dib_brush
|
|
|
|
{
|
|
|
|
UINT style;
|
|
|
|
UINT hatch;
|
|
|
|
INT rop; /* rop2 last used to create the brush bits */
|
|
|
|
COLORREF colorref;
|
|
|
|
dib_info dib;
|
2012-05-22 21:47:30 +02:00
|
|
|
rop_mask_bits masks;
|
2011-12-30 10:17:37 +01:00
|
|
|
struct brush_pattern pattern;
|
|
|
|
BOOL (*rects)(struct dibdrv_physdev *pdev, struct dib_brush *brush, dib_info *dib,
|
2017-08-28 09:07:31 +02:00
|
|
|
int num, const RECT *rects, const POINT *brush_org, INT rop);
|
2011-12-30 10:17:37 +01:00
|
|
|
} dib_brush;
|
|
|
|
|
2011-11-14 13:49:05 +01:00
|
|
|
struct intensity_range
|
|
|
|
{
|
|
|
|
BYTE r_min, r_max;
|
|
|
|
BYTE g_min, g_max;
|
|
|
|
BYTE b_min, b_max;
|
|
|
|
};
|
|
|
|
|
2018-10-17 03:00:53 +02:00
|
|
|
struct font_intensities
|
|
|
|
{
|
|
|
|
struct intensity_range ranges[17];
|
2020-09-23 17:44:57 +02:00
|
|
|
const struct font_gamma_ramp *gamma_ramp;
|
2018-10-17 03:00:53 +02:00
|
|
|
};
|
|
|
|
|
2011-09-07 23:48:24 +02:00
|
|
|
typedef struct dibdrv_physdev
|
|
|
|
{
|
|
|
|
struct gdi_physdev dev;
|
|
|
|
dib_info dib;
|
2011-12-30 10:17:37 +01:00
|
|
|
dib_brush brush;
|
2011-09-07 23:48:24 +02:00
|
|
|
|
|
|
|
HRGN clip;
|
2012-04-25 13:15:24 +02:00
|
|
|
RECT *bounds;
|
2012-11-27 23:19:29 +01:00
|
|
|
struct cached_font *font;
|
2011-09-07 23:48:24 +02:00
|
|
|
|
|
|
|
/* pen */
|
2011-12-28 11:06:30 +01:00
|
|
|
DWORD pen_style, pen_endcap, pen_join;
|
2011-12-28 13:52:58 +01:00
|
|
|
BOOL pen_uses_region, pen_is_ext;
|
2011-12-09 14:47:27 +01:00
|
|
|
int pen_width;
|
2011-12-30 10:38:18 +01:00
|
|
|
dib_brush pen_brush;
|
2011-09-07 23:48:24 +02:00
|
|
|
dash_pattern pen_pattern;
|
|
|
|
dash_pos dash_pos;
|
2011-12-22 13:33:29 +01:00
|
|
|
rop_mask dash_masks[2];
|
2011-12-28 11:56:24 +01:00
|
|
|
BOOL (* pen_lines)(struct dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region);
|
2011-09-07 23:48:24 +02:00
|
|
|
} dibdrv_physdev;
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
extern BOOL CDECL dibdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
|
|
|
|
PHYSDEV src_dev, struct bitblt_coords *src, BLENDFUNCTION blend ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT start_x, INT start_y, INT end_x, INT end_y ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT start_x, INT start_y, INT end_x, INT end_y ) DECLSPEC_HIDDEN;
|
|
|
|
extern DWORD CDECL dibdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_bits *bits,
|
|
|
|
struct bitblt_coords *src, struct bitblt_coords *dst, BLENDFUNCTION func ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT start_x, INT start_y, INT end_x, INT end_y ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT type ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
|
|
|
const RECT *rect, LPCWSTR str, UINT count, const INT *dx ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
|
|
|
|
extern DWORD CDECL dibdrv_GetImage( PHYSDEV dev, BITMAPINFO *info, struct gdi_image_bits *bits,
|
|
|
|
struct bitblt_coords *src ) DECLSPEC_HIDDEN;
|
|
|
|
extern COLORREF CDECL dibdrv_GetNearestColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
|
|
|
|
extern COLORREF CDECL dibdrv_GetPixel( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
|
|
|
|
void *grad_array, ULONG ngrad, ULONG mode ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_LineTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT start_x, INT start_y, INT end_x, INT end_y ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts, DWORD polygons ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts,
|
|
|
|
DWORD polylines ) DECLSPEC_HIDDEN;
|
|
|
|
extern DWORD CDECL dibdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
|
|
|
|
const struct gdi_image_bits *bits, struct bitblt_coords *src,
|
|
|
|
struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT ellipse_width, INT ellipse_height ) DECLSPEC_HIDDEN;
|
|
|
|
extern HBRUSH CDECL dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
|
|
|
|
extern HFONT CDECL dibdrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags ) DECLSPEC_HIDDEN;
|
|
|
|
extern HPEN CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
|
|
|
|
extern COLORREF CDECL dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
|
|
|
|
extern COLORREF CDECL dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
|
|
|
|
extern COLORREF CDECL dibdrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
|
|
|
|
PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_StrokeAndFillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL CDECL dibdrv_StrokePath( PHYSDEV dev ) DECLSPEC_HIDDEN;
|
2011-04-07 14:46:33 +02:00
|
|
|
|
2011-04-01 16:27:48 +02:00
|
|
|
static inline dibdrv_physdev *get_dibdrv_pdev( PHYSDEV dev )
|
|
|
|
{
|
|
|
|
return (dibdrv_physdev *)dev;
|
|
|
|
}
|
2011-04-05 14:23:20 +02:00
|
|
|
|
2011-11-21 11:12:51 +01:00
|
|
|
struct line_params
|
|
|
|
{
|
|
|
|
int err_start, err_add_1, err_add_2, bias;
|
|
|
|
unsigned int length;
|
|
|
|
int x_inc, y_inc;
|
|
|
|
BOOL x_major;
|
|
|
|
};
|
|
|
|
|
2011-09-27 17:13:38 +02:00
|
|
|
struct stretch_params
|
|
|
|
{
|
|
|
|
int err_start, err_add_1, err_add_2;
|
|
|
|
unsigned int length;
|
|
|
|
int dst_inc, src_inc;
|
|
|
|
};
|
|
|
|
|
2011-04-05 14:23:20 +02:00
|
|
|
typedef struct primitive_funcs
|
|
|
|
{
|
2011-09-27 17:13:36 +02:00
|
|
|
void (* solid_rects)(const dib_info *dib, int num, const RECT *rc, DWORD and, DWORD xor);
|
2011-11-21 11:12:52 +01:00
|
|
|
void (* solid_line)(const dib_info *dib, const POINT *start, const struct line_params *params,
|
|
|
|
DWORD and, DWORD xor);
|
2016-05-19 16:16:12 +02:00
|
|
|
void (* pattern_rects)(const dib_info *dib, int num, const RECT *rc, const POINT *origin,
|
2012-05-22 21:52:44 +02:00
|
|
|
const dib_info *brush, const rop_mask_bits *bits);
|
2011-09-27 17:13:36 +02:00
|
|
|
void (* copy_rect)(const dib_info *dst, const RECT *rc, const dib_info *src,
|
|
|
|
const POINT *origin, int rop2, int overlap);
|
2021-04-16 12:11:19 +02:00
|
|
|
void (* blend_rects)(const dib_info *dst, int num, const RECT *rc, const dib_info *src,
|
|
|
|
const POINT *offset, BLENDFUNCTION blend);
|
2011-12-04 17:10:30 +01:00
|
|
|
BOOL (* gradient_rect)(const dib_info *dib, const RECT *rc, const TRIVERTEX *v, int mode);
|
2016-07-13 11:02:28 +02:00
|
|
|
void (* mask_rect)(const dib_info *dst, const RECT *rc, const dib_info *src,
|
|
|
|
const POINT *origin, int rop2);
|
2011-11-14 13:49:06 +01:00
|
|
|
void (* draw_glyph)(const dib_info *dst, const RECT *rc, const dib_info *glyph,
|
|
|
|
const POINT *origin, DWORD text_pixel, const struct intensity_range *ranges);
|
2012-10-30 14:22:16 +01:00
|
|
|
void (* draw_subpixel_glyph)(const dib_info *dst, const RECT *rc, const dib_info *glyph,
|
2018-10-17 03:00:53 +02:00
|
|
|
const POINT *origin, DWORD text_pixel, const struct font_gamma_ramp *gamma_ramp);
|
2012-01-18 15:48:24 +01:00
|
|
|
DWORD (* get_pixel)(const dib_info *dib, int x, int y);
|
2011-09-27 17:13:36 +02:00
|
|
|
DWORD (* colorref_to_pixel)(const dib_info *dib, COLORREF color);
|
2011-10-19 13:41:54 +02:00
|
|
|
COLORREF (* pixel_to_colorref)(const dib_info *dib, DWORD pixel);
|
2012-05-22 10:57:01 +02:00
|
|
|
void (* convert_to)(dib_info *dst, const dib_info *src, const RECT *src_rect, BOOL dither);
|
2012-05-23 11:24:18 +02:00
|
|
|
void (* create_rop_masks)(const dib_info *dib, const BYTE *hatch_ptr,
|
2011-09-27 17:13:36 +02:00
|
|
|
const rop_mask *fg, const rop_mask *bg, rop_mask_bits *bits);
|
2012-05-23 11:14:16 +02:00
|
|
|
void (* create_dither_masks)(const dib_info *dib, int rop2, COLORREF color, rop_mask_bits *bits);
|
2011-09-27 17:13:38 +02:00
|
|
|
void (* stretch_row)(const dib_info *dst_dib, const POINT *dst_start,
|
|
|
|
const dib_info *src_dib, const POINT *src_start,
|
|
|
|
const struct stretch_params *params, int mode, BOOL keep_dst);
|
|
|
|
void (* shrink_row)(const dib_info *dst_dib, const POINT *dst_start,
|
|
|
|
const dib_info *src_dib, const POINT *src_start,
|
|
|
|
const struct stretch_params *params, int mode, BOOL keep_dst);
|
2021-06-15 05:40:42 +02:00
|
|
|
void (* halftone)(const dib_info *dst_dib, const struct bitblt_coords *dst,
|
|
|
|
const dib_info *src_dib, const struct bitblt_coords *src);
|
2011-04-05 14:23:20 +02:00
|
|
|
} primitive_funcs;
|
|
|
|
|
|
|
|
extern const primitive_funcs funcs_8888 DECLSPEC_HIDDEN;
|
2011-04-05 14:26:08 +02:00
|
|
|
extern const primitive_funcs funcs_32 DECLSPEC_HIDDEN;
|
2011-06-01 10:41:39 +02:00
|
|
|
extern const primitive_funcs funcs_24 DECLSPEC_HIDDEN;
|
2011-05-27 14:10:29 +02:00
|
|
|
extern const primitive_funcs funcs_555 DECLSPEC_HIDDEN;
|
|
|
|
extern const primitive_funcs funcs_16 DECLSPEC_HIDDEN;
|
2011-05-27 15:26:02 +02:00
|
|
|
extern const primitive_funcs funcs_8 DECLSPEC_HIDDEN;
|
2011-05-31 11:02:03 +02:00
|
|
|
extern const primitive_funcs funcs_4 DECLSPEC_HIDDEN;
|
2011-06-15 14:43:49 +02:00
|
|
|
extern const primitive_funcs funcs_1 DECLSPEC_HIDDEN;
|
2011-04-05 14:23:20 +02:00
|
|
|
extern const primitive_funcs funcs_null DECLSPEC_HIDDEN;
|
2011-04-07 14:48:39 +02:00
|
|
|
|
2011-08-02 15:11:07 +02:00
|
|
|
struct rop_codes
|
|
|
|
{
|
|
|
|
DWORD a1, a2, x1, x2;
|
|
|
|
};
|
|
|
|
|
2011-09-22 10:11:27 +02:00
|
|
|
#define OVERLAP_LEFT 0x01 /* dest starts left of source */
|
|
|
|
#define OVERLAP_RIGHT 0x02 /* dest starts right of source */
|
|
|
|
#define OVERLAP_ABOVE 0x04 /* dest starts above source */
|
|
|
|
#define OVERLAP_BELOW 0x08 /* dest starts below source */
|
|
|
|
|
2011-09-27 17:13:36 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
unsigned int dx, dy;
|
|
|
|
int bias;
|
|
|
|
DWORD octant;
|
|
|
|
} bres_params;
|
|
|
|
|
2011-12-27 14:31:11 +01:00
|
|
|
struct clipped_rects
|
|
|
|
{
|
|
|
|
RECT *rects;
|
|
|
|
int count;
|
|
|
|
RECT buffer[32];
|
|
|
|
};
|
|
|
|
|
2011-10-03 13:25:34 +02:00
|
|
|
extern void get_rop_codes(INT rop, struct rop_codes *codes) DECLSPEC_HIDDEN;
|
2011-05-06 12:48:34 +02:00
|
|
|
extern void reset_dash_origin(dibdrv_physdev *pdev) DECLSPEC_HIDDEN;
|
2012-05-23 11:56:38 +02:00
|
|
|
extern void init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp) DECLSPEC_HIDDEN;
|
2011-07-12 17:12:04 +02:00
|
|
|
extern void free_dib_info(dib_info *dib) DECLSPEC_HIDDEN;
|
2011-12-30 10:17:37 +01:00
|
|
|
extern void free_pattern_brush(dib_brush *brush) DECLSPEC_HIDDEN;
|
2011-05-12 13:05:37 +02:00
|
|
|
extern void copy_dib_color_info(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL convert_dib(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN;
|
2016-07-28 11:49:47 +02:00
|
|
|
extern DWORD get_pixel_color( DC *dc, const dib_info *dib, COLORREF color, BOOL mono_fixup ) DECLSPEC_HIDDEN;
|
2018-04-04 15:20:57 +02:00
|
|
|
extern int get_dib_rect( const dib_info *dib, RECT *rc ) DECLSPEC_HIDDEN;
|
2012-07-30 13:59:04 +02:00
|
|
|
extern int clip_rect_to_dib( const dib_info *dib, RECT *rc ) DECLSPEC_HIDDEN;
|
2011-12-27 14:31:11 +01:00
|
|
|
extern int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct clipped_rects *clip_rects ) DECLSPEC_HIDDEN;
|
2012-04-25 13:15:24 +02:00
|
|
|
extern void add_clipped_bounds( dibdrv_physdev *dev, const RECT *rect, HRGN clip ) DECLSPEC_HIDDEN;
|
2011-09-27 17:13:36 +02:00
|
|
|
extern int clip_line(const POINT *start, const POINT *end, const RECT *clip,
|
|
|
|
const bres_params *params, POINT *pt1, POINT *pt2) DECLSPEC_HIDDEN;
|
2012-11-27 23:19:29 +01:00
|
|
|
extern void release_cached_font( struct cached_font *font ) DECLSPEC_HIDDEN;
|
2017-07-24 11:47:03 +02:00
|
|
|
extern BOOL fill_with_pixel( DC *dc, dib_info *dib, DWORD pixel, int num, const RECT *rects, INT rop ) DECLSPEC_HIDDEN;
|
2011-04-11 11:00:28 +02:00
|
|
|
|
2011-12-27 14:31:11 +01:00
|
|
|
static inline void init_clipped_rects( struct clipped_rects *clip_rects )
|
|
|
|
{
|
|
|
|
clip_rects->count = 0;
|
|
|
|
clip_rects->rects = clip_rects->buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void free_clipped_rects( struct clipped_rects *clip_rects )
|
|
|
|
{
|
2021-10-01 01:57:05 +02:00
|
|
|
if (clip_rects->rects != clip_rects->buffer) free( clip_rects->rects );
|
2011-12-27 14:31:11 +01:00
|
|
|
}
|
|
|
|
|
2011-12-04 17:10:30 +01:00
|
|
|
/* compute the x coordinate corresponding to y on the specified edge */
|
|
|
|
static inline int edge_coord( int y, int x1, int y1, int x2, int y2 )
|
|
|
|
{
|
|
|
|
if (x2 > x1) /* always follow the edge from right to left to get correct rounding */
|
|
|
|
return x2 + (y - y2) * (x2 - x1) / (y2 - y1);
|
|
|
|
else
|
|
|
|
return x1 + (y - y1) * (x2 - x1) / (y2 - y1);
|
|
|
|
}
|
2012-05-23 11:34:22 +02:00
|
|
|
|
|
|
|
static inline const RGBQUAD *get_dib_color_table( const dib_info *dib )
|
|
|
|
{
|
|
|
|
return dib->color_table ? dib->color_table : get_default_color_table( dib->bit_count );
|
|
|
|
}
|
2020-11-05 10:41:12 +01:00
|
|
|
|
|
|
|
struct osmesa_funcs
|
|
|
|
{
|
2021-10-15 16:53:50 +02:00
|
|
|
void (*get_gl_funcs)( struct opengl_funcs *funcs );
|
|
|
|
struct wgl_context * (*create_context)( HDC hdc, const PIXELFORMATDESCRIPTOR *descr );
|
|
|
|
BOOL (*delete_context)( struct wgl_context *context );
|
|
|
|
PROC (*get_proc_address)( const char *proc );
|
|
|
|
BOOL (*make_current)( struct wgl_context *context, void *bits,
|
|
|
|
int width, int height, int bpp, int stride );
|
2020-11-05 10:41:12 +01:00
|
|
|
};
|
2021-09-29 14:09:21 +02:00
|
|
|
|
|
|
|
extern const struct osmesa_funcs *init_opengl_lib(void) DECLSPEC_HIDDEN;
|