Skip to content

Commit

Permalink
Replace mmap code with Qt's implementation.
Browse files Browse the repository at this point in the history
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
  • Loading branch information
agatti committed Feb 15, 2024
1 parent 50a6ae7 commit 8d4c5c6
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 225 deletions.
5 changes: 1 addition & 4 deletions src/Core/Image/Manipulation/ScalingManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,7 @@ namespace degate
if (project_type == ProjectType::Normal)
{
// Create a new image directory name.
char dir_name[PATH_MAX];
snprintf(dir_name, sizeof(dir_name), "scaling_%d.dimg", i);

path = join_pathes(images[1]->get_path(), std::string(dir_name));
path = join_pathes(images[1]->get_path(), QString("scaling_%1.dimg").arg(i).toStdString());

// Check if need to create scaled images
debug(TM, "create scaled image in %s for scaling factor %d?", path.c_str(), i);
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Image/TileCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ namespace degate
GET_CLOCK(now);

// Create a file name from tile number
char filename[PATH_MAX];
snprintf(filename, sizeof(filename), "%d_%d.dat", x, y);
auto filename = QString("%1_%2.dat").arg(x).arg(y).toStdString();

// If filename/object is not in cache, load the tile
typename cache_type::const_iterator iter = cache.find(filename);
Expand Down
8 changes: 3 additions & 5 deletions src/Core/LogicModel/LogicModelHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ void load_tile(const QRgb* rba_data,
unsigned int tile_y = global_tile_y + local_tile_y;

// Create a file name from tile number.
char filename[PATH_MAX];
snprintf(filename, sizeof(filename), "%d_%d.dat", tile_x, tile_y);
auto filename = QString("%1_%2.dat").arg(tile_x).arg(tile_y).toStdString();

auto data = new BackgroundImage::pixel_type[tile_size * tile_size];
memset(data,
Expand Down Expand Up @@ -351,9 +350,8 @@ void create_scaled_background_images(const BackgroundImage_shptr& bg_image, unsi
h >>= 1u;

// create a new image
char dir_name[PATH_MAX];
snprintf(dir_name, sizeof(dir_name), "scaling_%d.dimg", i);
std::string dir_path = join_pathes(bg_image->get_path(), std::string(dir_name));
auto dir_path = join_pathes(bg_image->get_path(), QString("scaling_%1.dimg").arg(i).toStdString());

create_directory(dir_path);

reader.device()->seek(0);
Expand Down
Loading

0 comments on commit 8d4c5c6

Please sign in to comment.