[banshee/grid] [grid] Added QueueDirtyRegion methods to wrap QueueDraw
- From: Aaron Bockover <abock src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee/grid] [grid] Added QueueDirtyRegion methods to wrap QueueDraw
- Date: Fri, 22 Jan 2010 04:40:29 +0000 (UTC)
commit 2ef1433376c8fbe4a1105cd138095dc922815930
Author: Aaron Bockover <abockover novell com>
Date: Thu Jan 21 23:35:43 2010 -0500
[grid] 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/Libraries/Hyena.Gui/Hyena.Gui.csproj | 1 +
4 files changed, 49 insertions(+), 15 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
index a41e922..95c1e63 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
+++ b/src/Libraries/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/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
index 312e7ff..babb903 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
+++ b/src/Libraries/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/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
index 9497ef4..10f45cc 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
+++ b/src/Libraries/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/Libraries/Hyena.Gui/Hyena.Gui.csproj b/src/Libraries/Hyena.Gui/Hyena.Gui.csproj
index a8162bc..e34ce50 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Gui.csproj
+++ b/src/Libraries/Hyena.Gui/Hyena.Gui.csproj
@@ -176,6 +176,7 @@
<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]