mirror of
https://github.com/fltk/fltk.git
synced 2026-05-31 13:55:38 +08:00
Fix for STR #3106: a tiled image could fail if the size of the tiled surface exceeded the size of the main screen.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10218 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+10
-5
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/Fl_Tiled_Image.H>
|
#include <FL/Fl_Tiled_Image.H>
|
||||||
|
#include <FL/Fl_Window.H>
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,9 +32,10 @@ Fl_Tiled_Image::Fl_Tiled_Image(Fl_Image *i, // I - Image to tile
|
|||||||
Fl_Image(W,H,0) {
|
Fl_Image(W,H,0) {
|
||||||
image_ = i;
|
image_ = i;
|
||||||
alloc_image_ = 0;
|
alloc_image_ = 0;
|
||||||
|
// giving to the tiled image the screen size may fail with multiscreen configurations
|
||||||
if (W == 0) w(Fl::w());
|
// so we leave it with w = h = 0 (STR #3106)
|
||||||
if (H == 0) h(Fl::h());
|
/* if (W == 0) w(Fl::w());
|
||||||
|
if (H == 0) h(Fl::h());*/
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
The destructor frees all memory and server resources that are used by
|
The destructor frees all memory and server resources that are used by
|
||||||
@@ -99,8 +101,11 @@ Fl_Tiled_Image::draw(int X, // I - Starting X position
|
|||||||
int cx, // I - "Source" X position
|
int cx, // I - "Source" X position
|
||||||
int cy) { // I - "Source" Y position
|
int cy) { // I - "Source" Y position
|
||||||
if (!image_->w() || !image_->h()) return;
|
if (!image_->w() || !image_->h()) return;
|
||||||
if (W == 0) W = Fl::w();
|
if (W == 0 && H == 0 && Fl_Window::current()) { // W and H null means the image is potentially as large as the current window
|
||||||
if (H == 0) H = Fl::h();
|
W = Fl_Window::current()->w();
|
||||||
|
H = Fl_Window::current()->h();
|
||||||
|
X = Y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
fl_push_clip(X, Y, W, H);
|
fl_push_clip(X, Y, W, H);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user