summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2017-08-30 09:10:40 +0000
committerManolo Gouy <Manolo>2017-08-30 09:10:40 +0000
commit6ac3d87d3161e294da9a9767fdd2cde3132f3109 (patch)
tree2754bc47c3189c1f483d517dfe7810a4f7519587 /src
parent9fc2d431020dc443e19e7f3c69315e772b220898 (diff)
Move Fl_Graphics_Driver::draw(Fl_Shared_Image* from Fl_Shared_Image.cxx to Fl_Graphics_Driver.cxx where it belongs.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12408 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Graphics_Driver.cxx27
-rw-r--r--src/Fl_Shared_Image.cxx25
2 files changed, 27 insertions, 25 deletions
diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx
index 6ac49b196..737bffc09 100644
--- a/src/Fl_Graphics_Driver.cxx
+++ b/src/Fl_Graphics_Driver.cxx
@@ -188,6 +188,33 @@ void Fl_Graphics_Driver::set_current_() {
}
+/** Draws an Fl_Shared_Image object using this graphics driver.
+ \param shared shared image to be drawn
+ \param X,Y top-left position of the drawn image */
+void Fl_Graphics_Driver::draw(Fl_Shared_Image *shared, int X, int Y) {
+ if ( shared->w() == shared->image_->w() && shared->h() == shared->image_->h()) {
+ shared->image_->draw(X, Y, shared->w(), shared->h(), 0, 0);
+ return;
+ }
+ // don't call Fl_Graphics_Driver::draw_scaled(Fl_Image*,...) for an enlarged Fl_Bitmap or Fl_Pixmap
+ if (shared->image_->as_rgb_image() || (shared->w() <= shared->image_->w() && shared->h() <= shared->image_->h())) {
+ int done = draw_scaled(shared->image_, X, Y, shared->w(), shared->h());
+ if (done) return;
+ }
+ if (shared->scaled_image_ && (shared->scaled_image_->w() != shared->w() || shared->scaled_image_->h() != shared->h())) {
+ delete shared->scaled_image_;
+ shared->scaled_image_ = NULL;
+ }
+ if (!shared->scaled_image_) {
+ Fl_RGB_Scaling previous = Fl_Shared_Image::RGB_scaling();
+ Fl_Shared_Image::RGB_scaling(shared->scaling_algorithm_); // useless but no harm if image_ is not an Fl_RGB_Image
+ shared->scaled_image_ = shared->image_->copy(shared->w(), shared->h());
+ Fl_Shared_Image::RGB_scaling(previous);
+ }
+ shared->scaled_image_->draw(X, Y, shared->scaled_image_->w(), shared->scaled_image_->h(), 0, 0);
+}
+
+
#ifndef FL_DOXYGEN
Fl_Scalable_Graphics_Driver::Fl_Scalable_Graphics_Driver() : Fl_Graphics_Driver() {
scale_ = 1;
diff --git a/src/Fl_Shared_Image.cxx b/src/Fl_Shared_Image.cxx
index a6783faa6..3c6727696 100644
--- a/src/Fl_Shared_Image.cxx
+++ b/src/Fl_Shared_Image.cxx
@@ -372,31 +372,6 @@ void Fl_Shared_Image::draw(int X, int Y, int W, int H, int cx, int cy) {
if (need_clip) fl_pop_clip();
}
-/** Draws an Fl_Shared_Image object using this graphics driver.
- \param shared shared image to be drawn
- \param X,Y top-left position of the drawn image */
-void Fl_Graphics_Driver::draw(Fl_Shared_Image *shared, int X, int Y) {
- if ( shared->w() == shared->image_->w() && shared->h() == shared->image_->h()) {
- shared->image_->draw(X, Y, shared->w(), shared->h(), 0, 0);
- return;
- }
- // don't call Fl_Graphics_Driver::draw_scaled(Fl_Image*,...) for an enlarged Fl_Bitmap or Fl_Pixmap
- if (shared->image_->as_rgb_image() || (shared->w() <= shared->image_->w() && shared->h() <= shared->image_->h())) {
- int done = draw_scaled(shared->image_, X, Y, shared->w(), shared->h());
- if (done) return;
- }
- if (shared->scaled_image_ && (shared->scaled_image_->w() != shared->w() || shared->scaled_image_->h() != shared->h())) {
- delete shared->scaled_image_;
- shared->scaled_image_ = NULL;
- }
- if (!shared->scaled_image_) {
- Fl_RGB_Scaling previous = Fl_Shared_Image::RGB_scaling();
- Fl_Shared_Image::RGB_scaling(shared->scaling_algorithm_); // useless but no harm if image_ is not an Fl_RGB_Image
- shared->scaled_image_ = shared->image_->copy(shared->w(), shared->h());
- Fl_Shared_Image::RGB_scaling(previous);
- }
- shared->scaled_image_->draw(X, Y, shared->scaled_image_->w(), shared->scaled_image_->h(), 0, 0);
-}
/** Sets the drawing size of the shared image.
This function gives the shared image its own size, independently from the size of the original image