summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/bgfx/clearreader.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-01-29 06:53:43 +1100
committer Vas Crabb <vas@vastheman.com>2023-01-29 06:53:43 +1100
commiteaa43879cd2ae2e4c7bf7d685e8650a32277eea7 (patch)
tree598d9eab839851d279ab68cdbdf778ad4f3cf38a /src/osd/modules/render/bgfx/clearreader.cpp
parent5671484fc87fc11b536a0b0f6cb0efb1e680d489 (diff)
render/bgfx: Got rid of a lot of unnecessary object copying during setup.
Diffstat (limited to 'src/osd/modules/render/bgfx/clearreader.cpp')
-rw-r--r--src/osd/modules/render/bgfx/clearreader.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/osd/modules/render/bgfx/clearreader.cpp b/src/osd/modules/render/bgfx/clearreader.cpp
index 948d96a7393..414e5f27988 100644
--- a/src/osd/modules/render/bgfx/clearreader.cpp
+++ b/src/osd/modules/render/bgfx/clearreader.cpp
@@ -6,13 +6,13 @@
//
//============================================================
-#include <bgfx/bgfx.h>
-
#include "clearreader.h"
#include "clear.h"
-clear_state* clear_reader::read_from_value(const Value& value, std::string prefix)
+#include <bgfx/bgfx.h>
+
+clear_state* clear_reader::read_from_value(const Value& value, const std::string &prefix)
{
if (!validate_parameters(value, prefix))
{
@@ -29,7 +29,7 @@ clear_state* clear_reader::read_from_value(const Value& value, std::string prefi
const Value& colors = value["clearcolor"];
for (int i = 0; i < colors.Size(); i++)
{
- if (!READER_CHECK(colors[i].IsNumber(), (prefix + "clearcolor[" + std::to_string(i) + "] must be a numeric value\n").c_str())) return nullptr;
+ if (!READER_CHECK(colors[i].IsNumber(), "%sclearcolor[%d] must be a numeric value\n", prefix, i)) return nullptr;
auto val = int32_t(float(colors[i].GetDouble()) * 255.0f);
if (val > 255) val = 255;
if (val < 0) val = 0;
@@ -53,10 +53,10 @@ clear_state* clear_reader::read_from_value(const Value& value, std::string prefi
return new clear_state(clear_flags, clear_color, clear_depth, clear_stencil);
}
-bool clear_reader::validate_parameters(const Value& value, std::string prefix)
+bool clear_reader::validate_parameters(const Value& value, const std::string &prefix)
{
- if (!READER_CHECK(!value.HasMember("clearcolor") || (value["clearcolor"].IsArray() && value["clearcolor"].GetArray().Size() == 4), (prefix + "'clearcolor' must be an array of four numeric RGBA values representing the color to which to clear the color buffer\n").c_str())) return false;
- if (!READER_CHECK(!value.HasMember("cleardepth") || value["cleardepth"].IsNumber(), (prefix + "'cleardepth' must be a numeric value representing the depth to which to clear the depth buffer\n").c_str())) return false;
- if (!READER_CHECK(!value.HasMember("clearstencil") || value["clearstencil"].IsNumber(), (prefix + "'clearstencil' must be a numeric value representing the stencil value to which to clear the stencil buffer\n").c_str())) return false;
+ if (!READER_CHECK(!value.HasMember("clearcolor") || (value["clearcolor"].IsArray() && value["clearcolor"].GetArray().Size() == 4), "%s'clearcolor' must be an array of four numeric RGBA values representing the color to which to clear the color buffer\n", prefix)) return false;
+ if (!READER_CHECK(!value.HasMember("cleardepth") || value["cleardepth"].IsNumber(), "%s'cleardepth' must be a numeric value representing the depth to which to clear the depth buffer\n", prefix)) return false;
+ if (!READER_CHECK(!value.HasMember("clearstencil") || value["clearstencil"].IsNumber(), "%s'clearstencil' must be a numeric value representing the stencil value to which to clear the stencil buffer\n", prefix)) return false;
return true;
}