Cleanup
This commit is contained in:
+1
-1
@@ -2601,7 +2601,7 @@ listed(const vector<Widget *> &list, Widget *w)
|
||||
return find(list.begin(), list.end(), w) != list.end();
|
||||
}
|
||||
|
||||
bool
|
||||
static bool
|
||||
listed_id(const vector<QAccessible::Id> &list, QAccessible::Id id)
|
||||
{
|
||||
return find(list.begin(), list.end(), id) != list.end();
|
||||
|
||||
+2
-8
@@ -991,7 +991,6 @@ apply_thumb_gpu(Browser &b, GpuFinish finish, dawn::ThumbScaler::Result res)
|
||||
if (res.failed || res.outputs.empty()) {
|
||||
if (finish.reservation)
|
||||
b.thumbnailer_.cancel_bundle(finish.reservation);
|
||||
f.progress.reservation = 0;
|
||||
f.progress.pending = false;
|
||||
f.progress.regen_failed =
|
||||
!f.pixels.ram.empty() && f.progress.interim;
|
||||
@@ -1026,13 +1025,11 @@ apply_thumb_gpu(Browser &b, GpuFinish finish, dawn::ThumbScaler::Result res)
|
||||
}
|
||||
if (!b.thumbnailer_.publish_bundle(finish.reservation, bundle)) {
|
||||
b.thumbnailer_.cancel_bundle(finish.reservation);
|
||||
f.progress.reservation = 0;
|
||||
f.progress.pending = false;
|
||||
f.progress.failed = f.pixels.ram.empty();
|
||||
b.thumb_inflight_.erase(f.path);
|
||||
break;
|
||||
}
|
||||
f.progress.reservation = 0;
|
||||
f.progress.persistent_checked = true;
|
||||
f.progress.generation_needed = false;
|
||||
f.progress.regen_failed = false;
|
||||
@@ -1265,12 +1262,10 @@ enqueue_thumbs(Browser &b)
|
||||
bundle_reservation_bytes(target_tier));
|
||||
if (!job.reservation)
|
||||
continue;
|
||||
f.progress.reservation = job.reservation;
|
||||
}
|
||||
Thumbnailer *thumbnailer = &b.thumbnailer_;
|
||||
const auto client = b.thumbnail_client_;
|
||||
Browser *browser = &b;
|
||||
const bool regeneration = job.skip_cache;
|
||||
const auto reservation = job.reservation;
|
||||
if (thumbnailer->submit(
|
||||
client, job.gen, priority,
|
||||
@@ -1280,11 +1275,10 @@ enqueue_thumbs(Browser &b)
|
||||
*thumbnailer, client, browser, std::move(job));
|
||||
},
|
||||
f.path)) {
|
||||
b.thumb_inflight_[f.path] = {b.thumb_gen_, f.mtime, f.size,
|
||||
target_tier, priority, regeneration};
|
||||
b.thumb_inflight_[f.path] = {
|
||||
b.thumb_gen_, f.mtime, f.size, target_tier, priority};
|
||||
} else if (reservation) {
|
||||
b.thumbnailer_.cancel_bundle(reservation);
|
||||
f.progress.reservation = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,7 +70,6 @@ struct Browser : Widget {
|
||||
// What this file still owes the current generation. All of it is
|
||||
// scheduling state, so a new generation resets the lot.
|
||||
struct Progress {
|
||||
Thumbnailer::Reservation reservation = 0;
|
||||
bool pending = false;
|
||||
bool interim = false;
|
||||
bool persistent_checked = false;
|
||||
@@ -105,7 +104,6 @@ struct Browser : Widget {
|
||||
uint64_t size = 0;
|
||||
int tier = 0;
|
||||
Thumbnailer::Priority priority = Thumbnailer::Priority::Dimensions;
|
||||
bool regeneration = false;
|
||||
};
|
||||
|
||||
Kit &kit_;
|
||||
|
||||
@@ -35,7 +35,6 @@ namespace dn
|
||||
|
||||
Sidebar::Sidebar(unique_ptr<Widget> child)
|
||||
{
|
||||
this->content = child.get();
|
||||
this->fill = Fill::Panel;
|
||||
this->hittable = true;
|
||||
if (child)
|
||||
|
||||
@@ -111,8 +111,6 @@ void dialog_settings(Kit &kit, SettingsDraft draft,
|
||||
std::function<void(const SettingsDraft &)> on_save);
|
||||
|
||||
struct Sidebar : Panel {
|
||||
Widget *content = nullptr;
|
||||
|
||||
explicit Sidebar(std::unique_ptr<Widget> child);
|
||||
bool key(Kit &kit, const Key &ev) override;
|
||||
};
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
+1
-1
@@ -1518,7 +1518,7 @@ pan_by(Viewer &v, double dx, double dy)
|
||||
request_render(v);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
snap_pan_to_pixels(float *pan, float disp, float vp, float scale)
|
||||
{
|
||||
if (!pan || scale <= 0.f || disp <= 0.f || vp <= 0.f)
|
||||
|
||||
+52
-49
@@ -39,6 +39,56 @@ using namespace std;
|
||||
namespace dn
|
||||
{
|
||||
|
||||
// --- Unicode -----------------------------------------------------------------
|
||||
|
||||
// UTF-16 offsets that sit on a grapheme cluster: a surrogate pair or a
|
||||
// combining mark is never split. before/after walk to the neighbouring
|
||||
// cluster; at_or_* stay put when already on a boundary.
|
||||
static int
|
||||
grapheme_before(const QString &text, int at)
|
||||
{
|
||||
if (at <= 0)
|
||||
return 0;
|
||||
QTextBoundaryFinder finder(QTextBoundaryFinder::Grapheme, text);
|
||||
finder.setPosition(min(at, int(text.size())));
|
||||
const auto prev = finder.toPreviousBoundary();
|
||||
return prev < 0 ? 0 : int(prev);
|
||||
}
|
||||
|
||||
static int
|
||||
grapheme_after(const QString &text, int at)
|
||||
{
|
||||
const int end = int(text.size());
|
||||
if (at >= end)
|
||||
return end;
|
||||
QTextBoundaryFinder finder(QTextBoundaryFinder::Grapheme, text);
|
||||
finder.setPosition(max(at, 0));
|
||||
const auto next = finder.toNextBoundary();
|
||||
return next < 0 ? end : int(next);
|
||||
}
|
||||
|
||||
static int
|
||||
grapheme_at_or_before(const QString &text, int at)
|
||||
{
|
||||
at = clamp(at, 0, int(text.size()));
|
||||
QTextBoundaryFinder finder(QTextBoundaryFinder::Grapheme, text);
|
||||
finder.setPosition(at);
|
||||
if (finder.isAtBoundary())
|
||||
return at;
|
||||
return grapheme_before(text, at);
|
||||
}
|
||||
|
||||
static int
|
||||
grapheme_at_or_after(const QString &text, int at)
|
||||
{
|
||||
at = clamp(at, 0, int(text.size()));
|
||||
QTextBoundaryFinder finder(QTextBoundaryFinder::Grapheme, text);
|
||||
finder.setPosition(at);
|
||||
if (finder.isAtBoundary())
|
||||
return at;
|
||||
return grapheme_after(text, at);
|
||||
}
|
||||
|
||||
// --- Atlas -------------------------------------------------------------------
|
||||
|
||||
constexpr int kAtlasStart = 512;
|
||||
@@ -146,8 +196,6 @@ resize_cursor(Qt::Edges edges)
|
||||
return Qt::ArrowCursor;
|
||||
}
|
||||
|
||||
constexpr float kDialogPad = 16.f;
|
||||
|
||||
static Kit::Packed
|
||||
pack_or_grow(Kit &kit, int width, int height)
|
||||
{
|
||||
@@ -983,53 +1031,6 @@ Label::mnemonic_key() const
|
||||
constexpr float kCaretBlinkMs = 530.f;
|
||||
constexpr float kEntryPadY = 3.f;
|
||||
|
||||
// Both walk whole grapheme clusters, so that combining marks and surrogate
|
||||
// pairs never get split down the middle.
|
||||
int
|
||||
grapheme_before(const QString &text, int at)
|
||||
{
|
||||
if (at <= 0)
|
||||
return 0;
|
||||
QTextBoundaryFinder finder(QTextBoundaryFinder::Grapheme, text);
|
||||
finder.setPosition(min(at, int(text.size())));
|
||||
const auto prev = finder.toPreviousBoundary();
|
||||
return prev < 0 ? 0 : int(prev);
|
||||
}
|
||||
|
||||
int
|
||||
grapheme_after(const QString &text, int at)
|
||||
{
|
||||
const int end = int(text.size());
|
||||
if (at >= end)
|
||||
return end;
|
||||
QTextBoundaryFinder finder(QTextBoundaryFinder::Grapheme, text);
|
||||
finder.setPosition(max(at, 0));
|
||||
const auto next = finder.toNextBoundary();
|
||||
return next < 0 ? end : int(next);
|
||||
}
|
||||
|
||||
int
|
||||
grapheme_at_or_before(const QString &text, int at)
|
||||
{
|
||||
at = clamp(at, 0, int(text.size()));
|
||||
QTextBoundaryFinder finder(QTextBoundaryFinder::Grapheme, text);
|
||||
finder.setPosition(at);
|
||||
if (finder.isAtBoundary())
|
||||
return at;
|
||||
return grapheme_before(text, at);
|
||||
}
|
||||
|
||||
int
|
||||
grapheme_at_or_after(const QString &text, int at)
|
||||
{
|
||||
at = clamp(at, 0, int(text.size()));
|
||||
QTextBoundaryFinder finder(QTextBoundaryFinder::Grapheme, text);
|
||||
finder.setPosition(at);
|
||||
if (finder.isAtBoundary())
|
||||
return at;
|
||||
return grapheme_after(text, at);
|
||||
}
|
||||
|
||||
// Word motion walks over the run of word characters to its far side. Which
|
||||
// side that is differs: AppKit text fields stop at the end of the word going
|
||||
// forwards, everyone else at the start of the next one.
|
||||
@@ -2777,6 +2778,8 @@ Popup::key(Kit &kit, const Key &ev)
|
||||
|
||||
// --- Dialog ------------------------------------------------------------------
|
||||
|
||||
constexpr float kDialogPad = 16.f;
|
||||
|
||||
Dialog::Dialog()
|
||||
{
|
||||
this->pad_x = kDialogPad;
|
||||
|
||||
@@ -419,14 +419,6 @@ struct Label : Widget {
|
||||
QString tip_key() const override { return this->tip_accel; }
|
||||
};
|
||||
|
||||
// UTF-16 offsets that sit on a grapheme cluster: a surrogate pair or a
|
||||
// combining mark is never split. before/after walk to the neighbouring
|
||||
// cluster; at_or_* stay put when already on a boundary.
|
||||
int grapheme_before(const QString &text, int at);
|
||||
int grapheme_after(const QString &text, int at);
|
||||
int grapheme_at_or_before(const QString &text, int at);
|
||||
int grapheme_at_or_after(const QString &text, int at);
|
||||
|
||||
// A single-line text field. The selection runs from the anchor to the caret,
|
||||
// and is empty when they meet; every committed edit collapses it. It never
|
||||
// coexists with a preedit: composition starts by replacing it.
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace dn
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
//
|
||||
|
||||
#include <dawn-config.h>
|
||||
|
||||
#include "xdg.hpp"
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -15,7 +13,6 @@
|
||||
#include <QFileInfo>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <algorithm>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
//
|
||||
|
||||
#include <dawn-config.h>
|
||||
|
||||
#include "gettext.hpp"
|
||||
#include "libdn-loaders.hpp"
|
||||
#include "libdn.hpp"
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
// Deliberately not advertising support elsewhere, as with Core Graphics PDF.
|
||||
|
||||
#include <dawn-config.h>
|
||||
|
||||
#include "gettext.hpp"
|
||||
#include "libdn-loaders.hpp"
|
||||
#include "libdn.hpp"
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <cstring>
|
||||
#include <new>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include <dawn-config.h>
|
||||
|
||||
#include "gettext.hpp"
|
||||
#include "libdn-loaders.hpp"
|
||||
#include "libdn.hpp"
|
||||
@@ -184,7 +182,6 @@ struct WuffsLoadContext {
|
||||
|
||||
const OpenContext *octx = nullptr; ///< Caller-supplied context
|
||||
shared_ptr<Cmm> cmm; ///< CMM context, never null
|
||||
Profile *target = nullptr; ///< Target device profile, if any
|
||||
shared_ptr<Profile> source; ///< Source colour profile, if any
|
||||
|
||||
ImagePtr result; ///< The resulting image
|
||||
@@ -514,7 +511,6 @@ open_wuffs(wuffs_base__image_decoder *dec, span<const uint8_t> data,
|
||||
ctx.src = &src;
|
||||
ctx.octx = &octx;
|
||||
ctx.cmm = cmm_or_default(octx);
|
||||
ctx.target = octx.screen_profile.get();
|
||||
|
||||
wuffs_base__image_decoder__set_report_metadata(
|
||||
ctx.dec, WUFFS_BASE__FOURCC__EXIF, true);
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
//
|
||||
|
||||
#include <dawn-config.h>
|
||||
|
||||
#include "gettext.hpp"
|
||||
#include "libdn-loaders.hpp"
|
||||
#include "libdn.hpp"
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "thumb-reduce-spv.h"
|
||||
#include "thumb-scale-h-spv.h"
|
||||
#include "thumb-scale-v-spv.h"
|
||||
#include "vk-device.hpp"
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
@@ -175,7 +174,6 @@ struct Waiter {
|
||||
uint64_t user = 0;
|
||||
ThumbScaler::Priority priority = ThumbScaler::Priority::Maintenance;
|
||||
uint64_t sequence = 0;
|
||||
size_t bytes = 0;
|
||||
};
|
||||
|
||||
struct Session {
|
||||
@@ -234,7 +232,7 @@ struct ThumbScaler::Impl {
|
||||
VkPhysicalDevice phys = VK_NULL_HANDLE;
|
||||
VkDevice device = VK_NULL_HANDLE;
|
||||
VkQueue queue = VK_NULL_HANDLE;
|
||||
uint32_t queue_family = 0, max_image_dim = 0;
|
||||
uint32_t max_image_dim = 0;
|
||||
uint64_t max_storage_range = 0, alignment = 256;
|
||||
VkCommandPool command_pool = VK_NULL_HANDLE;
|
||||
VkDescriptorSetLayout descriptor_layout = VK_NULL_HANDLE;
|
||||
@@ -501,7 +499,7 @@ claim(
|
||||
if (canceled(job))
|
||||
return false;
|
||||
|
||||
Waiter waiter{job.user, current_priority(job), e.next_waiter++, bytes};
|
||||
Waiter waiter{job.user, current_priority(job), e.next_waiter++};
|
||||
if (!e.next_waiter)
|
||||
e.next_waiter = 1;
|
||||
e.waiters.push_back(&waiter);
|
||||
@@ -1166,7 +1164,6 @@ ThumbScaler::init(VkPhysicalDevice phys, VkDevice device, VkQueue queue,
|
||||
e.phys = phys;
|
||||
e.device = device;
|
||||
e.queue = queue;
|
||||
e.queue_family = family;
|
||||
VkPhysicalDeviceProperties props{};
|
||||
vkGetPhysicalDeviceProperties(phys, &props);
|
||||
e.max_image_dim = props.limits.maxImageDimension2D;
|
||||
|
||||
Reference in New Issue
Block a user