1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

Applications: Change static constexpr variables to constexpr

Function-local `static constexpr` variables can be `constexpr`. This
can reduce memory consumption, binary size, and offer additional
compiler optimizations.
This commit is contained in:
Lenny Maiorani 2022-02-09 17:45:15 -07:00 committed by Andreas Kling
parent 7012a5eb0b
commit 1dd70a6f49
10 changed files with 67 additions and 60 deletions

View file

@ -1,16 +1,38 @@
/*
* Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "PDFViewer.h"
#include <AK/Array.h>
#include <LibGUI/Action.h>
#include <LibGUI/Painter.h>
#include <LibPDF/Renderer.h>
static constexpr int PAGE_PADDING = 25;
static constexpr Array zoom_levels = {
17,
21,
26,
33,
41,
51,
64,
80,
100,
120,
144,
173,
207,
249,
299,
358,
430
};
PDFViewer::PDFViewer()
{
set_should_hide_unnecessary_scrollbars(true);
@ -147,7 +169,7 @@ void PDFViewer::timer_event(Core::TimerEvent&)
void PDFViewer::zoom_in()
{
if (m_zoom_level < number_of_zoom_levels - 1) {
if (m_zoom_level < zoom_levels.size() - 1) {
m_zoom_level++;
update();
}