diff --git a/layers/texture_layer_merger.cpp b/layers/texture_layer_merger.cpp index 00d40e2..39e2d44 100644 --- a/layers/texture_layer_merger.cpp +++ b/layers/texture_layer_merger.cpp @@ -48,7 +48,7 @@ void TextureLayerMerger::set_texture_flags(uint32_t p_flags) { Color TextureLayerMerger::get_base_color() const { return _base_color; } -void TextureLayerMerger::set_base_color(const Color p_color) { +void TextureLayerMerger::set_base_color(const Color &p_color) { _base_color = p_color; } @@ -72,7 +72,7 @@ Ref TextureLayerMerger::get_result_as_texture() const { return tex; } -void TextureLayerMerger::add_texture(Ref p_texture, Color p_color, Vector2 p_position, Rect2 p_rect) { +void TextureLayerMerger::add_texture(const Ref &p_texture, const Color &p_color, const Vector2 &p_position, Rect2 p_rect) { ERR_FAIL_COND(!p_texture.is_valid()); LayerMergerEntry entry; @@ -118,7 +118,7 @@ Ref TextureLayerMerger::get_texture(const int p_index) { return _entries.get(p_index).texture; } -void TextureLayerMerger::set_texture(const int p_index, Ref p_texture) { +void TextureLayerMerger::set_texture(const int p_index, const Ref &p_texture) { ERR_FAIL_INDEX(p_index, _entries.size()); _entries.get(p_index).texture = p_texture; @@ -129,7 +129,7 @@ Color TextureLayerMerger::get_color(const int p_index) { return _entries.get(p_index).color; } -void TextureLayerMerger::set_color(const int p_index, Color p_color) { +void TextureLayerMerger::set_color(const int p_index, const Color &p_color) { ERR_FAIL_INDEX(p_index, _entries.size()); _entries.get(p_index).color = p_color; @@ -140,7 +140,7 @@ Vector2 TextureLayerMerger::get_position(const int p_index) { return _entries.get(p_index).position; } -void TextureLayerMerger::set_position(const int p_index, Vector2 p_position) { +void TextureLayerMerger::set_position(const int p_index, const Vector2 &p_position) { ERR_FAIL_INDEX(p_index, _entries.size()); _entries.get(p_index).position = p_position; @@ -151,7 +151,7 @@ Rect2 TextureLayerMerger::get_rect(const int p_index) { return _entries.get(p_index).rect; } -void TextureLayerMerger::set_rect(const int p_index, Rect2 p_rect) { +void TextureLayerMerger::set_rect(const int p_index, const Rect2 &p_rect) { ERR_FAIL_INDEX(p_index, _entries.size()); _entries.get(p_index).rect = p_rect; diff --git a/layers/texture_layer_merger.h b/layers/texture_layer_merger.h index 7df69d6..b1b5617 100644 --- a/layers/texture_layer_merger.h +++ b/layers/texture_layer_merger.h @@ -57,29 +57,29 @@ public: void set_height(const int p_value); uint32_t get_texture_flags() const; - void set_texture_flags(uint32_t p_flags); + void set_texture_flags(const uint32_t p_flags); Color get_base_color() const; - void set_base_color(const Color p_color); + void set_base_color(const Color &p_color); Ref get_data() const; void set_data(const Ref &p_image); Ref get_result_as_texture() const; - void add_texture(Ref p_texture, Color p_color = Color(1, 1, 1, 1), Vector2 p_position = Vector2(), Rect2 p_rect = Rect2()); + void add_texture(const Ref &p_texture, const Color &p_color = Color(1, 1, 1, 1), const Vector2 &p_position = Vector2(), Rect2 p_rect = Rect2()); Ref get_texture(const int p_index); - void set_texture(const int p_index, Ref p_texture); + void set_texture(const int p_index, const Ref &p_texture); Color get_color(const int p_index); - void set_color(const int p_index, Color p_color); + void set_color(const int p_index, const Color &p_color); Vector2 get_position(const int p_index); - void set_position(const int p_index, Vector2 p_position); + void set_position(const int p_index, const Vector2 &p_position); Rect2 get_rect(const int p_index); - void set_rect(const int p_index, Rect2 p_rect); + void set_rect(const int p_index, const Rect2 &p_rect); void remove_texture(const int p_index); int get_texture_count(); diff --git a/texture_merger.cpp b/texture_merger.cpp index c622be6..dd4f741 100644 --- a/texture_merger.cpp +++ b/texture_merger.cpp @@ -59,7 +59,7 @@ void TextureMerger::set_keep_original_atlases(const bool value) { Color TextureMerger::get_background_color() const { return _packer->get_background_color(); } -void TextureMerger::set_background_color(const Color color) { +void TextureMerger::set_background_color(const Color &color) { _packer->set_background_color(color); } @@ -80,7 +80,7 @@ void TextureMerger::set_automatic_merge(const bool value) { Ref TextureMerger::get_packer() const { return _packer; } -void TextureMerger::set_packer(const Ref packer) { +void TextureMerger::set_packer(const Ref &packer) { _packer = packer; } @@ -130,7 +130,7 @@ void TextureMerger::set_textures(const Vector &textures) { set_dirty(true); } -Ref TextureMerger::add_texture(Ref texture) { +Ref TextureMerger::add_texture(const Ref &texture) { ERR_FAIL_COND_V(!texture.is_valid(), Ref()); _textures.push_back(texture); @@ -151,23 +151,23 @@ Ref TextureMerger::add_texture(Ref texture) { return tex; } -Ref TextureMerger::get_original_texture(int index) { +Ref TextureMerger::get_original_texture(const int index) { return _packer->get_original_texture(index); } -bool TextureMerger::contains_texture(Ref texture) { +bool TextureMerger::contains_texture(const Ref &texture) { return _packer->contains_texture(texture); } -Ref TextureMerger::get_texture(Ref texture) { +Ref TextureMerger::get_texture(const Ref &texture) { return _packer->get_texture(texture); } -Ref TextureMerger::get_texture_index(int index) { +Ref TextureMerger::get_texture_index(const int index) { return _packer->get_texture_index(index); } -bool TextureMerger::unref_texture_index(int index) { +bool TextureMerger::unref_texture_index(const int index) { if (_packer->unref_texture_index(index)) { if (has_method("_texture_removed")) call("_texture_removed"); @@ -182,7 +182,7 @@ bool TextureMerger::unref_texture_index(int index) { return false; } -bool TextureMerger::unref_texture(Ref texture) { +bool TextureMerger::unref_texture(const Ref &texture) { if (_packer->unref_texture(texture)) { if (has_method("_texture_removed")) call("_texture_removed"); @@ -197,7 +197,7 @@ bool TextureMerger::unref_texture(Ref texture) { return false; } -void TextureMerger::remove_texture_index(int index) { +void TextureMerger::remove_texture_index(const int index) { _packer->remove_texture_index(index); if (has_method("_texture_removed")) @@ -208,7 +208,7 @@ void TextureMerger::remove_texture_index(int index) { set_dirty(true); } -void TextureMerger::remove_texture(Ref texture) { +void TextureMerger::remove_texture(const Ref &texture) { _packer->remove_texture(texture); if (has_method("_texture_removed")) @@ -227,7 +227,7 @@ void TextureMerger::clear() { _packer->clear(); } -Ref TextureMerger::get_generated_texture(int index) { +Ref TextureMerger::get_generated_texture(const int index) { return _packer->get_generated_texture(index); } int TextureMerger::get_generated_texture_count() { diff --git a/texture_merger.h b/texture_merger.h index e54652d..d0e40e7 100644 --- a/texture_merger.h +++ b/texture_merger.h @@ -54,7 +54,7 @@ public: void set_keep_original_atlases(const bool value); Color get_background_color() const; - void set_background_color(const Color color); + void set_background_color(const Color &color); int get_margin() const; void set_margin(const int margin); @@ -63,26 +63,26 @@ public: void set_automatic_merge(const bool value); Ref get_packer() const; - void set_packer(const Ref packer); + void set_packer(const Ref &packer); Vector get_textures(); void set_textures(const Vector &textures); - Ref add_texture(Ref texture); - Ref get_texture(Ref texture); - Ref get_texture_index(int index); - Ref get_original_texture(int index); - bool contains_texture(Ref texture); + Ref add_texture(const Ref &texture); + Ref get_texture(const Ref &texture); + Ref get_texture_index(const int index); + Ref get_original_texture(const int index); + bool contains_texture(const Ref &texture); - bool unref_texture_index(int index); - bool unref_texture(Ref texture); - void remove_texture_index(int index); - void remove_texture(Ref texture); + bool unref_texture_index(const int index); + bool unref_texture(const Ref &texture); + void remove_texture_index(const int index); + void remove_texture(const Ref &texture); int get_texture_count(); void clear(); - Ref get_generated_texture(int index); + Ref get_generated_texture(const int index); int get_generated_texture_count(); void merge(); diff --git a/texture_packer.cpp b/texture_packer.cpp index ec6133a..b2b82f7 100644 --- a/texture_packer.cpp +++ b/texture_packer.cpp @@ -46,7 +46,7 @@ void TexturePacker::set_keep_original_atlases(const bool value) { Color TexturePacker::get_background_color() const { return _background_color; } -void TexturePacker::set_background_color(const Color color) { +void TexturePacker::set_background_color(const Color &color) { _background_color = color; } @@ -57,7 +57,7 @@ void TexturePacker::set_margin(const int margin) { _margin = margin; } -Ref TexturePacker::add_texture(Ref texture) { +Ref TexturePacker::add_texture(const Ref &texture) { ERR_FAIL_COND_V(!texture.is_valid(), Ref()); Ref atlas_text = texture; @@ -140,7 +140,7 @@ Ref TexturePacker::add_texture(Ref texture) { return tex; } -Ref TexturePacker::get_texture(Ref texture) { +Ref TexturePacker::get_texture(const Ref &texture) { for (int i = 0; i < _rects.size(); ++i) { rect_xywhf *r = _rects.get(i); @@ -160,19 +160,19 @@ Ref TexturePacker::get_texture(Ref texture) { return Ref(); } -Ref TexturePacker::get_texture_index(int index) { +Ref TexturePacker::get_texture_index(const int index) { ERR_FAIL_INDEX_V(index, _rects.size(), Ref()); return _rects.get(index)->atlas_texture; } -Ref TexturePacker::get_original_texture(int index) { +Ref TexturePacker::get_original_texture(const int index) { ERR_FAIL_INDEX_V(index, _rects.size(), Ref()); return _rects.get(index)->original_texture; } -bool TexturePacker::contains_texture(Ref texture) { +bool TexturePacker::contains_texture(const Ref &texture) { for (int i = 0; i < _rects.size(); ++i) { rect_xywhf *r = _rects.get(i); @@ -192,7 +192,7 @@ bool TexturePacker::contains_texture(Ref texture) { return false; } -bool TexturePacker::unref_texture_index(int index) { +bool TexturePacker::unref_texture_index(const int index) { ERR_FAIL_INDEX_V(index, _rects.size(), false); rect_xywhf *r = _rects.get(index); @@ -213,7 +213,7 @@ bool TexturePacker::unref_texture_index(int index) { return false; } -bool TexturePacker::unref_texture(Ref texture) { +bool TexturePacker::unref_texture(const Ref &texture) { for (int i = 0; i < _rects.size(); ++i) { rect_xywhf *r = _rects.get(i); @@ -247,7 +247,7 @@ bool TexturePacker::unref_texture(Ref texture) { return false; } -void TexturePacker::remove_texture_index(int index) { +void TexturePacker::remove_texture_index(const int index) { ERR_FAIL_INDEX(index, _rects.size()); rect_xywhf *r = _rects.get(index); @@ -258,7 +258,7 @@ void TexturePacker::remove_texture_index(int index) { memdelete(r); } -void TexturePacker::remove_texture(Ref texture) { +void TexturePacker::remove_texture(const Ref &texture) { for (int i = 0; i < _rects.size(); ++i) { rect_xywhf *r = _rects.get(i); @@ -307,7 +307,7 @@ void TexturePacker::clear() { _generated_textures.clear(); } -Ref TexturePacker::get_generated_texture(int index) { +Ref TexturePacker::get_generated_texture(const int index) { ERR_FAIL_INDEX_V(index, _generated_textures.size(), Ref()); return _generated_textures.get(index); @@ -418,7 +418,7 @@ void TexturePacker::merge() { } } -int TexturePacker::get_offset_for_format(Image::Format format) { +int TexturePacker::get_offset_for_format(const Image::Format format) { switch (format) { case Image::FORMAT_RGB8: return 3; diff --git a/texture_packer.h b/texture_packer.h index c616348..3c5900c 100644 --- a/texture_packer.h +++ b/texture_packer.h @@ -66,34 +66,34 @@ public: void set_keep_original_atlases(const bool value); Color get_background_color() const; - void set_background_color(const Color color); + void set_background_color(const Color &color); int get_margin() const; void set_margin(const int margin); - Ref add_texture(Ref texture); + Ref add_texture(const Ref &texture); - Ref get_texture(Ref texture); - Ref get_texture_index(int index); + Ref get_texture(const Ref &texture); + Ref get_texture_index(const int index); - Ref get_original_texture(int index); + Ref get_original_texture(const int index); - bool contains_texture(Ref texture); + bool contains_texture(const Ref &texture); - bool unref_texture_index(int index); - bool unref_texture(Ref texture); - void remove_texture_index(int index); - void remove_texture(Ref texture); + bool unref_texture_index(const int index); + bool unref_texture(const Ref &texture); + void remove_texture_index(const int index); + void remove_texture(const Ref &texture); int get_texture_count(); void clear(); - Ref get_generated_texture(int index); + Ref get_generated_texture(const int index); int get_generated_texture_count(); void merge(); - int get_offset_for_format(Image::Format format); + int get_offset_for_format(const Image::Format format); TexturePacker(); ~TexturePacker();