<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<Optimize>false</Optimize>
<OutputPath>$(SolutionDir)build\Debug</OutputPath>
- <DefineConstants>TRACE0;DEBUG;DEBUG_BINDING_FUNC_CALLS0;DEBUG_DRAGNDROP0;DEBUG_LOG0;XLIB_BACKEND0;DESIGN_MODE;DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_DISPOSE0;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
+ <DefineConstants>TRACE0;DEBUG;DEBUG_BINDING_FUNC_CALLS0;DEBUG_DRAGNDROP0;DEBUG_LOG0;XLIB_BACKEND0;DESIGN_MODE;DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_DISPOSE0;MEASURE_TIME0;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
<EnvironmentVariables>
<EnvironmentVariables>
<Variable name="MONO_CAIRO_DEBUG_DISPOSE" value="1" />
Height = "Fit";
Width = "Fit";
Margin = "1";
+ CacheEnabled = "false";
}
Menu {
Margin = "1";
widthRatio = heightRatio;
}
- gr.Save ();
+ Matrix savedMat = gr.Matrix;
gr.Translate (rect.Left,rect.Top);
gr.Scale (widthRatio, heightRatio);
gr.Translate ((rect.Width/widthRatio - Dimensions.Width)/2, (rect.Height/heightRatio - Dimensions.Height)/2);
gr.SetSourceSurface (imgSurface, 0,0);
gr.Paint ();
- gr.Restore ();
+
+ gr.Matrix = savedMat;
}
}
}
DrawRoundedRectangle(gr, r.X, r.Y, r.Width, r.Height, radius);
}
public static void DrawRoundedRectangle(Context gr, double x, double y, double width, double height, double radius)
- {
- gr.Save();
-
+ {
if ((radius > height / 2) || (radius > width / 2))
radius = min(height / 2, width / 2);
gr.Arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
gr.ClosePath();
- gr.Restore();
}
public static void StrokeRaisedRectangle(Context gr, Rectangle r, double width = 1)
- {
- gr.Save();
+ {
r.Inflate((int)-width / 2, (int)-width / 2);
gr.LineWidth = width;
gr.SetSourceColor(Color.White);
gr.LineTo(r.BottomRight);
gr.LineTo(r.BottomLeft);
gr.Stroke();
-
- gr.Restore();
}
public static void StrokeLoweredRectangle(Context gr, Rectangle r, double width = 1)
{
- gr.Save();
r.Inflate((int)-width / 2, (int)-width / 2);
gr.LineWidth = width;
gr.SetSourceColor(Color.DarkGrey);
gr.LineTo(r.BottomRight);
gr.LineTo(r.BottomLeft);
gr.Stroke();
-
- gr.Restore();
}
}
}
/// If enabled, resulting bitmap of graphic object is cached
/// speeding up rendering of complex object. Default is enabled.
/// </summary>
- [DesignCategory ("Behavior")][DefaultValue(false)]
+ [DesignCategory ("Behavior")][DefaultValue(true)]
public virtual bool CacheEnabled {
get { return cacheEnabled; }
set {
Rectangle rBack = new Rectangle (Slot.Size);
- background.SetAsSource (gr, rBack);
- DrawingHelpers.CairoRectangle (gr, rBack, cornerRadius);
- gr.Fill ();
+ //if (background != Color.Transparent) {
+ background.SetAsSource (gr, rBack);
+ DrawingHelpers.CairoRectangle (gr, rBack, cornerRadius);
+ gr.Fill ();
+ //}
#if DEBUG_LOG
dbgEvt.end = DebugLog.chrono.ElapsedTicks;
paintDisabled (ctx, Slot + Parent.ClientRectangle.Position);
} else {
Rectangle rb = Slot + Parent.ClientRectangle.Position;
- ctx.Save ();
+ //ctx.Save ();
ctx.Translate (rb.X, rb.Y);
if (!isEnabled)
paintDisabled (ctx, Slot);
- ctx.Restore ();
+ ctx.Translate (-rb.X, -rb.Y);
+ //ctx.Restore ();
}
LastPaintedSlot = Slot;
}
ProcessEvents ();
#if MEASURE_TIME
- if (frameCount++ < 1000)
+ if (frameCount++ < 100)
continue;
for (int i = 0; i < PerfMeasures.Count; i++) {
PerfMeasures [i].NotifyChanges ();
if (DragImage != null)
clipping.AddRectangle(new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight));
- using (ctx = new Context (surf)) {
- if (!clipping.IsEmpty) {
- IsDirty = true;
+ lock (RenderMutex) {
+ using (ctx = new Context (surf)) {
+ if (!clipping.IsEmpty) {
+ IsDirty = true;
- clipping.clearAndClip (ctx);
+ clipping.clearAndClip (ctx);
- for (int i = GraphicTree.Count - 1; i >= 0; i--) {
- Widget p = GraphicTree[i];
- if (!p.Visible)
- continue;
- if (!clipping.intersect (p.Slot))
- continue;
+ for (int i = GraphicTree.Count - 1; i >= 0; i--) {
+ Widget p = GraphicTree[i];
+ if (!p.Visible)
+ continue;
+ if (!clipping.intersect (p.Slot))
+ continue;
- ctx.Save ();
- p.Paint (ref ctx);
- ctx.Restore ();
- }
+ //ctx.Save ();
+ p.Paint (ref ctx);
+ //ctx.Restore ();
+ }
- //if (DragAndDropOperation != null) {
- // if (DragImage != null) {
- // DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
- // DragImageX = Mouse.X - DragImageWidth / 2;
- // DragImageY = Mouse.Y - DragImageHeight / 2;
- // ctx.Save ();
- // ctx.ResetClip ();
- // ctx.SetSourceSurface (DragImage, DragImageX, DragImageY);
- // ctx.PaintWithAlpha (0.8);
- // ctx.Restore ();
- // DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
- // IsDirty = true;
- // //Console.WriteLine ("dragimage drawn: {0},{1}", DragImageX, DragImageY);
- // }
- //}
+ //if (DragAndDropOperation != null) {
+ // if (DragImage != null) {
+ // DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
+ // DragImageX = Mouse.X - DragImageWidth / 2;
+ // DragImageY = Mouse.Y - DragImageHeight / 2;
+ // ctx.Save ();
+ // ctx.ResetClip ();
+ // ctx.SetSourceSurface (DragImage, DragImageX, DragImageY);
+ // ctx.PaintWithAlpha (0.8);
+ // ctx.Restore ();
+ // DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
+ // IsDirty = true;
+ // //Console.WriteLine ("dragimage drawn: {0},{1}", DragImageX, DragImageY);
+ // }
+ //}
#if DEBUG_CLIP_RECTANGLE
clippingStrokeColor.R += 0.1f;
clipping.stroke (ctx, clippingStrokeColor);
ctx.Stroke ();
#endif
- //clipping.stroke (ctx, new Color (1, 0, 0));
- clipping.Reset ();
- //}
- //surf.WriteToPng (@"/mnt/data/test.png");
-
+ //clipping.stroke (ctx, new Color (1, 0, 0));
+ clipping.Reset ();
+ //}
+ //surf.WriteToPng (@"/mnt/data/test.png");
+
+ }
}
}
-
/*#if DEBUG_LOG
DebugLog.AddEvent (DbgEvtType.IFaceEndDrawing);
#endif*/
}
void computeStats(){
- current = timer.ElapsedTicks;
+ current = timer.ElapsedMilliseconds;
if (current < cancelLimit)
return;
cptMeasures++;
- total += timer.ElapsedTicks;
- if (timer.ElapsedTicks < minimum)
- minimum = timer.ElapsedTicks;
- if (timer.ElapsedTicks > maximum)
- maximum = timer.ElapsedTicks;
+ total += timer.ElapsedMilliseconds;
+ if (timer.ElapsedMilliseconds < minimum)
+ minimum = timer.ElapsedMilliseconds;
+ if (timer.ElapsedMilliseconds > maximum)
+ maximum = timer.ElapsedMilliseconds;
}
void ResetStats(){
cptMeasures = total = current = maximum = 0;
NativeMethods.vkvg_text_extents (handle, TerminateUtf8(s), out extents);
return extents;
}
+ public Matrix Matrix {
+ get {
+ Matrix m;
+ NativeMethods.vkvg_get_matrix (handle, out m);
+ return m;
+ }
+ set {
+ NativeMethods.vkvg_set_matrix (handle, ref value);
+ }
+ }
public void ShowText (string txt) {
NativeMethods.vkvg_show_text (handle, txt);
}
public void Clear () {
NativeMethods.vkvg_clear (handle);
}
-
public void Paint () {
NativeMethods.vkvg_paint (handle);
}
<?xml version="1.0"?>
<Window Focusable="true" Caption="Measures" Width="30%" Height="300" MinimumSize="100,100">
<ListBox Data="{PerfMeasures}"
- ItemTemplate="#Tests.Interfaces.perfMsr.crow"/>
+ ItemTemplate="#ui.perfMsr.crow"/>
</Window>