[Bugs] #4104 sugar HIGH: Screenshot is all black in XO-4
Sugar Labs Bugs
bugtracker-noreply at sugarlabs.org
Mon Dec 10 09:36:31 EST 2012
#4104: Screenshot is all black in XO-4
------------------------+---------------------------------------------------
Reporter: godiard | Owner: erikos
Type: defect | Status: new
Priority: High | Milestone: 0.98
Component: sugar | Version: Unspecified
Severity: Major | Keywords: regression, r+
Distribution: OLPC | Status_field: Assigned
------------------------+---------------------------------------------------
Comment(by manuq):
I've found that the issue is the creation of the screenshot surface.
Using [http://developer.gnome.org/gdk3/stable/gdk3-Cairo-Interaction.html
#gdk-window-create-similar-surface gdk_window_create_similar_surface]
works because according to the documentation it creates a more compatible
surface. And is the same we are using in the toolkit.
Current approach:
1. create a cairo context for the root window (gdk_cairo_create) to get
its target surface 'window_surface' (cairo_get_target),
2. create a new surface with the same size as the window
'screenshot_surface' and format cairo.FORMAT_ARGB32 (cairo.ImageSurface)
3. create a new cairo context with that new surface as target
(cairo.Context)
4. set 'window_surface' as the source of the new cairo context
5. paint it (cairo_paint) and save it to a PNG file
(cairo.Surface.write_to_png)
Browse approach:
a. To create the new surface 'screenshot_surface' for step 2. above, use
gdk_window_create_similar_surface instead. In toolkit
(Activity.get_preview) we do the same. I think is better because
according to the documentation it creates a more compatible surface.
b. To set the window surface as the source surface on the new context,
step 4. above, use gdk_cairo_set_source_window instead. In toolkit
(Activity.get_preview) we use widget.draw(cr) directly which Ithink is a
better approach when you have a widget, but we have a Gdk window instead.
--
Ticket URL: <http://bugs.sugarlabs.org/ticket/4104#comment:15>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system
More information about the Bugs
mailing list