mirror of
https://github.com/Relintai/texture_packer.git
synced 2025-01-29 15:49:21 +01:00
Changed every parameter (where it could be done) to const or a const reference.
This commit is contained in:
parent
dbf3c59a9c
commit
a078695681
@ -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<ImageTexture> TextureLayerMerger::get_result_as_texture() const {
|
||||
return tex;
|
||||
}
|
||||
|
||||
void TextureLayerMerger::add_texture(Ref<Texture> p_texture, Color p_color, Vector2 p_position, Rect2 p_rect) {
|
||||
void TextureLayerMerger::add_texture(const Ref<Texture> &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<Texture> TextureLayerMerger::get_texture(const int p_index) {
|
||||
|
||||
return _entries.get(p_index).texture;
|
||||
}
|
||||
void TextureLayerMerger::set_texture(const int p_index, Ref<Texture> p_texture) {
|
||||
void TextureLayerMerger::set_texture(const int p_index, const Ref<Texture> &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;
|
||||
|
@ -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<Image> get_data() const;
|
||||
void set_data(const Ref<Image> &p_image);
|
||||
|
||||
Ref<ImageTexture> get_result_as_texture() const;
|
||||
|
||||
void add_texture(Ref<Texture> p_texture, Color p_color = Color(1, 1, 1, 1), Vector2 p_position = Vector2(), Rect2 p_rect = Rect2());
|
||||
void add_texture(const Ref<Texture> &p_texture, const Color &p_color = Color(1, 1, 1, 1), const Vector2 &p_position = Vector2(), Rect2 p_rect = Rect2());
|
||||
|
||||
Ref<Texture> get_texture(const int p_index);
|
||||
void set_texture(const int p_index, Ref<Texture> p_texture);
|
||||
void set_texture(const int p_index, const Ref<Texture> &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();
|
||||
|
@ -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<TexturePacker> TextureMerger::get_packer() const {
|
||||
return _packer;
|
||||
}
|
||||
void TextureMerger::set_packer(const Ref<TexturePacker> packer) {
|
||||
void TextureMerger::set_packer(const Ref<TexturePacker> &packer) {
|
||||
_packer = packer;
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ void TextureMerger::set_textures(const Vector<Variant> &textures) {
|
||||
set_dirty(true);
|
||||
}
|
||||
|
||||
Ref<AtlasTexture> TextureMerger::add_texture(Ref<Texture> texture) {
|
||||
Ref<AtlasTexture> TextureMerger::add_texture(const Ref<Texture> &texture) {
|
||||
ERR_FAIL_COND_V(!texture.is_valid(), Ref<AtlasTexture>());
|
||||
|
||||
_textures.push_back(texture);
|
||||
@ -151,23 +151,23 @@ Ref<AtlasTexture> TextureMerger::add_texture(Ref<Texture> texture) {
|
||||
return tex;
|
||||
}
|
||||
|
||||
Ref<Texture> TextureMerger::get_original_texture(int index) {
|
||||
Ref<Texture> TextureMerger::get_original_texture(const int index) {
|
||||
return _packer->get_original_texture(index);
|
||||
}
|
||||
|
||||
bool TextureMerger::contains_texture(Ref<Texture> texture) {
|
||||
bool TextureMerger::contains_texture(const Ref<Texture> &texture) {
|
||||
return _packer->contains_texture(texture);
|
||||
}
|
||||
|
||||
Ref<AtlasTexture> TextureMerger::get_texture(Ref<Texture> texture) {
|
||||
Ref<AtlasTexture> TextureMerger::get_texture(const Ref<Texture> &texture) {
|
||||
return _packer->get_texture(texture);
|
||||
}
|
||||
|
||||
Ref<AtlasTexture> TextureMerger::get_texture_index(int index) {
|
||||
Ref<AtlasTexture> 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> texture) {
|
||||
bool TextureMerger::unref_texture(const Ref<Texture> &texture) {
|
||||
if (_packer->unref_texture(texture)) {
|
||||
if (has_method("_texture_removed"))
|
||||
call("_texture_removed");
|
||||
@ -197,7 +197,7 @@ bool TextureMerger::unref_texture(Ref<Texture> 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> texture) {
|
||||
void TextureMerger::remove_texture(const Ref<Texture> &texture) {
|
||||
_packer->remove_texture(texture);
|
||||
|
||||
if (has_method("_texture_removed"))
|
||||
@ -227,7 +227,7 @@ void TextureMerger::clear() {
|
||||
_packer->clear();
|
||||
}
|
||||
|
||||
Ref<ImageTexture> TextureMerger::get_generated_texture(int index) {
|
||||
Ref<ImageTexture> TextureMerger::get_generated_texture(const int index) {
|
||||
return _packer->get_generated_texture(index);
|
||||
}
|
||||
int TextureMerger::get_generated_texture_count() {
|
||||
|
@ -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<TexturePacker> get_packer() const;
|
||||
void set_packer(const Ref<TexturePacker> packer);
|
||||
void set_packer(const Ref<TexturePacker> &packer);
|
||||
|
||||
Vector<Variant> get_textures();
|
||||
void set_textures(const Vector<Variant> &textures);
|
||||
|
||||
Ref<AtlasTexture> add_texture(Ref<Texture> texture);
|
||||
Ref<AtlasTexture> get_texture(Ref<Texture> texture);
|
||||
Ref<AtlasTexture> get_texture_index(int index);
|
||||
Ref<Texture> get_original_texture(int index);
|
||||
bool contains_texture(Ref<Texture> texture);
|
||||
Ref<AtlasTexture> add_texture(const Ref<Texture> &texture);
|
||||
Ref<AtlasTexture> get_texture(const Ref<Texture> &texture);
|
||||
Ref<AtlasTexture> get_texture_index(const int index);
|
||||
Ref<Texture> get_original_texture(const int index);
|
||||
bool contains_texture(const Ref<Texture> &texture);
|
||||
|
||||
bool unref_texture_index(int index);
|
||||
bool unref_texture(Ref<Texture> texture);
|
||||
void remove_texture_index(int index);
|
||||
void remove_texture(Ref<Texture> texture);
|
||||
bool unref_texture_index(const int index);
|
||||
bool unref_texture(const Ref<Texture> &texture);
|
||||
void remove_texture_index(const int index);
|
||||
void remove_texture(const Ref<Texture> &texture);
|
||||
|
||||
int get_texture_count();
|
||||
void clear();
|
||||
|
||||
Ref<ImageTexture> get_generated_texture(int index);
|
||||
Ref<ImageTexture> get_generated_texture(const int index);
|
||||
int get_generated_texture_count();
|
||||
|
||||
void merge();
|
||||
|
@ -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<AtlasTexture> TexturePacker::add_texture(Ref<Texture> texture) {
|
||||
Ref<AtlasTexture> TexturePacker::add_texture(const Ref<Texture> &texture) {
|
||||
ERR_FAIL_COND_V(!texture.is_valid(), Ref<AtlasTexture>());
|
||||
|
||||
Ref<AtlasTexture> atlas_text = texture;
|
||||
@ -140,7 +140,7 @@ Ref<AtlasTexture> TexturePacker::add_texture(Ref<Texture> texture) {
|
||||
return tex;
|
||||
}
|
||||
|
||||
Ref<AtlasTexture> TexturePacker::get_texture(Ref<Texture> texture) {
|
||||
Ref<AtlasTexture> TexturePacker::get_texture(const Ref<Texture> &texture) {
|
||||
for (int i = 0; i < _rects.size(); ++i) {
|
||||
rect_xywhf *r = _rects.get(i);
|
||||
|
||||
@ -160,19 +160,19 @@ Ref<AtlasTexture> TexturePacker::get_texture(Ref<Texture> texture) {
|
||||
return Ref<Texture>();
|
||||
}
|
||||
|
||||
Ref<AtlasTexture> TexturePacker::get_texture_index(int index) {
|
||||
Ref<AtlasTexture> TexturePacker::get_texture_index(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _rects.size(), Ref<AtlasTexture>());
|
||||
|
||||
return _rects.get(index)->atlas_texture;
|
||||
}
|
||||
|
||||
Ref<Texture> TexturePacker::get_original_texture(int index) {
|
||||
Ref<Texture> TexturePacker::get_original_texture(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _rects.size(), Ref<Texture>());
|
||||
|
||||
return _rects.get(index)->original_texture;
|
||||
}
|
||||
|
||||
bool TexturePacker::contains_texture(Ref<Texture> texture) {
|
||||
bool TexturePacker::contains_texture(const Ref<Texture> &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> 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> texture) {
|
||||
bool TexturePacker::unref_texture(const Ref<Texture> &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> 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> texture) {
|
||||
void TexturePacker::remove_texture(const Ref<Texture> &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<ImageTexture> TexturePacker::get_generated_texture(int index) {
|
||||
Ref<ImageTexture> TexturePacker::get_generated_texture(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _generated_textures.size(), Ref<ImageTexture>());
|
||||
|
||||
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;
|
||||
|
@ -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<AtlasTexture> add_texture(Ref<Texture> texture);
|
||||
Ref<AtlasTexture> add_texture(const Ref<Texture> &texture);
|
||||
|
||||
Ref<AtlasTexture> get_texture(Ref<Texture> texture);
|
||||
Ref<AtlasTexture> get_texture_index(int index);
|
||||
Ref<AtlasTexture> get_texture(const Ref<Texture> &texture);
|
||||
Ref<AtlasTexture> get_texture_index(const int index);
|
||||
|
||||
Ref<Texture> get_original_texture(int index);
|
||||
Ref<Texture> get_original_texture(const int index);
|
||||
|
||||
bool contains_texture(Ref<Texture> texture);
|
||||
bool contains_texture(const Ref<Texture> &texture);
|
||||
|
||||
bool unref_texture_index(int index);
|
||||
bool unref_texture(Ref<Texture> texture);
|
||||
void remove_texture_index(int index);
|
||||
void remove_texture(Ref<Texture> texture);
|
||||
bool unref_texture_index(const int index);
|
||||
bool unref_texture(const Ref<Texture> &texture);
|
||||
void remove_texture_index(const int index);
|
||||
void remove_texture(const Ref<Texture> &texture);
|
||||
|
||||
int get_texture_count();
|
||||
void clear();
|
||||
|
||||
Ref<ImageTexture> get_generated_texture(int index);
|
||||
Ref<ImageTexture> 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();
|
||||
|
Loading…
Reference in New Issue
Block a user