[maemo-commits] [maemo-commits] r19174 - in projects/haf/trunk/clutter0.8: clutter debian
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri Aug 21 14:48:43 EEST 2009
- Previous message: [maemo-commits] r19173 - in projects/haf/trunk/gtk+: . gtk
- Next message: [maemo-commits] r19175 - projects/haf/trunk/sapwood/server
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: gw
Date: 2009-08-21 14:48:19 +0300 (Fri, 21 Aug 2009)
New Revision: 19174
Modified:
projects/haf/trunk/clutter0.8/clutter/clutter-main.c
projects/haf/trunk/clutter0.8/clutter/clutter-stage.c
projects/haf/trunk/clutter0.8/debian/changelog
Log:
Fixes: NB#134034 - Blue screen observed in various scenarios
Also allows single-buffering to work passably and
* clutter/clutter-main.c: set DOUBLE_BUFFER=0 as we don't need to write to
such a large area while eglSwapBuffers uses blitting rather than flipping.
Do picking by restricting drawing to just a single pixel, which we replace
with the old color afterwards (previously we would write to the entire
screen, and then set the whole area as 'damaged').
* clutter/clutter-stage.c: Now don't set the whole screen areas as damaged
Modified: projects/haf/trunk/clutter0.8/clutter/clutter-main.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/clutter-main.c 2009-08-21 11:09:48 UTC (rev 19173)
+++ projects/haf/trunk/clutter0.8/clutter/clutter-main.c 2009-08-21 11:48:19 UTC (rev 19174)
@@ -383,8 +383,11 @@
ClutterMainContext *context;
guchar pixel[4];
GLint viewport[4];
+ gint inv_y;
ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
+ ClutterColor previous_color;
guint32 id;
+ ClutterGeometry damaged_area;
context = clutter_context_get_default ();
@@ -393,11 +396,40 @@
/* needed for when a context switch happens */
_clutter_stage_maybe_setup_viewport (stage);
- cogl_paint_init (&white);
+ /* Get ready for drawing, don't clear the whole screen here
+ * as we want to render just to a small area */
+ cogl_paint_init (0);
+ /* Calls should work under both GL and GLES, note GLES needs RGBA */
+ glGetIntegerv(GL_VIEWPORT, viewport);
+
+ /* Work out where we need to read from - it is actually inverted
+ * compared to everything else we render */
+ inv_y = viewport[3] - y -1;
+
+ /* Read the color of the pixel we're about to overwrite*/
+ glReadPixels (x, inv_y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
+ (guchar*)&previous_color);
+
/* Disable dithering (if any) when doing the painting in pick mode */
glDisable (GL_DITHER);
+ /* Clip down to just a small area around the click */
+ damaged_area.x = x;
+ damaged_area.y = y;
+ damaged_area.width = 1;
+ damaged_area.height = 1;
+ cogl_clip_set(
+ CLUTTER_INT_TO_FIXED( damaged_area.x ),
+ CLUTTER_INT_TO_FIXED( damaged_area.y ),
+ CLUTTER_INT_TO_FIXED( damaged_area.width ),
+ CLUTTER_INT_TO_FIXED( damaged_area.height ));
+
+ /* Render a white backing rectangle */
+ cogl_color(&white);
+ cogl_rectangle(damaged_area.x, damaged_area.y,
+ damaged_area.width, damaged_area.height);
+
/* Render the entire scence in pick mode - just single colored silhouette's
* are drawn offscreen (as we never swap buffers)
*/
@@ -405,17 +437,25 @@
clutter_actor_paint (CLUTTER_ACTOR (stage));
context->pick_mode = CLUTTER_PICK_NONE;
- /* Calls should work under both GL and GLES, note GLES needs RGBA */
- glGetIntegerv(GL_VIEWPORT, viewport);
+ /* Revert our changes to clipping... */
+ cogl_clip_unset();
/* Below to be safe, particularly on GL ES. an EGL wait call or full
- * could be nicer.
- */
+ * could be nicer. */
glFinish();
/* Read the color of the screen co-ords pixel */
- glReadPixels (x, viewport[3] - y -1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
+ glReadPixels (x, inv_y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
+ /* Now render the previous color back onto the screen, to save
+ * doing a redraw of the area. This won't take effect on SGX
+ * until the next call to SwapBuffers, but it's not like we'll
+ * really miss a single pixel. */
+ previous_color.alpha = 255;
+ cogl_color(&previous_color);
+ cogl_rectangle(damaged_area.x, damaged_area.y,
+ damaged_area.width, damaged_area.height);
+
/* Enable dither. It is enabled by default anyway */
glEnable (GL_DITHER);
Modified: projects/haf/trunk/clutter0.8/clutter/clutter-stage.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/clutter-stage.c 2009-08-21 11:09:48 UTC (rev 19173)
+++ projects/haf/trunk/clutter0.8/clutter/clutter-stage.c 2009-08-21 11:48:19 UTC (rev 19174)
@@ -89,7 +89,11 @@
* AND the area for the last frame. */
#if CLUTTER_COGL_HAS_GLES
#define VIEWPORT_DAMAGE 0
-#define DOUBLE_BUFFER 1
+#define DOUBLE_BUFFER 0
+/* We *should* be double-buffered, but because we're just blitting in
+ * glSwapBuffers rather than flipping, we can do without the extra areas
+ * drawn. THIS MUST BE SET TO 1 IF FLIPPING IS EVER IMPLEMENTED
+ */
#else
#define VIEWPORT_DAMAGE 0
#define DOUBLE_BUFFER 1
@@ -367,21 +371,12 @@
clutter_stage_pick (ClutterActor *self,
const ClutterColor *color)
{
- ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
/* Paint nothing, cogl_paint_init() effectively paints the stage
* silhouette for us - see _clutter_do_pick().
* Chain up to the groups paint howerer so our children get picked
* - clutter_group_pick
*/
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->paint (self);
- /* Here we set the damaged area to the whole of the screen, as
- * the 'pick' will have destroyed it and the next time we render
- * we'll have to do everything */
- priv->damaged_area.x = 0;
- priv->damaged_area.y = 0;
- clutter_actor_get_size(self,
- &priv->damaged_area.width,
- &priv->damaged_area.height);
}
static void
Modified: projects/haf/trunk/clutter0.8/debian/changelog
===================================================================
--- projects/haf/trunk/clutter0.8/debian/changelog 2009-08-21 11:09:48 UTC (rev 19173)
+++ projects/haf/trunk/clutter0.8/debian/changelog 2009-08-21 11:48:19 UTC (rev 19174)
@@ -1,8 +1,15 @@
clutter (0.8.2-0maemo46~unreleased) unstable; urgency=low
- * foo
+ Fixes: NB#134034 - Blue screen observed in various scenarios
+ Also allows single-buffering to work passably and
+ * clutter/clutter-main.c: set DOUBLE_BUFFER=0 as we don't need to write to
+ such a large area while eglSwapBuffers uses blitting rather than flipping.
+ Do picking by restricting drawing to just a single pixel, which we replace
+ with the old color afterwards (previously we would write to the entire
+ screen, and then set the whole area as 'damaged').
+ * clutter/clutter-stage.c: Now don't set the whole screen areas as damaged
- -- Gordon Williams <gordon.williams at collabora.co.uk> Tue, 18 Aug 2009 16:07:28 +0300
+ -- Gordon Williams <gordon.williams at collabora.co.uk> Fri, 21 Aug 2009 12:47:28 +0100
clutter (0.8.2-0maemo45) unstable; urgency=low
- Previous message: [maemo-commits] r19173 - in projects/haf/trunk/gtk+: . gtk
- Next message: [maemo-commits] r19175 - projects/haf/trunk/sapwood/server
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
