diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-08-10 10:53:29 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-08-10 10:53:29 +0200 |
| commit | b8c227a8f2bb004de5819c93be5b7f6218402716 (patch) | |
| tree | 1271a93512d5f1211305c23b549db3f019ca4b21 /FL/Fl_Tiled_Image.H | |
| parent | 7d7784d14009343ba224bcc62291bede711f653c (diff) | |
Fix Fl_Xlib_Graphics_Driver for drawing tiled images.
Conflicting demands arise in the implementation of class Fl_Xlib_Graphics_Driver
for drawing images with the XRender library :
1) Issue #163 leads to use a bilinear filter to draw-and-scale images.
2) This tends to blur the edges of drawn areas which is bad for tiled images
(that is because the edges get alpha values, even for an opaque source image).
This commit resolves the conflict adding a means to detect whether the library
is busy drawing a tiled image. If so, the bilinear filter is not applied, drawn areas
don't have blurred edges, resulting in a nice tiling.
With this commit, these test apps perform correctly:
- tiled_image is correct at all scaling factor values also when modified
to use a depth-3 or a depth-4 Fl_RGB_Image as tile;
- unittests - Drawing Images is correct at all scaling factor values;
- pixmap_browser scales correctly up and down JPEG and PNG images.
Diffstat (limited to 'FL/Fl_Tiled_Image.H')
| -rw-r--r-- | FL/Fl_Tiled_Image.H | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/FL/Fl_Tiled_Image.H b/FL/Fl_Tiled_Image.H index 599de4b4e..ebccd3be4 100644 --- a/FL/Fl_Tiled_Image.H +++ b/FL/Fl_Tiled_Image.H @@ -30,13 +30,16 @@ color_average(), desaturate(), or inactive() methods. */ class FL_EXPORT Fl_Tiled_Image : public Fl_Image { - protected: +private: + static bool drawing_tiled_image_; +protected: Fl_Image *image_; // The image that is tiled int alloc_image_; // Did we allocate this image? - public: - +public: + /** Returns true when the FLTK library is currently drawing an Fl_Tiled_Image object. */ + static inline bool drawing_tiled_image() { return drawing_tiled_image_;}; Fl_Tiled_Image(Fl_Image *i, int W = 0, int H = 0); virtual ~Fl_Tiled_Image(); |
