You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Rewrite HashMapHasherDefault based on type traits - it is now possible to declare a default hashing function for any type.
Remove cross-project includes from `hashfuncs.h`. Improve hashing function for `Color` (based on values instead of `String`). Move `Variant` comparison from `hash_map.h` to `dictionary.cpp` (`VariantComparatorDictionary`), where it's used. Remove now unnecessary `HashableHasher`.
This commit is contained in:
@@ -70,6 +70,8 @@ class GridMap : public Node3D {
|
||||
return Vector3i(x, y, z);
|
||||
}
|
||||
|
||||
uint32_t hash() const { return operator Vector3i().hash(); }
|
||||
|
||||
IndexKey(Vector3i p_vector) {
|
||||
x = (int16_t)p_vector.x;
|
||||
y = (int16_t)p_vector.y;
|
||||
|
||||
@@ -109,22 +109,22 @@ Error ImageLoaderSVG::create_image_from_utf8_buffer(Ref<Image> p_image, const ui
|
||||
|
||||
tvg::Result res = sw_canvas->target((uint32_t *)buffer.ptrw(), width, width, height, tvg::SwCanvas::ABGR8888S);
|
||||
if (res != tvg::Result::Success) {
|
||||
ERR_FAIL_V_MSG(FAILED, "ImageLoaderSVG: Couldn't set target on ThorVG canvas.");
|
||||
ERR_FAIL_V_MSG(FAILED, vformat("ImageLoaderSVG: Couldn't set target on ThorVG canvas, error code %d.", res));
|
||||
}
|
||||
|
||||
res = sw_canvas->push(std::move(picture));
|
||||
if (res != tvg::Result::Success) {
|
||||
ERR_FAIL_V_MSG(FAILED, "ImageLoaderSVG: Couldn't insert ThorVG picture on canvas.");
|
||||
ERR_FAIL_V_MSG(FAILED, vformat("ImageLoaderSVG: Couldn't insert ThorVG picture on canvas, error code %d.", res));
|
||||
}
|
||||
|
||||
res = sw_canvas->draw();
|
||||
if (res != tvg::Result::Success) {
|
||||
ERR_FAIL_V_MSG(FAILED, "ImageLoaderSVG: Couldn't draw ThorVG pictures on canvas.");
|
||||
ERR_FAIL_V_MSG(FAILED, vformat("ImageLoaderSVG: Couldn't draw ThorVG pictures on canvas, error code %d.", res));
|
||||
}
|
||||
|
||||
res = sw_canvas->sync();
|
||||
if (res != tvg::Result::Success) {
|
||||
ERR_FAIL_V_MSG(FAILED, "ImageLoaderSVG: Couldn't sync ThorVG canvas.");
|
||||
ERR_FAIL_V_MSG(FAILED, vformat("ImageLoaderSVG: Couldn't sync ThorVG canvas, error code %d.", res));
|
||||
}
|
||||
|
||||
p_image->set_data(width, height, false, Image::FORMAT_RGBA8, buffer);
|
||||
|
||||
@@ -43,6 +43,7 @@ using namespace godot;
|
||||
// Headers for building as built-in module.
|
||||
|
||||
#include "core/os/mutex.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/templates/hash_map.h"
|
||||
#include "core/typedefs.h"
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ using namespace godot;
|
||||
// Headers for building as built-in module.
|
||||
|
||||
#include "core/os/mutex.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/templates/hash_map.h"
|
||||
#include "core/typedefs.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user