API CleanUp part 3

This commit is contained in:
MX 2023-05-22 03:45:17 +03:00
parent 03d8804209
commit aab4d2bd34
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83
8 changed files with 20 additions and 2910 deletions

View File

@ -90,7 +90,7 @@ void drawVLine(uint8_t x, int8_t start_y, int8_t end_y, uint8_t intensity, Canva
void setupDisplay(Canvas* canvas) {
memset(zbuffer, 0xff, 128);
display_buf = (uint8_t*)canvas_get_buffer(canvas);
display_buf = (uint8_t*)canvas->fb.tile_buf_ptr;
//display_buf = u8g2_GetBufferPtr(&canvas->fb);
}

View File

@ -11,8 +11,6 @@
//#include <notification/notification_messages.h>
//#include <stdlib.h>
#include <u8g2.h>
#include "FlipperZeroWiFiDeauthModuleDefines.h"
#define DEAUTH_APP_DEBUG 0
@ -192,8 +190,8 @@ static void esp8266_deauth_module_render_callback(Canvas* const canvas, void* ct
#endif // ENABLE_MODULE_POWER
break;
case ModuleActive: {
uint8_t* buffer = canvas_get_buffer(canvas);
app->m_canvasSize = canvas_get_buffer_size(canvas);
uint8_t* buffer = canvas->fb.tile_buf_ptr;
app->m_canvasSize = gui_get_framebuffer_size(app->m_gui);
memcpy(buffer, app->m_backBuffer, app->m_canvasSize);
} break;
default:

View File

@ -11,8 +11,6 @@
#include <notification/notification_messages.h>
#include <stdlib.h>
#include <u8g2.h>
#include "FlipperZeroWiFiModuleDefines.h"
#define WIFI_APP_DEBUG 0
@ -531,7 +529,7 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) {
//canvas_set_custom_u8g2_font(canvas, u8g2_font_inb27_mr);
canvas_set_custom_u8g2_font(canvas, u8g2_font_inb27_mr);
uint8_t fontHeight = canvas_current_font_height(canvas);
uint8_t fontWidth = u8g2_GetMaxCharWidth(&canvas->fb);
uint8_t fontWidth = canvas_current_font_width(canvas);
if(app->m_currentAccesspointDescription.m_rssi == NA) {
offsetX += floor(128 / 2) - fontWidth - 10;
@ -550,7 +548,7 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) {
//canvas_set_font(canvas, FontPrimary);
canvas_set_custom_u8g2_font(canvas, u8g2_font_7x13B_tr);
fontHeight = canvas_current_font_height(canvas);
fontWidth = u8g2_GetMaxCharWidth(&canvas->fb);
fontWidth = canvas_current_font_width(canvas);
offsetX = 5;
offsetY = 64 - 7 - fontHeight;

View File

@ -14,7 +14,6 @@ App(
"gui.h",
"icon_i.h",
"elements.h",
"canvas_i.h",
"view_dispatcher.h",
"view_stack.h",
"modules/button_menu.h",

View File

@ -100,6 +100,11 @@ uint8_t canvas_current_font_height(const Canvas* canvas) {
return font_height;
}
uint8_t canvas_current_font_width(const Canvas* canvas) {
furi_assert(canvas);
return (uint8_t)u8g2_GetMaxCharWidth(&canvas->fb);
}
const CanvasFontParameters* canvas_get_font_params(const Canvas* canvas, Font font) {
furi_assert(canvas);
furi_assert(font < FontTotalNumber);

View File

@ -120,6 +120,14 @@ uint8_t canvas_height(const Canvas* canvas);
*/
uint8_t canvas_current_font_height(const Canvas* canvas);
/** Get current font width
*
* @param canvas Canvas instance
*
* @return width in pixels.
*/
uint8_t canvas_current_font_width(const Canvas* canvas);
/** Get font parameters
*
* @param canvas Canvas instance

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,6 @@ env.Append(
"variant",
)
),
File("u8g2/u8g2.h"),
],
CPPDEFINES=[
'"M_MEMORY_FULL(x)=abort()"',