[hyena] Added QueueDirtyRegion methods to wrap QueueDraw
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] Added QueueDirtyRegion methods to wrap QueueDraw
- Date: Wed, 26 May 2010 02:39:28 +0000 (UTC)
commit 7e2eead395afe2b354da62bc191dc35799322870
Author: Aaron Bockover <abockover novell com>
Date: Thu Jan 21 23:35:43 2010 -0500
Added QueueDirtyRegion methods to wrap QueueDraw
QueueDraw and QueueDrawArea should not be called directly on the view.
QueueDirtyRegion will take care of this, and allows for slightly more
optimization and more control over debugging.
.../Hyena.Data.Gui/ListView/ListView_Header.cs | 4 +-
.../ListView/ListView_Interaction.cs | 25 +++++++++-----
.../Hyena.Data.Gui/ListView/ListView_Rendering.cs | 34 +++++++++++++++++--
src/Hyena.Gui/Hyena.Gui.csproj | 4 ++-
4 files changed, 51 insertions(+), 16 deletions(-)
---
diff --git a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
index a41e922..95c1e63 100644
--- a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
+++ b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
@@ -261,7 +261,7 @@ namespace Hyena.Data.Gui
InvalidateColumnCache ();
RegenerateColumnCache ();
UpdateAdjustments ();
- QueueDraw ();
+ QueueDirtyRegion ();
}
protected virtual void OnColumnLeftClicked (Column clickedColumn)
@@ -412,7 +412,7 @@ namespace Hyena.Data.Gui
resizing_column.Column.Width += resize_delta;
RegenerateColumnCache ();
- QueueDraw ();
+ QueueDirtyRegion ();
}
private Column GetColumnForResizeHandle (int x)
diff --git a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
index 312e7ff..babb903 100644
--- a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
+++ b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
@@ -308,8 +308,7 @@ namespace Hyena.Data.Gui
private void InvalidateLastIcell ()
{
if (last_icell != null && last_icell.PointerLeaveEvent ()) {
- QueueDrawArea (last_icell_area.X, last_icell_area.Y,
- last_icell_area.Width, last_icell_area.Height);
+ QueueDirtyRegion (last_icell_area);
last_icell = null;
last_icell_area = Gdk.Rectangle.Zero;
}
@@ -329,7 +328,7 @@ namespace Hyena.Data.Gui
}
if (redraw) {
- QueueDrawArea (icell_area.X, icell_area.Y, icell_area.Width, icell_area.Height);
+ QueueDirtyRegion (icell_area);
}
return;
@@ -341,16 +340,24 @@ namespace Hyena.Data.Gui
if (last_icell_area != icell_area) {
if (last_icell != null && last_icell.PointerLeaveEvent ()) {
- QueueDrawArea (last_icell_area.X - xoffset, last_icell_area.Y - yoffset,
- last_icell_area.Width, last_icell_area.Height);
+ QueueDirtyRegion (new Gdk.Rectangle () {
+ X = last_icell_area.X - xoffset,
+ Y = last_icell_area.Y - yoffset,
+ Width = last_icell_area.Width,
+ Height = last_icell_area.Height
+ });
}
last_icell = icell;
last_icell_area = icell_area;
}
if (redraw) {
- QueueDrawArea (icell_area.X - xoffset, icell_area.Y - yoffset,
- icell_area.Width, icell_area.Height);
+ QueueDirtyRegion (new Gdk.Rectangle () {
+ X = icell_area.X - xoffset,
+ Y = icell_area.Y - yoffset,
+ Width = icell_area.Width,
+ Height = icell_area.Height
+ });
}
}
@@ -734,7 +741,7 @@ namespace Hyena.Data.Gui
pressed_column_x_drag = x - pressed_column_x_offset - (pressed_column_x_start_hadjustment - HadjustmentValue);
- QueueDraw ();
+ QueueDirtyRegion ();
return true;
}
@@ -794,7 +801,7 @@ namespace Hyena.Data.Gui
pressed_column_is_dragging = false;
pressed_column_index = -1;
GdkWindow.Cursor = null;
- QueueDraw ();
+ QueueDirtyRegion ();
return true;
}
return false;
diff --git a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
index 9497ef4..10f45cc 100644
--- a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
+++ b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
@@ -90,12 +90,13 @@ namespace Hyena.Data.Gui
protected override bool OnExposeEvent (EventExpose evnt)
{
- Rectangle damage = new Rectangle ();
+ var damage = new Rectangle ();
foreach (Rectangle rect in evnt.Region.GetRectangles ()) {
damage = damage.Union (rect);
}
cairo_context = CairoHelper.Create (evnt.Window);
+
if (pango_layout == null) {
pango_layout = CairoExtensions.CreateLayout (this, cairo_context);
}
@@ -513,14 +514,14 @@ namespace Hyena.Data.Gui
protected void InvalidateList ()
{
if (IsRealized) {
- QueueDrawArea (list_rendering_alloc.X, list_rendering_alloc.Y, list_rendering_alloc.Width, list_rendering_alloc.Height);
+ QueueDirtyRegion (list_rendering_alloc);
}
}
private void InvalidateHeader ()
{
if (IsRealized) {
- QueueDrawArea (header_rendering_alloc.X, header_rendering_alloc.Y, header_rendering_alloc.Width, header_rendering_alloc.Height);
+ QueueDirtyRegion (header_rendering_alloc);
}
}
@@ -551,7 +552,7 @@ namespace Hyena.Data.Gui
{
measure_pending = true;
if (IsMapped && IsRealized) {
- QueueDraw ();
+ QueueDirtyRegion ();
}
}
@@ -577,5 +578,30 @@ namespace Hyena.Data.Gui
#endregion
+#region Invalidation
+
+ protected void QueueDirtyRegion (Gdk.Rectangle region)
+ {
+ region.Intersect (Allocation);
+ QueueDrawArea (region.X, region.Y, region.Width, region.Height);
+ }
+
+ protected void QueueDirtyRegion (Cairo.Rectangle region)
+ {
+ QueueDirtyRegion (new Gdk.Rectangle () {
+ X = (int)Math.Floor (region.X),
+ Y = (int)Math.Floor (region.Y),
+ Width = (int)Math.Ceiling (region.Width),
+ Height = (int)Math.Ceiling (region.Height)
+ });
+ }
+
+ protected void QueueDirtyRegion ()
+ {
+ QueueDirtyRegion (list_rendering_alloc);
+ }
+
+#endregion
+
}
}
diff --git a/src/Hyena.Gui/Hyena.Gui.csproj b/src/Hyena.Gui/Hyena.Gui.csproj
index 65a4e5a..061b7f6 100644
--- a/src/Hyena.Gui/Hyena.Gui.csproj
+++ b/src/Hyena.Gui/Hyena.Gui.csproj
@@ -78,7 +78,6 @@
<Compile Include="Hyena.Gui\GtkUtilities.cs" />
<Compile Include="Hyena.Data.Gui\CellContext.cs" />
<Compile Include="Hyena.Data.Gui\IHeaderCell.cs" />
- <Compile Include="Hyena.Data.Gui\DataViewLayoutStyle.cs" />
<Compile Include="Hyena.Widgets\ScrolledWindow.cs" />
<Compile Include="Hyena.Widgets\RoundedFrame.cs" />
<Compile Include="Hyena.Gui.Theatrics\Actor.cs" />
@@ -156,6 +155,9 @@
<Compile Include="Hyena.Widgets\EntryPopup.cs" />
<Compile Include="Hyena.Widgets\SimpleTable.cs" />
<Compile Include="Hyena.Gui\PangoExtensions.cs" />
+ <Compile Include="Hyena.Data.Gui\DataViewLayout.cs" />
+ <Compile Include="Hyena.Data.Gui\DataViewLayoutGrid.cs" />
+ <Compile Include="Hyena.Gui\CairoDamageDebugger.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]