1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-19 19:16:34 +00:00

Correct bias to the left.

This commit is contained in:
Thomas Harte
2025-10-16 11:50:32 -04:00
parent 95395132f0
commit e43ec7d549
3 changed files with 16 additions and 7 deletions
+12 -3
View File
@@ -112,10 +112,19 @@ void CRT::set_dynamic_framing(
float minimum_scale
) {
framing_ = Framing::Dynamic;
framing_bounds_ = initial;
framing_bounds_.scale(0.95f / initial.size.width, 0.95f / initial.size.height);
framing_bounds_ = framing_bounds_ & Display::Rect(0.025f, 0.025f, 0.95f, 0.95f);
// As full constraints, pick at most 95% of the visible area, with the same centre.
const float centres[] = {
initial.origin.x + initial.size.width * 0.5f,
initial.origin.y + initial.size.height * 0.5f,
};
const float width = std::min(1.0f - centres[0], centres[0]) + max_centre_offset_x * 0.5f;
const float height = std::min(1.0f - centres[1], centres[1]) + max_centre_offset_y * 0.5f;
framing_bounds_ = Display::Rect(
centres[0] - width, centres[1] - height,
width * 2.0f, height * 2.0f
);
minimum_scale_ = minimum_scale;
max_offsets_[0] = max_centre_offset_x;
+2 -2
View File
@@ -105,11 +105,11 @@ private:
//
// Rects graduate to candidates only after exiting the stable filter, so the true number of
// frames considered at any given time is the product of the two sizes.
static constexpr int CandidateHistorySize = 120;
static constexpr int CandidateHistorySize = 12;
RectHistory<CandidateHistorySize> candidates_;
// At startup, look for a small number of sequential but consistent frames.
static constexpr int StableFilterSize = 4;
static constexpr int StableFilterSize = 10;
RectHistory<StableFilterSize> stable_filter_;
bool did_first_read_ = false;
+2 -2
View File
@@ -48,8 +48,8 @@ struct Rect {
compare(size.height, rhs.size.height);
}
constexpr Rect() : origin({0.0f, 0.0f}), size({1.0f, 1.0f}) {}
constexpr Rect(float x, float y, float width, float height) :
constexpr Rect() noexcept : origin({0.0f, 0.0f}), size({1.0f, 1.0f}) {}
constexpr Rect(const float x, const float y, const float width, const float height) noexcept :
origin({x, y}), size({width, height}) {}
bool empty() const {