2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2012-12-28 20:21:05 +00:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup freestyle
|
|
|
|
|
* \brief Classes defining the basic "Iterator" design pattern
|
2012-12-28 20:21:05 +00:00
|
|
|
*/
|
2012-07-16 23:29:12 +00:00
|
|
|
|
|
|
|
|
#include "render_types.h"
|
|
|
|
|
|
2013-05-13 22:58:27 +00:00
|
|
|
#ifdef WITH_CXX_GUARDEDALLOC
|
|
|
|
|
# include "MEM_guardedalloc.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
namespace Freestyle {
|
|
|
|
|
|
2012-07-16 23:29:12 +00:00
|
|
|
class RenderMonitor {
|
|
|
|
|
public:
|
2012-12-28 20:21:05 +00:00
|
|
|
inline RenderMonitor(Render *re)
|
|
|
|
|
{
|
|
|
|
|
_re = re;
|
|
|
|
|
}
|
2012-07-16 23:29:12 +00:00
|
|
|
|
2023-03-29 16:50:54 +02:00
|
|
|
virtual ~RenderMonitor() {}
|
2012-07-16 23:29:12 +00:00
|
|
|
|
2013-05-19 00:56:40 +00:00
|
|
|
inline void setInfo(string info)
|
|
|
|
|
{
|
|
|
|
|
if (_re && !info.empty()) {
|
|
|
|
|
_re->i.infostr = info.c_str();
|
2023-08-11 12:46:03 +02:00
|
|
|
_re->stats_draw(&_re->i);
|
2023-08-01 21:15:52 +10:00
|
|
|
_re->i.infostr = nullptr;
|
2013-05-19 00:56:40 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void progress(float i)
|
|
|
|
|
{
|
2019-05-31 23:21:16 +10:00
|
|
|
if (_re) {
|
2023-08-11 12:42:16 +02:00
|
|
|
_re->progress(i);
|
2019-05-31 23:21:16 +10:00
|
|
|
}
|
2013-05-19 00:56:40 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline bool testBreak()
|
|
|
|
|
{
|
2023-08-11 12:30:57 +02:00
|
|
|
return _re && _re->test_break();
|
2012-12-28 20:21:05 +00:00
|
|
|
}
|
2012-07-16 23:29:12 +00:00
|
|
|
|
|
|
|
|
protected:
|
2012-12-28 20:21:05 +00:00
|
|
|
Render *_re;
|
2013-05-13 22:58:27 +00:00
|
|
|
|
|
|
|
|
#ifdef WITH_CXX_GUARDEDALLOC
|
|
|
|
|
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:RenderMonitor")
|
|
|
|
|
#endif
|
2012-07-16 23:29:12 +00:00
|
|
|
};
|
|
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
} /* namespace Freestyle */
|