changed to new interface with default constructor

This commit is contained in:
Bob Polis 2020-10-27 15:28:26 +01:00
parent da2d463ab7
commit 641c57bfa1
2 changed files with 8 additions and 6 deletions

View File

@ -8,17 +8,18 @@
#include "RectSaver.hpp"
RectSaver::RectSaver(cairo_t* context, const cairo_rectangle_t& rect) : ScreensaverPlugin {context, rect} {
void RectSaver::setup(cairo_t* context, const cairo_rectangle_t& rect) {
ScreensaverPlugin::setup(context, rect);
make_black();
}
int RectSaver::fps() const {
return 2;
}
void RectSaver::draw_frame() {
cairo_set_source_rgb(_c, random01(), random01(), random01());
cairo_rectangle_t rect {random_rect()};
cairo_rectangle(_c, rect.x, rect.y, rect.width, rect.height);
cairo_fill(_c);
}
int RectSaver::fps() const {
return 2;
}

View File

@ -13,9 +13,10 @@
class RectSaver : public ScreensaverPlugin {
public:
RectSaver(cairo_t* context, const cairo_rectangle_t& rect);
RectSaver() = default;
~RectSaver() = default;
void setup(cairo_t* context, const cairo_rectangle_t& rect) override;
void draw_frame() override;
int fps() const override;
};