summaryrefslogtreecommitdiffstats
path: root/src/sp-image.cpp
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2014-02-25 17:29:16 +0000
committerMartin Owens <doctormo@gmail.com>2014-02-25 17:29:16 +0000
commite84ae2ae2b7035f2dd7ae0bfb026f80ff8bc8f87 (patch)
tree7bfc20c5f22bb0120ebde7c81bc4410aca0dace4 /src/sp-image.cpp
parentNot finished by improved data uri support (diff)
parentFix infinite loop (?) by disabling saving the order of filters when they are ... (diff)
downloadinkscape-e84ae2ae2b7035f2dd7ae0bfb026f80ff8bc8f87.tar.gz
inkscape-e84ae2ae2b7035f2dd7ae0bfb026f80ff8bc8f87.zip
Merge from trunk
(bzr r13047.1.3)
Diffstat (limited to 'src/sp-image.cpp')
-rw-r--r--src/sp-image.cpp42
1 files changed, 9 insertions, 33 deletions
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index 5f630f7b7..2c20331a9 100644
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -500,39 +500,15 @@ void SPImage::print(SPPrintContext *ctx) {
int w = pb->width();
int h = pb->height();
int rs = pb->rowstride();
- //int pixskip = gdk_pixbuf_get_n_channels(pb) * gdk_pixbuf_get_bits_per_sample(pb) / 8;
- int pixskip = 4;
-
- if (this->aspect_align == SP_ASPECT_NONE) {
- Geom::Affine t;
- Geom::Translate tp(this->x.computed, this->y.computed);
- Geom::Scale s(this->width.computed, -this->height.computed);
- Geom::Translate ti(0.0, -1.0);
- t = s * tp;
- t = ti * t;
- sp_print_image_R8G8B8A8_N(ctx, px, w, h, rs, t, this->style);
- } else { // preserveAspectRatio
- double vw = this->width.computed / this->sx;
- double vh = this->height.computed / this->sy;
-
- int trimwidth = std::min<int>(w, ceil(this->width.computed / vw * w));
- int trimheight = std::min<int>(h, ceil(this->height.computed / vh * h));
- int trimx = std::max<int>(0, floor((this->x.computed - this->ox) / vw * w));
- int trimy = std::max<int>(0, floor((this->y.computed - this->oy) / vh * h));
-
- double vx = std::max<double>(this->ox, this->x.computed);
- double vy = std::max<double>(this->oy, this->y.computed);
- double vcw = std::min<double>(this->width.computed, vw);
- double vch = std::min<double>(this->height.computed, vh);
-
- Geom::Affine t;
- Geom::Translate tp(vx, vy);
- Geom::Scale s(vcw, -vch);
- Geom::Translate ti(0.0, -1.0);
- t = s * tp;
- t = ti * t;
- sp_print_image_R8G8B8A8_N(ctx, px + trimx*pixskip + trimy*rs, trimwidth, trimheight, rs, t, this->style);
- }
+
+ double vx = this->ox;
+ double vy = this->oy;
+
+ Geom::Affine t;
+ Geom::Translate tp(vx, vy);
+ Geom::Scale s(this->sx, this->sy);
+ t = s * tp;
+ sp_print_image_R8G8B8A8_N(ctx, px, w, h, rs, t, this->style);
delete pb;
}
}