From b4e2719fa215ec1f2ed4fd1ab57977096538adc4 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 15 Nov 2005 12:24:02 +0000 Subject: Check whether area is being painted against the update region, not just the bounding box of this region. This ensures that a need to abandon a paint when a restyle affects text outside the area being painted. --- gtk/ScintillaGTK.cxx | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'gtk') diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index b3c9b8bd4..c6b0fbf3e 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -129,6 +129,8 @@ class ScintillaGTK : public ScintillaBase { gint lastWheelMouseDirection; gint wheelMouseIntensity; + GdkRegion *rgnUpdate; + // Private so ScintillaGTK objects can not be copied ScintillaGTK(const ScintillaGTK &) : ScintillaBase() {} ScintillaGTK &operator=(const ScintillaGTK &) { return * this; } @@ -153,6 +155,7 @@ private: virtual bool SetIdle(bool on); virtual void SetMouseCapture(bool on); virtual bool HaveMouseCapture(); + virtual bool PaintContains(PRectangle rc); void FullPaint(); virtual PRectangle GetClientRectangle(); void SyncPaint(PRectangle rc); @@ -317,7 +320,8 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) : #endif #endif lastWheelMouseDirection(0), - wheelMouseIntensity(0) { + wheelMouseIntensity(0), + rgnUpdate(0) { sci = sci_; wMain = GTK_WIDGET(sci); @@ -947,6 +951,22 @@ bool ScintillaGTK::HaveMouseCapture() { return capturedMouse; } +bool ScintillaGTK::PaintContains(PRectangle rc) { + bool contains = true; + if (paintState == painting) { + if (!rcPaint.Contains(rc)) { + contains = false; + } else if (rgnUpdate) { + GdkRectangle grc = {rc.left, rc.top, + rc.right - rc.left, rc.bottom - rc.top}; + if (gdk_region_rect_in(rgnUpdate, &grc) != GDK_OVERLAP_RECTANGLE_IN) { + contains = false; + } + } + } + return contains; +} + // Redraw all of text area. This paint will not be abandoned. void ScintillaGTK::FullPaint() { #if GTK_MAJOR_VERSION < 2 @@ -2152,6 +2172,10 @@ gint ScintillaGTK::ExposeTextThis(GtkWidget * /*widget*/, GdkEventExpose *ose) { rcPaint.right = ose->area.x + ose->area.width; rcPaint.bottom = ose->area.y + ose->area.height; + PLATFORM_ASSERT(rgnUpdate == NULL); +#if GTK_MAJOR_VERSION >= 2 + rgnUpdate = gdk_region_copy(ose->region); +#endif PRectangle rcClient = GetClientRectangle(); paintingAllText = rcPaint.Contains(rcClient); Surface *surfaceWindow = Surface::Allocate(); @@ -2166,6 +2190,12 @@ gint ScintillaGTK::ExposeTextThis(GtkWidget * /*widget*/, GdkEventExpose *ose) { FullPaint(); } paintState = notPainting; + + if (rgnUpdate) { + g_free(rgnUpdate); + } + rgnUpdate = 0; + return FALSE; } -- cgit v1.2.3