// // RectSaver.cpp // screensaver // // Created by Bob Polis at 2020-10-26 // Copyright (c) 2020 SwiftCoder. All rights reserved. // #include "RectSaver.hpp" RectSaver::RectSaver(cairo_t* context, const cairo_rectangle_t& rect) : ScreensaverPlugin {context, rect} { make_black(); } 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 5; }