Files
Jacques Lucke 64a9260921 Core: remove WITH_CXX_GUARDEDALLOC option
This implements the proposal from #124512. For that it contains the following
changes:
* Remove the global override of `new`/`delete` when `WITH_CXX_GUARDEDALLOC` was
  enabled.
* Always use `MEM_CXX_CLASS_ALLOC_FUNCS` where it is currently used. This used
  to be guarded by `WITH_CXX_GUARDEDALLOC` in some but not all cases. This means
  that a few classes which didn't use our guarded allocator by default before,
  are now using it.

Pull Request: https://projects.blender.org/blender/blender/pulls/130181
2024-11-13 13:39:49 +01:00

69 lines
1.4 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup freestyle
*/
#include "../stroke/StyleModule.h"
#include "../system/PythonInterpreter.h"
#include "BLI_utildefines.h" // BLI_assert()
struct Text;
namespace Freestyle {
class BufferedStyleModule : public StyleModule {
public:
BufferedStyleModule(const string &buffer, const string &file_name, Interpreter *inter)
: StyleModule(file_name, inter)
{
_buffer = buffer;
}
virtual ~BufferedStyleModule() {}
protected:
virtual int interpret()
{
PythonInterpreter *py_inter = dynamic_cast<PythonInterpreter *>(_inter);
BLI_assert(py_inter != 0);
return py_inter->interpretString(_buffer, getFileName());
}
private:
string _buffer;
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BufferedStyleModule")
};
class BlenderStyleModule : public StyleModule {
public:
BlenderStyleModule(struct Text *text, const string &name, Interpreter *inter)
: StyleModule(name, inter)
{
_text = text;
}
virtual ~BlenderStyleModule() {}
protected:
virtual int interpret()
{
PythonInterpreter *py_inter = dynamic_cast<PythonInterpreter *>(_inter);
BLI_assert(py_inter != 0);
return py_inter->interpretText(_text, getFileName());
}
private:
struct Text *_text;
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BlenderStyleModule")
};
} /* namespace Freestyle */