MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / getScreenSafeArea

Method getScreenSafeArea

src/components/UITheme.cpp:74–104  ·  view source on GitHub ↗

Screen area excluding the button hints

Source from the content-addressed store, hash-verified

72
73// Screen area excluding the button hints
74Rect UITheme::getScreenSafeArea(const GfxRenderer& renderer, bool hasFrontButtonHints, bool hasSideButtonHints) {
75 auto orientation = renderer.getOrientation();
76 const int screenWidth = renderer.getScreenWidth();
77 const int screenHeight = renderer.getScreenHeight();
78 Rect safeArea = Rect{0, 0, screenWidth, screenHeight};
79 switch (orientation) {
80 case GfxRenderer::Orientation::Portrait:
81 if (hasFrontButtonHints) {
82 safeArea.height -= currentMetrics->buttonHintsHeight;
83 }
84 break;
85 case GfxRenderer::Orientation::LandscapeClockwise:
86 if (hasFrontButtonHints) {
87 safeArea.x += currentMetrics->buttonHintsHeight;
88 safeArea.width -= currentMetrics->buttonHintsHeight;
89 }
90 break;
91 case GfxRenderer::Orientation::PortraitInverted:
92 if (hasFrontButtonHints) {
93 safeArea.y += currentMetrics->buttonHintsHeight;
94 safeArea.height -= currentMetrics->buttonHintsHeight;
95 }
96 break;
97 case GfxRenderer::Orientation::LandscapeCounterClockwise:
98 if (hasFrontButtonHints) {
99 safeArea.width -= currentMetrics->buttonHintsHeight;
100 }
101 break;
102 }
103 return safeArea;
104}
105
106std::string UITheme::getCoverThumbPath(std::string coverBmpPath, int coverHeight) {
107 size_t pos = coverBmpPath.find("[HEIGHT]", 0);

Callers 5

renderMethod · 0.80
renderMethod · 0.80
renderMethod · 0.80
renderMethod · 0.80
renderMethod · 0.80

Calls 3

getOrientationMethod · 0.80
getScreenWidthMethod · 0.80
getScreenHeightMethod · 0.80

Tested by

no test coverage detected