Author: spouliot
Date: 2007-08-30 10:14:06 -0400 (Thu, 30 Aug 2007)
New Revision: 85052
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/shape.cpp
Log:
2007-08-30 Sebastien Pouliot <[EMAIL PROTECTED]>
* shape.cpp: Handle negative values for Height and Width (not
drawn) and for Radius[X|Y] (absolute values).
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-08-30 14:01:20 UTC (rev 85051)
+++ trunk/moon/src/ChangeLog 2007-08-30 14:14:06 UTC (rev 85052)
@@ -1,3 +1,8 @@
+2007-08-30 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * shape.cpp: Handle negative values for Height and Width (not
+ drawn) and for Radius[X|Y] (absolute values).
+
2007-08-30 Jb Evain <[EMAIL PROTECTED]>
* media.h, media.cpp: introduce a new MediaSource class that a
Modified: trunk/moon/src/shape.cpp
===================================================================
--- trunk/moon/src/shape.cpp 2007-08-30 14:01:20 UTC (rev 85051)
+++ trunk/moon/src/shape.cpp 2007-08-30 14:14:06 UTC (rev 85052)
@@ -113,6 +113,11 @@
void
moon_rounded_rectangle (cairo_t *cr, double x, double y, double w, double h,
double radius_x, double radius_y)
{
+ if (radius_x < 0.0)
+ radius_x = -radius_x;
+ if (radius_y < 0.0)
+ radius_y = -radius_y;
+
// test limits (without using multiplications)
if (radius_x > w - radius_x)
radius_x = w / 2;
@@ -324,6 +329,9 @@
double w = framework_element_get_width (this);
double h = framework_element_get_height (this);
+ if ((w < 0.0) || (h < 0.0))
+ return;
+
switch (stretch) {
case StretchUniform:
w = h = (w < h) ? w : h;
@@ -674,6 +682,11 @@
double w = framework_element_get_width (this);
double h = framework_element_get_height (this);
+ if ((w < 0.0) || (h < 0.0)) {
+ SetShapeFlags (UIElement::SHAPE_EMPTY);
+ return;
+ }
+
double t = shape_get_stroke_thickness (this);
double t2 = t * 2.0;
@@ -793,6 +806,11 @@
w = width->AsDouble ();
h = height->AsDouble ();
+ if ((w < 0.0) || (h < 0.0)) {
+ SetShapeFlags (UIElement::SHAPE_EMPTY);
+ return;
+ }
+
// there are two kinds of degenerations
// (a) the thickness is larger (or equal) to the width or height
if ((t > w) || (t > h)) {
@@ -1308,6 +1326,13 @@
return;
}
+ double w = framework_element_get_width (this);
+ double h = framework_element_get_height (this);
+ if ((w < 0.0) || (h < 0.0)) {
+ SetShapeFlags (UIElement::SHAPE_EMPTY);
+ return;
+ }
+
SetShapeFlags (UIElement::SHAPE_NORMAL);
geometry->Draw (this, cr);
@@ -1373,8 +1398,8 @@
Value *vh = GetValueNoDefault (FrameworkElement::HeightProperty);
Value *vw = GetValueNoDefault (FrameworkElement::WidthProperty);
- double sh = vh ? (vh->AsDouble () / actual_height) : 1.0;
- double sw = vw ? (vw->AsDouble () / actual_width) : 1.0;
+ double sh = vh ? (h / actual_height) : 1.0;
+ double sw = vw ? (w / actual_width) : 1.0;
switch (stretch) {
case StretchFill:
break;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches