Browse Source

Added ~Gradient() to free the pattern

v1.x
Tj Holowaychuk 15 years ago
parent
commit
75671a229f
  1. 8
      src/gradient.cc
  2. 1
      src/gradient.h

8
src/gradient.cc

@ -98,3 +98,11 @@ Gradient::Gradient(double x0, double y0, double r0, double x1, double y1, double
_x0(x0), _y0(y0), _x1(x1), _y1(y1), _r0(r0), _r1(r1) { _x0(x0), _y0(y0), _x1(x1), _y1(y1), _r0(r0), _r1(r1) {
_pattern = cairo_pattern_create_radial(x0, y0, r0, x1, y1, r1); _pattern = cairo_pattern_create_radial(x0, y0, r0, x1, y1, r1);
} }
/*
* Destroy the pattern.
*/
Gradient::~Gradient() {
cairo_pattern_destroy(_pattern);
}

1
src/gradient.h

@ -22,6 +22,7 @@ class Gradient: public node::ObjectWrap {
inline cairo_pattern_t *getPattern(){ return _pattern; } inline cairo_pattern_t *getPattern(){ return _pattern; }
private: private:
~Gradient();
double _x0, _y0, _x1, _y1, _r0, _r1; double _x0, _y0, _x1, _y1, _r0, _r1;
cairo_pattern_t *_pattern; cairo_pattern_t *_pattern;
}; };

Loading…
Cancel
Save