From 641c57bfa1661cd79710f48b5dd50ab15e650a8e Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Tue, 27 Oct 2020 15:28:26 +0100 Subject: [PATCH] changed to new interface with default constructor --- rects/RectSaver.cpp | 11 ++++++----- rects/RectSaver.hpp | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/rects/RectSaver.cpp b/rects/RectSaver.cpp index 40a5398..37ea057 100644 --- a/rects/RectSaver.cpp +++ b/rects/RectSaver.cpp @@ -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; -} diff --git a/rects/RectSaver.hpp b/rects/RectSaver.hpp index 712099d..a3885a8 100644 --- a/rects/RectSaver.hpp +++ b/rects/RectSaver.hpp @@ -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; };