mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-10 21:16:24 +02:00
Make ToAtlasImage a global function instead of a method on ImageDesc
This commit is contained in:
1 parent
95703d2d9c
commit
ca2a7c93a0
4 files changed
+6
-6
No files matched your search
@@ -164,9 +164,9 @@ std::vector<Data> Bucket::Resolve(int image_width, Image &dest) {
|
||||
return data;
|
||||
}
|
||||
|
||||
AtlasImage ImageDesc::ToAtlasImage(int id, float tw, float th, const std::vector<Data> &results) const {
|
||||
AtlasImage ToAtlasImage(int id, std::string_view name, float tw, float th, const std::vector<Data> &results) {
|
||||
AtlasImage img{};
|
||||
const int i = id == -1 ? result_index : id;
|
||||
const int i = id;
|
||||
const float toffx = 0.5f / tw;
|
||||
const float toffy = 0.5f / th;
|
||||
img.u1 = results[i].sx / tw + toffx;
|
||||
|
||||
@@ -104,6 +104,6 @@ struct ImageDesc {
|
||||
std::string name;
|
||||
std::string fileName;
|
||||
int result_index;
|
||||
|
||||
AtlasImage ToAtlasImage(int id, float tw, float th, const std::vector<Data> &results) const;
|
||||
};
|
||||
|
||||
AtlasImage ToAtlasImage(int id, std::string_view name, float tw, float th, const std::vector<Data> &results);
|
||||
+1
-1
@@ -157,7 +157,7 @@ Draw::Texture *GenerateUIAtlas(Draw::DrawContext *draw, Atlas *atlas) {
|
||||
std::vector<AtlasImage> genAtlasImages;
|
||||
genAtlasImages.reserve(ARRAY_SIZE(imageDescs));
|
||||
for (int i = 0; i < ARRAY_SIZE(imageDescs); i++) {
|
||||
genAtlasImages.push_back(imageDescs[i].ToAtlasImage(resultIds[i], (float)dest.width(), (float)dest.height(), results));
|
||||
genAtlasImages.push_back(ToAtlasImage(resultIds[i], imageDescs[i].name, (float)dest.width(), (float)dest.height(), results));
|
||||
}
|
||||
|
||||
atlas->Clear();
|
||||
|
||||
@@ -670,7 +670,7 @@ int GenerateFromScript(const char *script_file, const char *atlas_name, bool hig
|
||||
// For each image
|
||||
AtlasImage *atlas_images = new AtlasImage[images.size()];
|
||||
for (int i = 0; i < (int)images.size(); i++) {
|
||||
atlas_images[i] = images[i].ToAtlasImage(images[i].result_index, (float)dest.width(), (float)dest.height(), results);
|
||||
atlas_images[i] = ToAtlasImage(images[i].result_index, images[i].name, (float)dest.width(), (float)dest.height(), results);
|
||||
}
|
||||
WriteCompressed(atlas_images, sizeof(AtlasImage), images.size(), meta);
|
||||
// For each font
|
||||
|
||||
Reference in new issue
Block a user