Browse Source

Added drawImage() patternQuality support

v1.x
Tj Holowaychuk 14 years ago
parent
commit
83c86d1c4b
  1. 2
      src/CanvasRenderingContext2d.cc
  2. 1
      src/CanvasRenderingContext2d.h

2
src/CanvasRenderingContext2d.cc

@ -130,6 +130,7 @@ Context2d::Context2d(Canvas *canvas) {
state->fill = transparent; state->fill = transparent;
state->stroke = transparent; state->stroke = transparent;
state->shadow = transparent_black; state->shadow = transparent_black;
state->patternQuality = CAIRO_FILTER_GOOD;
} }
/* /*
@ -568,6 +569,7 @@ Context2d::DrawImage(const Arguments &args) {
// Paint // Paint
cairo_set_source_surface(ctx, src, dx, dy); cairo_set_source_surface(ctx, src, dx, dy);
cairo_pattern_set_filter(cairo_get_source(ctx), context->state->patternQuality);
cairo_paint_with_alpha(ctx, context->state->globalAlpha); cairo_paint_with_alpha(ctx, context->state->globalAlpha);
cairo_restore(ctx); cairo_restore(ctx);

1
src/CanvasRenderingContext2d.h

@ -22,6 +22,7 @@
typedef struct { typedef struct {
rgba_t fill; rgba_t fill;
rgba_t stroke; rgba_t stroke;
cairo_filter_t patternQuality;
cairo_pattern_t *fillPattern; cairo_pattern_t *fillPattern;
cairo_pattern_t *strokePattern; cairo_pattern_t *strokePattern;
float globalAlpha; float globalAlpha;

Loading…
Cancel
Save