mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-07-18 12:04:03 -04:00
1. Implement partial refresh. 2. Implement refresh canceling mechanism. 3. Refactor some parts of the gui and display code. ad 1. - Detect parts of the screen changed since last update and merge them into bigger regions. These regions defines parts of the context sent to the display. - Refresh the region covering all of the parts since this is the most time consuming part and the size of the refreshed region doesn't change the time much. - Refresh the whole screen if deep refresh is requested and previously fast refresh was used. This is needed to prevent unwanted artifacts in some cases. ad 2. - Separate display update and refresh logic. - Divide image display message handling into two handlers, one updating and other one refreshing the screen. - Add cancel refresh message and use it to cancel refresh during update. - Store sum of refresh regions gathered during updates to refresh them all at once at the end.
72 lines
2.0 KiB
C++
72 lines
2.0 KiB
C++
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#pragma once
|
|
|
|
#include "EinkMessage.hpp"
|
|
|
|
#include <hal/eink/AbstractEinkDisplay.hpp>
|
|
#include <module-gui/gui/core/Context.hpp>
|
|
#include <module-gui/gui/Common.hpp>
|
|
|
|
#include <cstdint>
|
|
|
|
namespace service::eink
|
|
{
|
|
class ImageMessage : public EinkMessage
|
|
{
|
|
public:
|
|
ImageMessage(int contextId, ::gui::Context *context, ::gui::RefreshModes refreshMode);
|
|
|
|
[[nodiscard]] auto getContextId() const noexcept -> int;
|
|
[[nodiscard]] auto getContext() noexcept -> ::gui::Context *;
|
|
[[nodiscard]] auto getRefreshMode() const noexcept -> ::gui::RefreshModes;
|
|
|
|
private:
|
|
int contextId;
|
|
::gui::Context *context;
|
|
::gui::RefreshModes refreshMode;
|
|
};
|
|
|
|
class ShutdownImageMessage : public ImageMessage
|
|
{
|
|
public:
|
|
using ImageMessage::ImageMessage;
|
|
};
|
|
|
|
class ImageDisplayedNotification : public EinkMessage
|
|
{
|
|
public:
|
|
explicit ImageDisplayedNotification(int contextId);
|
|
|
|
[[nodiscard]] auto getContextId() const noexcept -> int;
|
|
|
|
private:
|
|
int contextId;
|
|
};
|
|
|
|
class RefreshMessage : public EinkMessage
|
|
{
|
|
public:
|
|
RefreshMessage(int contextId,
|
|
hal::eink::EinkFrame refreshBox,
|
|
hal::eink::EinkRefreshMode refreshMode,
|
|
const std::string &originalSender);
|
|
|
|
[[nodiscard]] auto getContextId() const noexcept -> int;
|
|
[[nodiscard]] auto getRefreshFrame() noexcept -> hal::eink::EinkFrame;
|
|
[[nodiscard]] auto getRefreshMode() const noexcept -> hal::eink::EinkRefreshMode;
|
|
[[nodiscard]] auto getOriginalSender() const noexcept -> const std::string &;
|
|
|
|
private:
|
|
int contextId;
|
|
hal::eink::EinkFrame refreshFrame;
|
|
hal::eink::EinkRefreshMode refreshMode;
|
|
std::string originalSender;
|
|
};
|
|
|
|
class CancelRefreshMessage : public EinkMessage
|
|
{};
|
|
|
|
} // namespace service::eink
|