@@ -99,7 +99,8 @@ menu_render menu_render::create(int x, int y, menu menu, bool run_js) {
9999 js::menu_info_basic_js menu_info{
100100 .menu = std::make_shared<js::menu_controller>(menu_wid->menu_wid ),
101101 .context = current_js_context,
102- .screenside_button = std::make_shared<js::screenside_button_controller>(menu_wid),
102+ .screenside_button =
103+ std::make_shared<js::screenside_button_controller>(menu_wid),
103104 };
104105
105106 if (run_js) {
@@ -142,48 +143,4 @@ menu_render &menu_render::operator=(menu_render &&t) {
142143 selected_menu = std::move (t.selected_menu );
143144 return *this ;
144145}
145- // struct NVGcontext {
146- // NVGparams params;
147- // float* commands;
148- // int ccommands;
149- // int ncommands;
150- // float commandx, commandy;
151- // NVGstate states[NVG_MAX_STATES];
152- // int nstates;
153- // NVGpathCache* cache;
154- // float tessTol;
155- // float distTol;
156- // float fringeWidth;
157- // float devicePxRatio;
158- // struct FONScontext* fs;
159- // int fontImages[NVG_MAX_FONTIMAGES];
160- // int fontImageIdx;
161- // int drawCallCount;
162- // int fillTriCount;
163- // int strokeTriCount;
164- // int textTriCount;
165- // };
166- // HACK: By finding the third readable pointer from NVGcontext, we can get the FONScontext
167- struct FONScontext ;
168- extern " C" int fonsResetAtlas (FONScontext* stash, int width, int height);
169- void menu_render::reset_fons_cache () {
170- if (!rt)
171- return ;
172- auto nvg = rt->nvg ;
173- char * ptr = reinterpret_cast <char *>(nvg);
174- size_t offset = sizeof (NVGparams) + sizeof (float *);
175- int ptr_count = 0 ;
176- for (size_t i = 0 ; i < 1024 ; i += 4 ) {
177- void **p = reinterpret_cast <void **>(ptr + offset + i);
178- if (is_memory_readable (*p)) {
179- ptr_count++;
180- if (ptr_count == 2 ) {
181- auto fons = reinterpret_cast <struct FONScontext *>(*p);
182- fonsResetAtlas (fons, 512 , 512 );
183- return ;
184- }
185- }
186- }
187-
188- }
189146}; // namespace mb_shell
0 commit comments