Author: spouliot
Date: 2008-01-25 13:44:48 -0500 (Fri, 25 Jan 2008)
New Revision: 93942
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/geometry.h
trunk/moon/src/shape.cpp
Log:
2008-01-25 Sebastien Pouliot <[EMAIL PROTECTED]>
* shape.cpp: Merge UIElement::InsideClip inside Shape::InsideObject
instead of calling it since it can reduce some heavy cairo calls
(cairo_in_*), if there's a clip, otherwise it won't affect
performance.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2008-01-25 18:44:10 UTC (rev 93941)
+++ trunk/moon/src/ChangeLog 2008-01-25 18:44:48 UTC (rev 93942)
@@ -1,3 +1,10 @@
+2008-01-25 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * shape.cpp: Merge UIElement::InsideClip inside Shape::InsideObject
+ instead of calling it since it can reduce some heavy cairo calls
+ (cairo_in_*), if there's a clip, otherwise it won't affect
+ performance.
+
2008-01-25 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
* media.cpp: Initialize play_pending, and when buffering is
Modified: trunk/moon/src/geometry.h
===================================================================
--- trunk/moon/src/geometry.h 2008-01-25 18:44:10 UTC (rev 93941)
+++ trunk/moon/src/geometry.h 2008-01-25 18:44:48 UTC (rev 93942)
@@ -4,7 +4,7 @@
* Author:
* Sebastien Pouliot <[EMAIL PROTECTED]>
*
- * Copyright 2007 Novell, Inc. (http://www.novell.com)
+ * Copyright 2007-2008 Novell, Inc. (http://www.novell.com)
*
* See the LICENSE file included with the distribution for details.
*
@@ -27,22 +27,24 @@
//
class Geometry : public DependencyObject {
protected:
-/* enum GeometryFlags {
- GEOMETRY_NORMAL = 0x01, // normal drawing
- GEOMETRY_DEGENERATE = 0x02, // degenerate drawing, use the
Stroke brush for filling
- GEOMETRY_MASK = 0x02
+ enum GeometryFlags {
+ GEOMETRY_NORMAL = 0x01, // normal drawing
+ GEOMETRY_DEGENERATE = 0x02, // degenerate drawing, use the
Stroke brush for filling
+ GEOMETRY_NEEDS_FILL = 0x04, // filling, if specified, is
needed (e.g. LineGeometry doesn't need it)
+ GEOMETRY_NEEDS_CAPS = 0x08, // Stroke[Start|End]LineCap
+ GEOMETRY_NEEDS_JOIN = 0x10, // StrokeLineJoin,
StrokeMiterLimit
+ GEOMETRY_MASK = GEOMETRY_NORMAL | GEOMETRY_DEGENERATE
| GEOMETRY_NEEDS_FILL | GEOMETRY_NEEDS_CAPS | GEOMETRY_NEEDS_JOIN
};
+ bool IsDegenerate () { return (flags & Geometry::GEOMETRY_DEGENERATE);
};
+ void SetGeometryFlags (GeometryFlags sf) { flags &=
~Geometry::GEOMETRY_MASK; flags |= sf; };
int flags;
- bool IsDegenerate () { return (flags & Geometry::GEOMETRY_DEGENERATE);
};
- void SetGeometryFlags (GeometryFlags sf) { flags &=
~Geometry::GEOMETRY_MASK; flags |= sf; };
-*/
moon_path *path;
public:
static DependencyProperty* FillRuleProperty;
static DependencyProperty* TransformProperty;
- Geometry () : path (NULL) {};
+ Geometry () : flags (GEOMETRY_NORMAL), path (NULL) {};
virtual ~Geometry ();
virtual Type::Kind GetObjectType () { return Type::GEOMETRY; };
Modified: trunk/moon/src/shape.cpp
===================================================================
--- trunk/moon/src/shape.cpp 2008-01-25 18:44:10 UTC (rev 93941)
+++ trunk/moon/src/shape.cpp 2008-01-25 18:44:48 UTC (rev 93942)
@@ -386,22 +386,25 @@
bool
Shape::InsideObject (cairo_t *cr, double x, double y)
{
- if (!InsideClip (cr, x, y))
- return false;
+ cairo_save (cr);
+
+ Value* clip_geometry = GetValue (UIElement::ClipProperty);
+ if (clip_geometry) {
+ Geometry* clip = clip_geometry->AsGeometry ();
+ if (clip) {
+ clip->Draw (NULL, cr);
+ cairo_clip (cr);
+ }
+ }
- cairo_save (cr);
// don't do the operation but do consider filling
DoDraw (cr, false);
- double nx = x;
- double ny = y;
+ uielement_transform_point (this, &x ,&y);
- uielement_transform_point (this, &nx ,&ny);
+ // don't check in_stroke without a stroke or in_fill without a fill
(even if it can be filled)
+ bool ret = ((stroke && cairo_in_stroke (cr, x, y)) || (fill && CanFill
() && cairo_in_fill (cr, x, y)));
- // don't check in_stroke without a stroke or in_fill without a fill
(even if it can be filled)
- bool ret = ((stroke && cairo_in_stroke (cr, nx, ny)) || (fill &&
CanFill () && cairo_in_fill (cr, nx, ny)));
-
cairo_new_path (cr);
-
cairo_restore (cr);
return ret;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches