[weston,v2,1/2] toytoolkit: rename tile_mask to render_shadow

Submitted by Marek Chalupa on Oct. 29, 2014, 1:51 p.m.

Details

Message ID 1414590683-28386-1-git-send-email-mchqwerty@gmail.com
State Accepted
Commit 0d7fe8d92574e8cc9ff2195cbade28bab50d1c8d
Headers show

Not browsing as part of any series.

Commit Message

Marek Chalupa Oct. 29, 2014, 1:51 p.m.
This function is used and clearly designed only for drawing the shadows.
Rename it so that it has name after what it does and also move some
common code into the function.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
---
 shared/cairo-util.c       | 12 ++++++------
 shared/cairo-util.h       |  4 ++--
 xwayland/window-manager.c |  4 +---
 3 files changed, 9 insertions(+), 11 deletions(-)

Patch hide | download patch | download mbox

diff --git a/shared/cairo-util.c b/shared/cairo-util.c
index 26286c5..73e3ae7 100644
--- a/shared/cairo-util.c
+++ b/shared/cairo-util.c
@@ -137,13 +137,14 @@  blur_surface(cairo_surface_t *surface, int margin)
 }
 
 void
-tile_mask(cairo_t *cr, cairo_surface_t *surface,
-	  int x, int y, int width, int height, int margin, int top_margin)
+render_shadow(cairo_t *cr, cairo_surface_t *surface,
+	      int x, int y, int width, int height, int margin, int top_margin)
 {
 	cairo_pattern_t *pattern;
 	cairo_matrix_t matrix;
 	int i, fx, fy, vmargin;
 
+	cairo_set_source_rgba(cr, 0, 0, 0, 0.45);
 	cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
 	pattern = cairo_pattern_create_for_surface (surface);
 	cairo_pattern_set_filter(pattern, CAIRO_FILTER_NEAREST);
@@ -429,10 +430,9 @@  theme_render_frame(struct theme *t,
 	if (flags & THEME_FRAME_MAXIMIZED)
 		margin = 0;
 	else {
-		cairo_set_source_rgba(cr, 0, 0, 0, 0.45);
-		tile_mask(cr, t->shadow,
-			  2, 2, width + 8, height + 8,
-			  64, 64);
+		render_shadow(cr, t->shadow,
+			      2, 2, width + 8, height + 8,
+			      64, 64);
 		margin = t->margin;
 	}
 
diff --git a/shared/cairo-util.h b/shared/cairo-util.h
index 11d11d1..dc735a6 100644
--- a/shared/cairo-util.h
+++ b/shared/cairo-util.h
@@ -32,8 +32,8 @@  void
 surface_flush_device(cairo_surface_t *surface);
 
 void
-tile_mask(cairo_t *cr, cairo_surface_t *surface,
-	  int x, int y, int width, int height, int margin, int top_margin);
+render_shadow(cairo_t *cr, cairo_surface_t *surface,
+	      int x, int y, int width, int height, int margin, int top_margin);
 
 void
 tile_source(cairo_t *cr, cairo_surface_t *surface,
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index e7e5a7a..7b300b4 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -973,9 +973,7 @@  weston_wm_window_draw_decoration(void *data)
 		cairo_set_source_rgba(cr, 0, 0, 0, 0);
 		cairo_paint(cr);
 
-		cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
-		cairo_set_source_rgba(cr, 0, 0, 0, 0.45);
-		tile_mask(cr, t->shadow, 2, 2, width + 8, height + 8, 64, 64);
+		render_shadow(cr, t->shadow, 2, 2, width + 8, height + 8, 64, 64);
 	}
 
 	cairo_destroy(cr);