From 7e27a59fe6614aa10d34669d2083a8c0b801b6f3 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Fri, 29 Oct 2010 14:33:14 -0700 Subject: [PATCH] ClearRect() using save/restore instead of explicit set_operator call --- src/CanvasRenderingContext2d.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CanvasRenderingContext2d.cc b/src/CanvasRenderingContext2d.cc index b0979d4..27c62c0 100644 --- a/src/CanvasRenderingContext2d.cc +++ b/src/CanvasRenderingContext2d.cc @@ -801,10 +801,11 @@ Context2d::ClearRect(const Arguments &args) { if (0 == width || 0 == height) return Undefined(); Context2d *context = ObjectWrap::Unwrap(args.This()); cairo_t *ctx = context->getContext(); - cairo_set_operator(ctx, CAIRO_OPERATOR_CLEAR); + cairo_save(ctx); cairo_rectangle(ctx, x, y, width, height); + cairo_set_operator(ctx, CAIRO_OPERATOR_CLEAR); cairo_fill(ctx); - cairo_set_operator(ctx, CAIRO_OPERATOR_OVER); + cairo_restore(ctx); return Undefined(); }