From d87b62ea6924c80127ce82b01ad91ea80ace5d73 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 21 Mar 2022 15:56:50 +0100 Subject: Avoid using same name (p) for distinct members of derived classes. --- src/drivers/GDI/Fl_GDI_Graphics_Driver.H | 8 ++++---- src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx | 27 ++++++++++++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-) (limited to 'src/drivers/GDI') diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H index 59c111a39..0749ab798 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H @@ -2,7 +2,7 @@ // Definition of classes Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device // for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2021 by Bill Spitzak and others. +// Copyright 2010-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -59,10 +59,10 @@ protected: int counts[20]; uchar *mask_bitmap_; uchar **mask_bitmap() {return &mask_bitmap_;} - POINT *p; + POINT *long_point; public: - Fl_GDI_Graphics_Driver() {mask_bitmap_ = NULL; gc_ = NULL; p = NULL; depth = -1; origins = NULL;} - virtual ~Fl_GDI_Graphics_Driver() { if (p) free(p); delete[] origins;} + Fl_GDI_Graphics_Driver(); + virtual ~Fl_GDI_Graphics_Driver(); virtual int has_feature(driver_feature mask) { return mask & NATIVE; } char can_do_alpha_blending(); virtual void gc(void *ctxt) { gc_ = (HDC)ctxt; global_gc(); } diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx index caa8d6746..0bdc53ffe 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx @@ -1,7 +1,7 @@ // // Rectangle drawing routines for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2018 by Bill Spitzak and others. +// Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -75,6 +75,19 @@ static FL_BLENDFUNCTION blendfunc = { 0, 0, 255, 1}; */ HDC fl_gc = 0; +Fl_GDI_Graphics_Driver::Fl_GDI_Graphics_Driver() { + mask_bitmap_ = NULL; + gc_ = NULL; + long_point = NULL; + depth = -1; + origins = NULL; +} + +Fl_GDI_Graphics_Driver::~Fl_GDI_Graphics_Driver() { + if (long_point) free(long_point); + delete[] origins; +} + void Fl_GDI_Graphics_Driver::global_gc() { fl_gc = (HDC)gc(); @@ -204,19 +217,19 @@ void Fl_GDI_Graphics_Driver::add_rectangle_to_region(Fl_Region r, int X, int Y, } void Fl_GDI_Graphics_Driver::transformed_vertex0(float x, float y) { - if (!n || x != p[n-1].x || y != p[n-1].y) { + if (!n || x != long_point[n-1].x || y != long_point[n-1].y) { if (n >= p_size) { - p_size = p ? 2*p_size : 16; - p = (POINT*)realloc((void*)p, p_size*sizeof(*p)); + p_size = long_point ? 2*p_size : 16; + long_point = (POINT*)realloc((void*)long_point, p_size*sizeof(*long_point)); } - p[n].x = int(x); - p[n].y = int(y); + long_point[n].x = LONG(x); + long_point[n].y = LONG(y); n++; } } void Fl_GDI_Graphics_Driver::fixloop() { // remove equal points from closed path - while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--; + while (n>2 && long_point[n-1].x == long_point[0].x && long_point[n-1].y == long_point[0].y) n--; } Fl_Region Fl_GDI_Graphics_Driver::XRectangleRegion(int x, int y, int w, int h) { -- cgit v1.2.3