summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d3406b9)
raw | patch | inline | side by side (parent: d3406b9)
author | mental <mental@users.sourceforge.net> | |
Mon, 31 Mar 2008 02:44:19 +0000 (02:44 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Mon, 31 Mar 2008 02:44:19 +0000 (02:44 +0000) |
13 files changed:
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 922da935dc8d689a5f354dc22171165f73f02ff5..657d423048bd2f692c39853650c1d0d7ca76e453 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
gr_point_type( 0 ),
gr_point_i( 0 ),
gr_fill_or_stroke( true ),
+ displayMode(Inkscape::RENDERMODE_NORMAL),
_layer_hierarchy( 0 ),
_reconstruction_old_layer_id( 0 ),
_widget( 0 ),
@@ -415,25 +416,25 @@ SPDesktop::remove_temporary_canvasitem (Inkscape::Display::TemporaryItem * tempi
void SPDesktop::setDisplayModeNormal()
{
- SP_CANVAS_ARENA (drawing)->arena->rendermode = RENDERMODE_NORMAL;
- canvas->rendermode = RENDERMODE_NORMAL; // canvas needs that for choosing the best buffer size
- displayMode = RENDERMODE_NORMAL;
+ SP_CANVAS_ARENA (drawing)->arena->rendermode = Inkscape::RENDERMODE_NORMAL;
+ canvas->rendermode = Inkscape::RENDERMODE_NORMAL; // canvas needs that for choosing the best buffer size
+ displayMode = Inkscape::RENDERMODE_NORMAL;
sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (main), _d2w); // redraw
_widget->setTitle(SP_DOCUMENT_NAME(sp_desktop_document(this)));
}
void SPDesktop::setDisplayModeOutline()
{
- SP_CANVAS_ARENA (drawing)->arena->rendermode = RENDERMODE_OUTLINE;
- canvas->rendermode = RENDERMODE_OUTLINE; // canvas needs that for choosing the best buffer size
- displayMode = RENDERMODE_OUTLINE;
+ SP_CANVAS_ARENA (drawing)->arena->rendermode = Inkscape::RENDERMODE_OUTLINE;
+ canvas->rendermode = Inkscape::RENDERMODE_OUTLINE; // canvas needs that for choosing the best buffer size
+ displayMode = Inkscape::RENDERMODE_OUTLINE;
sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (main), _d2w); // redraw
_widget->setTitle(SP_DOCUMENT_NAME(sp_desktop_document(this)));
}
void SPDesktop::displayModeToggle()
{
- if (displayMode == RENDERMODE_OUTLINE)
+ if (displayMode == Inkscape::RENDERMODE_OUTLINE)
setDisplayModeNormal();
else
setDisplayModeOutline();
diff --git a/src/desktop.h b/src/desktop.h
index 52bb91c76e7a31781dcceabd08bfffe99c39302b..672cd2b5c6a80ea89649ad7fd95c4ca54478eb46 100644 (file)
--- a/src/desktop.h
+++ b/src/desktop.h
#include "ui/view/view.h"
#include "ui/view/edit-widget-interface.h"
+#include "display/rendermode.h"
+
class NRRect;
class SPCSSAttr;
struct _GtkWidget;
void setDisplayModeNormal();
void setDisplayModeOutline();
void displayModeToggle();
- int displayMode;
- int getMode() const { return displayMode; }
+ Inkscape::RenderMode displayMode;
+ Inkscape::RenderMode getMode() const { return displayMode; }
Inkscape::UI::Widget::Dock* getDock() { return _widget->getDock(); }
index d7b0fb608043549251adeaabc4c00c4eb00985a2..2e27cc1889b5efc1285fae3b667cfeb4eae0f7f2 100644 (file)
display/nr-plain-stuff-gdk.h \
display/nr-plain-stuff.cpp \
display/nr-plain-stuff.h \
+ display/rendermode.h \
display/snap-indicator.cpp \
display/snap-indicator.h \
display/sodipodi-ctrl.cpp \
index f1a991434866b8c92a8d23daeca0161c8239c392..f813a03c9add89c90afcc9949cc880a3dc2261fe 100644 (file)
// from here the sw/sh calculation, the loop, and creating the intermediate buffer, allowing arena
// just render into buf in one go.
- if (arena->arena->rendermode != RENDERMODE_OUTLINE) { // use 256K as a compromise to not slow down gradients
+ if (arena->arena->rendermode != Inkscape::RENDERMODE_OUTLINE) { // use 256K as a compromise to not slow down gradients
/* 256K is the cached buffer and we need 4 channels */
if (bw * bh < 65536) { // 256K/4
/* We can go with single buffer */
if (pb.empty == FALSE) {
- if (arena->arena->rendermode == RENDERMODE_OUTLINE) {
+ if (arena->arena->rendermode == Inkscape::RENDERMODE_OUTLINE) {
// currently we only use cairo in outline mode
// ENDIANNESS FIX
index 9456e8a7e635d57c193bd130618dc1dd2ddc2d41..6ee1be796b534febaed10b06b0a225e4032c2e6e 100644 (file)
@@ -444,7 +444,7 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
guint ret = item->state;
- if (item->arena->rendermode == RENDERMODE_OUTLINE) {
+ if (item->arena->rendermode == Inkscape::RENDERMODE_OUTLINE) {
if (!ct)
return item->state;
@@ -473,7 +473,7 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
/* Fill */
- if (!style->fill.isNone() || item->arena->rendermode == RENDERMODE_OUTLINE) {
+ if (!style->fill.isNone() || item->arena->rendermode == Inkscape::RENDERMODE_OUTLINE) {
NRPixBlock m;
nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE);
@@ -499,9 +499,9 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
if (ggroup->fill_painter) {
nr_arena_render_paintserver_fill(pb, area, ggroup->fill_painter, SP_SCALE24_TO_FLOAT(style->fill_opacity.value), &m);
}
- } else if (style->fill.isColor() || item->arena->rendermode == RENDERMODE_OUTLINE) {
+ } else if (style->fill.isColor() || item->arena->rendermode == Inkscape::RENDERMODE_OUTLINE) {
guint32 rgba;
- if (item->arena->rendermode == RENDERMODE_OUTLINE) {
+ if (item->arena->rendermode == Inkscape::RENDERMODE_OUTLINE) {
// In outline mode, render fill only, using outlinecolor
rgba = item->arena->outlinecolor;
} else if ( item->render_opacity ) {
@@ -518,7 +518,7 @@ nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPi
}
/* Stroke */
- if (!style->stroke.isNone() && !(item->arena->rendermode == RENDERMODE_OUTLINE)) {
+ if (!style->stroke.isNone() && !(item->arena->rendermode == Inkscape::RENDERMODE_OUTLINE)) {
NRPixBlock m;
guint32 rgba;
nr_pixblock_setup_fast(&m, NR_PIXBLOCK_MODE_A8, area->x0, area->y0, area->x1, area->y1, TRUE);
index a2050f75cfa3cf4ccab1aa17d78a4fd2a9de9750..fa250e52eb208a8fa26527f7f6f4f28f76ae002c 100644 (file)
@@ -180,7 +180,7 @@ nr_arena_image_render( cairo_t *ct, NRArenaItem *item, NRRectL */*area*/, NRPixB
nr_arena_image_x_sample = prefs_get_int_attribute ("options.bitmapoversample", "value", 1);
nr_arena_image_y_sample = nr_arena_image_x_sample;
- bool outline = (item->arena->rendermode == RENDERMODE_OUTLINE);
+ bool outline = (item->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
NRArenaImage *image = NR_ARENA_IMAGE (item);
if (!image->px) return NULL;
- bool outline = (item->arena->rendermode == RENDERMODE_OUTLINE);
+ bool outline = (item->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
if (outline) {
index f04146f2065b5acf3775fd1834118091bb47e32d..195dba2f073c530a70c66f3220a291f48112ada1 100644 (file)
unsigned int state, unsigned int reset)
{
NRGC childgc (gc);
+ bool filter = (item->arena->rendermode == Inkscape::RENDERMODE_NORMAL);
nr_return_val_if_fail (item != NULL, NR_ARENA_ITEM_STATE_INVALID);
nr_return_val_if_fail (NR_IS_ARENA_ITEM (item),
if (item->state & NR_ARENA_ITEM_STATE_INVALID)
return item->state;
/* Enlarge the bounding box to contain filter effects */
- if (item->filter) {
+ if (item->filter && filter) {
item->filter->bbox_enlarge (item->bbox);
}
// fixme: to fix the display glitches, in outline mode bbox must be a combination of
nr_arena_item_invoke_render (cairo_t *ct, NRArenaItem *item, NRRectL const *area,
NRPixBlock *pb, unsigned int flags)
{
- bool outline = (item->arena->rendermode == RENDERMODE_OUTLINE);
+ bool outline = (item->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
+ bool filter = (item->arena->rendermode == Inkscape::RENDERMODE_NORMAL);
nr_return_val_if_fail (item != NULL, NR_ARENA_ITEM_STATE_INVALID);
nr_return_val_if_fail (NR_IS_ARENA_ITEM (item),
@@ -321,7 +323,7 @@ nr_arena_item_invoke_render (cairo_t *ct, NRArenaItem *item, NRRectL const *area
nr_rect_l_intersect (&carea, area, &item->bbox);
if (nr_rect_l_test_empty (&carea))
return item->state | NR_ARENA_ITEM_STATE_RENDER;
- if (item->filter && !outline) {
+ if (item->filter && filter) {
item->filter->area_enlarge (carea, item->ctm);
nr_rect_l_intersect (&carea, &carea, &item->bbox);
}
@@ -400,7 +402,7 @@ nr_arena_item_invoke_render (cairo_t *ct, NRArenaItem *item, NRRectL const *area
/* Determine, whether we need temporary buffer */
if (item->clip || item->mask
|| ((item->opacity != 255) && !item->render_opacity)
- || (item->filter) || item->background_new
+ || (item->filter && filter) || item->background_new
|| (item->parent && item->parent->background_pb)) {
/* Setup and render item buffer */
@@ -423,7 +425,7 @@ nr_arena_item_invoke_render (cairo_t *ct, NRArenaItem *item, NRRectL const *area
}
ipb.visible_area = pb->visible_area;
- if (item->filter) {
+ if (item->filter && filter) {
item->filter->area_enlarge (ipb.visible_area, item->ctm);
}
@@ -439,7 +441,7 @@ nr_arena_item_invoke_render (cairo_t *ct, NRArenaItem *item, NRRectL const *area
ipb.empty = FALSE;
/* Run filtering, if a filter is set for this object */
- if (item->filter) {
+ if (item->filter && filter) {
item->filter->render (item, &ipb);
}
index 8e53e7262abfc0fad20ac31fa51382d251d63a5e..5676b3ce6b11f8903fb1860aae62fd3f152db907 100644 (file)
@@ -273,7 +273,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
bbox.x0 = bbox.y0 = NR_HUGE;
bbox.x1 = bbox.y1 = -NR_HUGE;
- bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE);
+ bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
if (shape->curve) {
NRBPath bp;
float const scale = NR::expansion(gc->transform);
- bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE);
+ bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
if (outline) {
// cairo does not need the livarot path for rendering
if (!shape->curve) return item->state;
if (!shape->style) return item->state;
- bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE);
+ bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
if (outline) { // cairo outline rendering
@@ -1089,7 +1089,7 @@ nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int /
GTimeVal tstart, tfinish;
g_get_current_time (&tstart);
- bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE);
+ bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
double width;
if (outline) {
index f125cd0f89c7340975768690f9377727b88dae39..77701d249830464902664cc62cae224d3209a57e 100644 (file)
--- a/src/display/nr-arena.cpp
+++ b/src/display/nr-arena.cpp
nr_arena_init (NRArena *arena)
{
arena->delta = 0; // to be set by desktop from prefs
- arena->rendermode = RENDERMODE_NORMAL; // default is normal render
+ arena->rendermode = Inkscape::RENDERMODE_NORMAL; // default is normal render
arena->outlinecolor = 0xff; // black; to be set by desktop from bg color
arena->canvasarena = NULL;
}
diff --git a/src/display/nr-arena.h b/src/display/nr-arena.h
index b6d5a4539cdedf91cfeab115c3c3c78713c56a5a..1a042b355fa096c50cd853b76c3d961e925a6858 100644 (file)
--- a/src/display/nr-arena.h
+++ b/src/display/nr-arena.h
#include <glib/gmacros.h>
+#include "display/rendermode.h"
+
G_BEGIN_DECLS
typedef struct _SPCanvasArena SPCanvasArena;
void (* request_render) (NRArena *arena, NRRectL *area, void *data);
};
-enum {
- RENDERMODE_NORMAL,
- RENDERMODE_NOAA,
- RENDERMODE_OUTLINE
-};
-
struct NRArena : public NRActiveObject {
static NRArena *create() {
return reinterpret_cast<NRArena *>(nr_object_new(NR_TYPE_ARENA));
}
double delta;
- int rendermode;
+ Inkscape::RenderMode rendermode;
guint32 outlinecolor;
SPCanvasArena *canvasarena; // may be NULL is this arena is not the screen but used for export etc.
};
diff --git a/src/display/rendermode.h b/src/display/rendermode.h
--- /dev/null
+++ b/src/display/rendermode.h
@@ -0,0 +1,29 @@
+/*
+ * RenderMode enumeration.
+ *
+ * Trivially public domain.
+ */
+
+#ifndef SEEN_INKSCAPE_DISPLAY_RENDERMODE_H
+#define SEEN_INKSCAPE_DISPLAY_RENDERMODE_H
+
+namespace Inkscape {
+
+enum RenderMode {
+ RENDERMODE_NORMAL,
+ RENDERMODE_OUTLINE
+};
+
+}
+
+#endif
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
index 86b1e9eabbbb75580a0063238e705e55754a2aed..357d6ade7e0713d67c81a5fc1fe5222add7b3a29 100644 (file)
#if ENABLE_LCMS
#include "color-profile-fns.h"
#endif // ENABLE_LCMS
+#include "display/rendermode.h"
// Define this to visualize the regions to be redrawn
//#define DEBUG_REDRAW 1;
// If any part of it is dirtied, the entire tile is dirtied (its int is nonzero) and repainted.
#define TILE_SIZE 16
-enum {
- RENDERMODE_NORMAL,
- RENDERMODE_NOAA,
- RENDERMODE_OUTLINE
-};
-
static gint const sp_canvas_update_priority = G_PRIORITY_HIGH_IDLE;
#define SP_CANVAS_WINDOW(c) (((GtkWidget *) (c))->window)
@@ -1563,7 +1558,7 @@ sp_canvas_paint_single_buffer (SPCanvas *canvas, int x0, int y0, int x1, int y1,
GtkWidget *widget = GTK_WIDGET (canvas);
SPCanvasBuf buf;
- if (canvas->rendermode != RENDERMODE_OUTLINE) {
+ if (canvas->rendermode != Inkscape::RENDERMODE_OUTLINE) {
buf.buf = nr_pixelstore_256K_new (FALSE, 0);
} else {
buf.buf = nr_pixelstore_1M_new (FALSE, 0);
@@ -1655,7 +1650,7 @@ sp_canvas_paint_single_buffer (SPCanvas *canvas, int x0, int y0, int x1, int y1,
x0 - canvas->x0, y0 - canvas->y0);
}
- if (canvas->rendermode != RENDERMODE_OUTLINE) {
+ if (canvas->rendermode != Inkscape::RENDERMODE_OUTLINE) {
nr_pixelstore_256K_free (buf.buf);
} else {
nr_pixelstore_1M_free (buf.buf);
setup.mouse_loc = sp_canvas_window_to_world (canvas, NR::Point(x,y));
// CAIRO FIXME: the sw/sh calculations below all assume 24bpp, need fixing for 32bpp
- if (canvas->rendermode != RENDERMODE_OUTLINE) {
+ if (canvas->rendermode != Inkscape::RENDERMODE_OUTLINE) {
// use 256K as a compromise to not slow down gradients
// 256K is the cached buffer and we need 3 channels
setup.max_pixels = 87381; // 256K/3
index b8e01eb6c1a2e84ec765dc4edc6e63500f406940..997b9c86f38c804488f7073a1a01fbc966ae7e85 100644 (file)
: g_basename(uri) );
GString *name = g_string_new ("");
if (this->desktop->number > 1) {
- if (this->desktop->getMode() == RENDERMODE_OUTLINE) {
+ if (this->desktop->getMode() == Inkscape::RENDERMODE_OUTLINE) {
g_string_printf (name, _("%s: %d (outline) - Inkscape"), fname, this->desktop->number);
} else {
g_string_printf (name, _("%s: %d - Inkscape"), fname, this->desktop->number);
}
} else {
- if (this->desktop->getMode() == RENDERMODE_OUTLINE) {
+ if (this->desktop->getMode() == Inkscape::RENDERMODE_OUTLINE) {
g_string_printf (name, _("%s (outline) - Inkscape"), fname);
} else {
g_string_printf (name, _("%s - Inkscape"), fname);