remove reserve call on item vector

This commit is contained in:
frank 2021-06-29 17:17:50 -04:00
parent cc9aa231ff
commit a482fa0a80
6 changed files with 2 additions and 19 deletions

View File

@ -37,7 +37,7 @@
{ {
"json-save": true, "json-save": true,
"json-save-directory": "local/scans", "json-save-directory": "local/scans",
"barcode": "", "barcode": "1703543090000",
"capture-device": "/dev/video0" "capture-device": "/dev/video0"
}, },
"api": "api":

@ -1 +1 @@
Subproject commit 95a1e6b5b126af2541c7ea0d0e978f021cea2018 Subproject commit 17adaed169c40536cb9b25425c64712b1d0f74d1

View File

@ -27,12 +27,6 @@ void Item::add_image_texture(std::shared_ptr<SDL_Texture> texture)
image_textures.push_back(texture); image_textures.push_back(texture);
} }
void Item::destroy_texture(SDL_Texture* texture)
{
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "destroying texture %p", texture);
SDL_DestroyTexture(texture);
}
const std::vector<std::shared_ptr<SDL_Texture>>& Item::get_image_textures() const const std::vector<std::shared_ptr<SDL_Texture>>& Item::get_image_textures() const
{ {
return image_textures; return image_textures;
@ -88,10 +82,3 @@ void Item::increment_image_index(int increment)
{ {
current_image_index = sfw::mod(current_image_index + increment, static_cast<int>(get_image_textures().size())); current_image_index = sfw::mod(current_image_index + increment, static_cast<int>(get_image_textures().size()));
} }
Item::~Item()
{
std::stringstream message;
message << "destroying item " << this;
debug(message.str());
}

View File

@ -19,7 +19,6 @@ private:
std::string brand_name = "", product_name = "", upc = ""; std::string brand_name = "", product_name = "", upc = "";
int current_image_index = 0; int current_image_index = 0;
void set_text_property(const std::string&, std::string&, const std::string&); void set_text_property(const std::string&, std::string&, const std::string&);
static void destroy_texture(SDL_Texture*);
/* /*
* add properties: ingredients, protein weight, nutrition grade, popularity, "serving unit", keywords, * add properties: ingredients, protein weight, nutrition grade, popularity, "serving unit", keywords,
@ -40,7 +39,6 @@ public:
const std::string& get_upc() const; const std::string& get_upc() const;
std::string get_full_name() const; std::string get_full_name() const;
void increment_image_index(int = 1); void increment_image_index(int = 1);
virtual ~Item();
}; };

View File

@ -49,7 +49,6 @@ Pudding::Pudding()
image_scanner.set_config(zbar::ZBAR_NONE, zbar::ZBAR_CFG_ENABLE, 1); image_scanner.set_config(zbar::ZBAR_NONE, zbar::ZBAR_CFG_ENABLE, 1);
/* use sdl context for now */ /* use sdl context for now */
load_sdl_context(); load_sdl_context();
items.reserve(10);
} }
/* Respond to command events */ /* Respond to command events */

View File

@ -17,7 +17,6 @@
#include "opencv2/imgproc.hpp" #include "opencv2/imgproc.hpp"
#include "zbar.h" #include "zbar.h"
#include "Game.hpp" #include "Game.hpp"
#include "Sprite.hpp"
#include "Color.hpp" #include "Color.hpp"
#include "extension.hpp" #include "extension.hpp"
#include "Item.hpp" #include "Item.hpp"