[mutter] clutter/stage: Add view scale support on read_pixels()
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/stage: Add view scale support on read_pixels()
- Date: Fri, 1 Mar 2019 18:08:01 +0000 (UTC)
commit 412d5685bac1ac0e3e142b94dad88d269e9ad8d6
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Fri Jan 26 13:39:44 2018 +0100
clutter/stage: Add view scale support on read_pixels()
https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
clutter/clutter/clutter-stage.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index c39753f51..1eea5b305 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -2944,6 +2944,9 @@ clutter_stage_read_pixels (ClutterStage *stage,
cairo_region_t *clip;
cairo_rectangle_int_t clip_rect;
CoglFramebuffer *framebuffer;
+ float view_scale;
+ float pixel_width;
+ float pixel_height;
uint8_t *pixels;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
@@ -2986,10 +2989,15 @@ clutter_stage_read_pixels (ClutterStage *stage,
cogl_push_framebuffer (framebuffer);
clutter_stage_do_paint_view (stage, view, &clip_rect);
- pixels = g_malloc0 (clip_rect.width * clip_rect.height * 4);
+ view_scale = clutter_stage_view_get_scale (view);
+ pixel_width = roundf (clip_rect.width * view_scale);
+ pixel_height = roundf (clip_rect.height * view_scale);
+
+ pixels = g_malloc0 (pixel_width * pixel_height * 4);
cogl_framebuffer_read_pixels (framebuffer,
- clip_rect.x, clip_rect.y,
- clip_rect.width, clip_rect.height,
+ clip_rect.x * view_scale,
+ clip_rect.y * view_scale,
+ pixel_width, pixel_height,
COGL_PIXEL_FORMAT_RGBA_8888,
pixels);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]