d22cddd1e8
This patch changes nitpicker's way of redrawing. Originally, redraw operations were triggered immediately by the RPC functions invoked by clients. In the presence of clients that invoked a large number of those functions, the server could become overloaded with processing redraw operations. The new version performs redraw operations out of band with the RPC functions. Similar to the design of the DOpE GUI server, redraw operations are processed periodically. The RPC functions merely modify meta data and track the dirty areas that need to be updated. Consequently, nitpicker's RPC functions become light-weight operations. As a nice collateral effect of this patch, nitpicker's internal structure could be simplified because the drawing backend is no longer needed by the code that dispatches the RPC interface.
74 lines
1.6 KiB
C
74 lines
1.6 KiB
C
/*
|
|
* \brief Nitpicker background
|
|
* \author Norman Feske
|
|
* \date 2006-06-22
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2006-2013 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU General Public License version 2.
|
|
*/
|
|
|
|
#ifndef _BACKGROUND_H_
|
|
#define _BACKGROUND_H_
|
|
|
|
#include <nitpicker_gfx/box_painter.h>
|
|
|
|
#include "view.h"
|
|
#include "clip_guard.h"
|
|
|
|
struct Background : private Texture_base, Session, View
|
|
{
|
|
Color color;
|
|
|
|
/*
|
|
* The background uses no texture. Therefore
|
|
* we can pass a null pointer as texture argument
|
|
* to the Session constructor.
|
|
*/
|
|
Background(Area size)
|
|
:
|
|
Texture_base(Area(0, 0)), Session(Genode::Session_label(""), 0, false),
|
|
View(*this, View::NOT_STAY_TOP, View::NOT_TRANSPARENT, View::BACKGROUND, 0),
|
|
color(25, 37, 50)
|
|
{
|
|
View::geometry(Rect(Point(0, 0), size));
|
|
}
|
|
|
|
|
|
/***********************
|
|
** Session interface **
|
|
***********************/
|
|
|
|
void submit_input_event(Input::Event) override { }
|
|
void submit_sync() override { }
|
|
|
|
|
|
/********************
|
|
** View interface **
|
|
********************/
|
|
|
|
int frame_size(Mode const &mode) const override { return 0; }
|
|
void frame(Canvas_base &canvas, Mode const &mode) const override { }
|
|
|
|
void draw(Canvas_base &canvas, Mode const &mode) const override
|
|
{
|
|
Rect const view_rect = abs_geometry();
|
|
Clip_guard clip_guard(canvas, view_rect);
|
|
|
|
if (tmp_fb) {
|
|
for (unsigned i = 0; i < 7; i++) {
|
|
|
|
canvas.draw_box(view_rect, Color(i*2,i*6,i*16*2));
|
|
tmp_fb->refresh(0,0,1024,768);
|
|
}
|
|
}
|
|
|
|
canvas.draw_box(view_rect, color);
|
|
}
|
|
};
|
|
|
|
#endif /* _BACKGROUND_H_ */
|