summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorLiam P. White <inkscapebronyat-signgmaildotcom>2014-03-19 01:21:00 +0000
committerLiam P. White <inkscapebronyat-signgmaildotcom>2014-03-19 01:21:00 +0000
commit255dd5fcfd51a58d04aff8e119a2fa08cf5f71cb (patch)
tree1f8c63d7d2bf86c01f2372b47c7afb5e6dc24339 /src/display
parentAdded in new toy effect "Taper Strokes," readded a missing header file, bugfixes (diff)
parentFix for Bug #1291546 (Linking color profile from Document properties dialog c... (diff)
downloadinkscape-255dd5fcfd51a58d04aff8e119a2fa08cf5f71cb.tar.gz
inkscape-255dd5fcfd51a58d04aff8e119a2fa08cf5f71cb.zip
Update to trunk/Fix GTK3 build errors
(bzr r13090.1.26)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/drawing-item.cpp30
-rw-r--r--src/display/drawing-item.h2
-rw-r--r--src/display/drawing-surface.cpp36
-rw-r--r--src/display/sp-canvas.cpp1
4 files changed, 48 insertions, 21 deletions
diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp
index 6c7f99d42..ee52b4165 100644
--- a/src/display/drawing-item.cpp
+++ b/src/display/drawing-item.cpp
@@ -127,6 +127,7 @@ DrawingItem::DrawingItem(Drawing &drawing)
, _propagate(0)
// , _renders_opacity(0)
, _pick_children(0)
+ , _antialias(1)
, _isolation(SP_CSS_ISOLATION_AUTO)
, _blend_mode(SP_CSS_BLEND_NORMAL)
{}
@@ -229,6 +230,8 @@ DrawingItem::prependChild(DrawingItem *item)
void
DrawingItem::clearChildren()
{
+ if (_children.empty()) return;
+
_markForRendering();
// prevent children from referencing the parent during deletion
// this way, children won't try to remove themselves from a list
@@ -266,8 +269,19 @@ DrawingItem::setTransform(Geom::Affine const &new_trans)
void
DrawingItem::setOpacity(float opacity)
{
- _opacity = opacity;
- _markForRendering();
+ if (_opacity != opacity) {
+ _opacity = opacity;
+ _markForRendering();
+ }
+}
+
+void
+DrawingItem::setAntialiasing(bool a)
+{
+ if (_antialias != a) {
+ _antialias = a;
+ _markForRendering();
+ }
}
void
@@ -289,8 +303,10 @@ DrawingItem::setBlendMode(unsigned blend_mode)
void
DrawingItem::setVisible(bool v)
{
- _visible = v;
- _markForRendering();
+ if (_visible != v) {
+ _visible = v;
+ _markForRendering();
+ }
}
/// This is currently unused
@@ -568,6 +584,12 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag
Geom::OptIntRect carea = Geom::intersect(area, _drawbox);
if (!carea) return RENDER_OK;
+ if (_antialias) {
+ cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_DEFAULT);
+ } else {
+ cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_NONE);
+ }
+
// render from cache if possible
if (_cached) {
if (_cache) {
diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h
index 913706021..db803cf60 100644
--- a/src/display/drawing-item.h
+++ b/src/display/drawing-item.h
@@ -108,6 +108,7 @@ public:
void setCached(bool c, bool persistent = false);
void setOpacity(float opacity);
+ void setAntialiasing(bool a);
void setIsolation(unsigned isolation); // CSS Compositing and Blending
void setBlendMode(unsigned blend_mode);
void setTransform(Geom::Affine const &trans);
@@ -205,6 +206,7 @@ protected:
//unsigned _renders_opacity : 1; ///< Whether object needs temporary surface for opacity
unsigned _pick_children : 1; ///< For groups: if true, children are returned from pick(),
/// otherwise the group is returned
+ unsigned _antialias : 1; ///< Whether to use antialiasing
unsigned _isolation : 1;
unsigned _blend_mode : 4;
diff --git a/src/display/drawing-surface.cpp b/src/display/drawing-surface.cpp
index 30579134b..d2540de66 100644
--- a/src/display/drawing-surface.cpp
+++ b/src/display/drawing-surface.cpp
@@ -215,7 +215,7 @@ DrawingCache::prepare()
bool is_identity = _pending_transform.isIdentity();
if (is_identity && _pending_area == old_area) return; // no change
- bool is_integer_translation = false;
+ bool is_integer_translation = is_identity;
if (!is_identity && _pending_transform.isTranslation()) {
Geom::IntPoint t = _pending_transform.translation().round();
if (Geom::are_near(Geom::Point(t), _pending_transform.translation())) {
@@ -224,6 +224,7 @@ DrawingCache::prepare()
if (old_area + t == _pending_area) {
// if the areas match, the only thing to do
// is to ensure that the clean area is not too large
+ // we can exit early
cairo_rectangle_int_t limit = _convertRect(_pending_area);
cairo_region_intersect_rectangle(_clean_region, &limit);
_origin += t;
@@ -232,33 +233,36 @@ DrawingCache::prepare()
}
}
}
- // otherwise, we need to transform the cache
+
+ // the area has changed, so the cache content needs to be copied
Geom::IntPoint old_origin = old_area.min();
cairo_surface_t *old_surface = _surface;
_surface = NULL;
_pixels = _pending_area.dimensions();
_origin = _pending_area.min();
- cairo_t *ct = createRawContext();
- if (!is_identity) {
- ink_cairo_transform(ct, _pending_transform);
- }
- cairo_set_source_surface(ct, old_surface, old_origin[X], old_origin[Y]);
- cairo_set_operator(ct, CAIRO_OPERATOR_SOURCE);
- cairo_paint(ct);
-
- cairo_surface_destroy(old_surface);
- cairo_destroy(ct);
+ if (is_integer_translation) {
+ // transform the cache only for integer translations and identities
+ cairo_t *ct = createRawContext();
+ if (!is_identity) {
+ ink_cairo_transform(ct, _pending_transform);
+ }
+ cairo_set_source_surface(ct, old_surface, old_origin[X], old_origin[Y]);
+ cairo_set_operator(ct, CAIRO_OPERATOR_SOURCE);
+ cairo_pattern_set_filter(cairo_get_source(ct), CAIRO_FILTER_NEAREST);
+ cairo_paint(ct);
+ cairo_destroy(ct);
- if (!is_identity && !is_integer_translation) {
+ cairo_rectangle_int_t limit = _convertRect(_pending_area);
+ cairo_region_intersect_rectangle(_clean_region, &limit);
+ } else {
// dirty everything
cairo_region_destroy(_clean_region);
_clean_region = cairo_region_create();
- } else {
- cairo_rectangle_int_t limit = _convertRect(_pending_area);
- cairo_region_intersect_rectangle(_clean_region, &limit);
}
+
//std::cout << _pending_transform << old_area << _pending_area << std::endl;
+ cairo_surface_destroy(old_surface);
_pending_transform.setIdentity();
}
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index c502daf64..6d903867b 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -35,7 +35,6 @@
#include "display/cairo-utils.h"
#include "debug/gdk-event-latency-tracker.h"
#include "desktop.h"
-#include "sp-namedview.h"
using Inkscape::Debug::GdkEventLatencyTracker;