Skip to content

Commit

Permalink
SVG support: avoid re-rasterizing an image that was previously raster…
Browse files Browse the repository at this point in the history
…ized at higher resolution.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12460 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Sep 18, 2017
1 parent e483ee8 commit b258f4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Fl_SVG_Image.cxx
Expand Up @@ -218,6 +218,9 @@ void Fl_SVG_Image::color_average(Fl_Color c, float i) {


int Fl_SVG_Image::draw_scaled(int X, int Y, int W, int H) {
if (rasterized_ && raster_w_ >= W && raster_h_ >= H) {
return fl_graphics_driver->draw_scaled(this, X, Y, W, H);
}
w(W);
h(H);
draw(X, Y, W, H, 0, 0);
Expand Down
3 changes: 2 additions & 1 deletion src/drivers/PostScript/Fl_PostScript_image.cxx
Expand Up @@ -608,7 +608,8 @@ int Fl_PostScript_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, in
push_no_clip(); // remove the FLTK clip that can't be rescaled
clocale_printf("%d %d %i %i CL\n", X, Y, W, H);
clocale_printf("GS %d %d TR %f %f SC GS\n", XP, YP, float(WP)/img->w(), float(HP)/img->h());
img->draw(0, 0, img->w(), img->h(), 0, 0);
if (img->as_rgb_image()) draw(img->as_rgb_image(), 0, 0, img->w(), img->h(), 0, 0);
else img->draw(0, 0, img->w(), img->h(), 0, 0);
clocale_printf("GR GR\n");
pop_clip(); // restore FLTK's clip
return 1;
Expand Down

0 comments on commit b258f4b

Please sign in to comment.