summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e37ac57)
raw | patch | inline | side by side (parent: e37ac57)
author | joncruz <joncruz@users.sourceforge.net> | |
Sun, 3 Aug 2008 07:37:06 +0000 (07:37 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Sun, 3 Aug 2008 07:37:06 +0000 (07:37 +0000) |
index c52404b23266988cacc1b2e0482865f2d6c136a9..d4a9f7062b71572ea11777b34d2f4a28c957c8dd 100644 (file)
cairo_t *
nr_create_cairo_context_for_data (NRRectL *area, NRRectL *buf_area, unsigned char *px, unsigned int rowstride)
{
- if (!nr_rect_l_test_intersect (buf_area, area))
+ if (!nr_rect_l_test_intersect_ptr(buf_area, area))
return NULL;
NRRectL clip;
index 0fbc068a12a1196eed534ff4dec045fc62a02187..a1a14ef1a8583cc6decf783cbd44ff35e86a7594 100644 (file)
@@ -211,7 +211,7 @@ nr_arena_glyphs_update(NRArenaItem *item, NRRectL */*area*/, NRGC *gc, guint /*s
bbox.y1 = narea.y1 + glyphs->y;
}
}
- if (nr_rect_d_test_empty(&bbox)) return NR_ARENA_ITEM_STATE_ALL;
+ if (nr_rect_d_test_empty(bbox)) return NR_ARENA_ITEM_STATE_ALL;
item->bbox.x0 = (gint32)(bbox.x0 - 1.0);
item->bbox.y0 = (gint32)(bbox.y0 - 1.0);
NRArenaItem *item = NR_ARENA_ITEM(glyphs);
- if (glyphs->rfont && nr_rect_l_test_intersect(area, &item->bbox)) {
+ if (glyphs->rfont && nr_rect_l_test_intersect_ptr(area, &item->bbox)) {
raster_glyph *g = glyphs->rfont->GetGlyph(glyphs->glyph);
if ( g ) g->Blit(NR::Point(glyphs->x, glyphs->y), *m);
}
nr_arena_glyphs_stroke_mask(NRArenaGlyphs *glyphs, NRRectL *area, NRPixBlock *m)
{
NRArenaItem *item = NR_ARENA_ITEM(glyphs);
- if (glyphs->sfont && nr_rect_l_test_intersect(area, &item->bbox)) {
+ if (glyphs->sfont && nr_rect_l_test_intersect_ptr(area, &item->bbox)) {
raster_glyph *g=glyphs->sfont->GetGlyph(glyphs->glyph);
if ( g ) g->Blit(NR::Point(glyphs->x, glyphs->y),*m);
}
index 195dba2f073c530a70c66f3220a291f48112ada1..a6a04bb8b2c42993477e24ee754246b6c8ee8de2 100644 (file)
return item->state;
/* Test whether to return immediately */
if (area && (item->state & NR_ARENA_ITEM_STATE_BBOX)) {
- if (!nr_rect_l_test_intersect (area, &item->bbox))
+ if (!nr_rect_l_test_intersect_ptr(area, &item->bbox))
return item->state;
}
@@ -321,7 +321,7 @@ nr_arena_item_invoke_render (cairo_t *ct, NRArenaItem *item, NRRectL const *area
NRRectL carea;
nr_rect_l_intersect (&carea, area, &item->bbox);
- if (nr_rect_l_test_empty (&carea))
+ if (nr_rect_l_test_empty(carea))
return item->state | NR_ARENA_ITEM_STATE_RENDER;
if (item->filter && filter) {
item->filter->area_enlarge (carea, item->ctm);
(&item->bbox)->y0, (&item->bbox)->x1, (&item->bbox)->y1);
#endif
- if (item->visible && nr_rect_l_test_intersect (area, &item->bbox)) {
+ if (item->visible && nr_rect_l_test_intersect_ptr(area, &item->bbox)) {
/* Need render that item */
if (((NRArenaItemClass *) NR_OBJECT_GET_CLASS (item))->clip) {
return ((NRArenaItemClass *) NR_OBJECT_GET_CLASS (item))->
index b8723e6350af573cc9efdb0ce9787eb8cd13fd3f..325681650e17a36b868230b70a7958b4cddc804c 100644 (file)
@@ -299,7 +299,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
shape->approx_bbox.y0 = (gint32)(boundingbox[1][0] - 1.0F);
shape->approx_bbox.x1 = (gint32)(boundingbox[0][1] + 1.9999F);
shape->approx_bbox.y1 = (gint32)(boundingbox[1][1] + 1.9999F);
- if ( area && nr_rect_l_test_intersect(area, &shape->approx_bbox) ) shape->delayed_shp=false;
+ if ( area && nr_rect_l_test_intersect_ptr(area, &shape->approx_bbox) ) shape->delayed_shp=false;
/* Release state data */
if (TRUE || !NR::transform_equalp(gc->transform, shape->ctm, NR_EPSILON)) {
} else {
if ( shape->delayed_shp ) {
- if ( nr_rect_l_test_intersect(area, &item->bbox) ) {
+ if ( nr_rect_l_test_intersect_ptr(area, &item->bbox) ) {
NRGC tempGC(NULL);
tempGC.transform=shape->ctm;
shape->delayed_shp = false;
if (!shape->curve) return item->state;
if ( shape->delayed_shp || shape->fill_shp == NULL) { // we need a fill shape no matter what
- if ( nr_rect_l_test_intersect(area, &item->bbox) ) {
+ if ( nr_rect_l_test_intersect_ptr(area, &item->bbox) ) {
NRGC tempGC(NULL);
tempGC.transform=shape->ctm;
shape->delayed_shp = false;
index 77701d249830464902664cc62cae224d3209a57e..ce13072b9c16f669575fa90cab4d6c9c245e5eb5 100644 (file)
--- a/src/display/nr-arena.cpp
+++ b/src/display/nr-arena.cpp
nr_return_if_fail (NR_IS_ARENA (arena));
nr_return_if_fail (area != NULL);
- if (aobject->callbacks && area && !nr_rect_l_test_empty (area)) {
+ if (aobject->callbacks && area && !nr_rect_l_test_empty_ptr(area)) {
for (unsigned int i = 0; i < aobject->callbacks->length; i++) {
NRObjectListener *listener = aobject->callbacks->listeners + i;
NRArenaEventVector *avector = (NRArenaEventVector *) listener->vector;
diff --git a/src/libnr/nr-blit.cpp b/src/libnr/nr-blit.cpp
index b25f0e2a77149a646023297dd3f16e3f5f9b96ce..144caa597a826bd17973394994105cec3f2469d5 100644 (file)
--- a/src/libnr/nr-blit.cpp
+++ b/src/libnr/nr-blit.cpp
nr_rect_l_intersect (&clip, &d->area, &s->area);
- if (nr_rect_l_test_empty (&clip)) return;
+ if (nr_rect_l_test_empty(clip)) return;
/* Pointers */
dbpp = NR_PIXBLOCK_BPP (d);
nr_rect_l_intersect (&clip, &d->area, &s->area);
nr_rect_l_intersect (&clip, &clip, &m->area);
- if (nr_rect_l_test_empty (&clip)) return;
+ if (nr_rect_l_test_empty(clip)) return;
/* Pointers */
dbpp = NR_PIXBLOCK_BPP (d);
if (m->mode != NR_PIXBLOCK_MODE_A8) return;
- if (!nr_rect_l_test_intersect (&d->area, &m->area)) return;
+ if (!nr_rect_l_test_intersect(d->area, m->area)) return;
nr_rect_l_intersect (&clip, &d->area, &m->area);
diff --git a/src/libnr/nr-macros.h b/src/libnr/nr-macros.h
index e0d3dabfbbec3143d56fdef9f2efc78f342da407..0e0307916faa87b6be5ed6ca392b0d27d5ac1c4c 100644 (file)
--- a/src/libnr/nr-macros.h
+++ b/src/libnr/nr-macros.h
// Todo: move these into nr-matrix.h
#define NR_RECT_DFLS_TEST_EMPTY(a) (((a)->x0 >= (a)->x1) || ((a)->y0 >= (a)->y1))
+#define NR_RECT_DFLS_TEST_EMPTY_REF(a) (((a).x0 >= (a).x1) || ((a).y0 >= (a).y1))
#define NR_RECT_DFLS_TEST_INTERSECT(a,b) (((a)->x0 < (b)->x1) && ((a)->x1 > (b)->x0) && ((a)->y0 < (b)->y1) && ((a)->y1 > (b)->y0))
+#define NR_RECT_DFLS_TEST_INTERSECT_REF(a,b) (((a).x0 < (b).x1) && ((a).x1 > (b).x0) && ((a).y0 < (b).y1) && ((a).y1 > (b).y0))
#define NR_RECT_DF_POINT_DF_TEST_INSIDE(r,p) (((p)->x >= (r)->x0) && ((p)->x < (r)->x1) && ((p)->y >= (r)->y0) && ((p)->y < (r)->y1))
#define NR_RECT_LS_POINT_LS_TEST_INSIDE(r,p) (((p)->x >= (r)->x0) && ((p)->x < (r)->x1) && ((p)->y >= (r)->y0) && ((p)->y < (r)->y1))
#define NR_RECT_LS_TEST_INSIDE(r,x,y) ((x >= (r)->x0) && (x < (r)->x1) && (y >= (r)->y0) && (y < (r)->y1))
index 77178658420133d515a6b2941a879d607e069d33..aa32462972efdf9ea01840a16f35d128795378a8 100644 (file)
if (mask) {
if (mask->empty) return;
nr_rect_l_intersect (&clip, &pb->area, &mask->area);
- if (nr_rect_l_test_empty (&clip)) return;
+ if (nr_rect_l_test_empty(clip)) return;
} else {
clip = pb->area;
}
index 3b00acd0392123ea8056622c2c8c7bbf409e5721..fa3c687c539d534ffba8093f00d1aa61f90873bc 100644 (file)
--- a/src/libnr/nr-rect-l.cpp
+++ b/src/libnr/nr-rect-l.cpp
#include <libnr/nr-rect-l.h>
NR::Maybe<NR::Rect> NRRectL::upgrade() const {
- if (nr_rect_l_test_empty(this)) {
+ if (nr_rect_l_test_empty_ptr(this)) {
return NR::Nothing();
} else {
return NR::Rect(NR::Point(x0, y0), NR::Point(x1, y1));
diff --git a/src/libnr/nr-rect.cpp b/src/libnr/nr-rect.cpp
index a1c8c93b204fb375b833456ab019cc82dfe73f4d..04d93ae043f08d26c7a1c6f411d69af69198cca1 100644 (file)
--- a/src/libnr/nr-rect.cpp
+++ b/src/libnr/nr-rect.cpp
}
NR::Maybe<NR::Rect> NRRect::upgrade() const {
- if (nr_rect_d_test_empty(this)) {
+ if (nr_rect_d_test_empty_ptr(this)) {
return NR::Nothing();
} else {
return NR::Rect(NR::Point(x0, y0), NR::Point(x1, y1));
@@ -204,7 +204,7 @@ nr_rect_d_matrix_transform(NRRect *d, NRRect const *const s, NR::Matrix const &m
using NR::X;
using NR::Y;
- if (nr_rect_d_test_empty(s)) {
+ if (nr_rect_d_test_empty_ptr(s)) {
nr_rect_d_set_empty(d);
} else {
NR::Point const c00(NR::Point(s->x0, s->y0) * m);
diff --git a/src/libnr/nr-rect.h b/src/libnr/nr-rect.h
index c61083b4b975eb1b98242534211995ee16aa60b1..da1299b2bba61ad406262d3207b8498484f57e6e 100644 (file)
--- a/src/libnr/nr-rect.h
+++ b/src/libnr/nr-rect.h
#define nr_rect_l_set_empty(r) (*(r) = NR_RECT_L_EMPTY)
/** "Empty" here includes the case of zero width or zero height. */
-#define nr_rect_d_test_empty(r) ((r) && NR_RECT_DFLS_TEST_EMPTY(r))
-#define nr_rect_l_test_empty(r) ((r) && NR_RECT_DFLS_TEST_EMPTY(r))
+// TODO convert to static overloaded functions (pointer and ref) once performance can be tested:
+#define nr_rect_d_test_empty_ptr(r) ((r) && NR_RECT_DFLS_TEST_EMPTY(r))
+#define nr_rect_d_test_empty(r) NR_RECT_DFLS_TEST_EMPTY_REF(r)
+
+// TODO convert to static overloaded functions (pointer and ref) once performance can be tested:
+#define nr_rect_l_test_empty_ptr(r) ((r) && NR_RECT_DFLS_TEST_EMPTY(r))
+#define nr_rect_l_test_empty(r) NR_RECT_DFLS_TEST_EMPTY_REF(r)
#define nr_rect_d_test_intersect(r0,r1) \
(!nr_rect_d_test_empty(r0) && !nr_rect_d_test_empty(r1) && \
!((r0) && (r1) && !NR_RECT_DFLS_TEST_INTERSECT(r0, r1)))
+
+// TODO convert to static overloaded functions (pointer and ref) once performance can be tested:
+#define nr_rect_l_test_intersect_ptr(r0,r1) \
+ (!nr_rect_l_test_empty_ptr(r0) && !nr_rect_l_test_empty_ptr(r1) && \
+ !((r0) && (r1) && !NR_RECT_DFLS_TEST_INTERSECT(r0, r1)))
#define nr_rect_l_test_intersect(r0,r1) \
(!nr_rect_l_test_empty(r0) && !nr_rect_l_test_empty(r1) && \
- !((r0) && (r1) && !NR_RECT_DFLS_TEST_INTERSECT(r0, r1)))
+ !(!NR_RECT_DFLS_TEST_INTERSECT_REF(r0, r1)))
#define nr_rect_d_point_d_test_inside(r,p) ((p) && (!(r) || (!NR_RECT_DF_TEST_EMPTY(r) && NR_RECT_DF_POINT_DF_TEST_INSIDE(r,p))))
#define nr_rect_l_point_l_test_inside(r,p) ((p) && (!(r) || (!NR_RECT_DFLS_TEST_EMPTY(r) && NR_RECT_LS_POINT_LS_TEST_INSIDE(r,p))))