mirror of
https://github.com/penpot/penpot.git
synced 2026-06-18 21:32:03 +00:00
Merge pull request #10243 from penpot/elenatorro-fix-docatlas-cap
🐛 Fix DocAtlas cap
This commit is contained in:
commit
585d6944fc
@ -9,7 +9,7 @@ const SHOW_WASM_INFO: u32 = 0x08;
|
||||
// Higher values pre-render more tiles, reducing empty squares during pan but using more memory.
|
||||
const VIEWPORT_INTEREST_AREA_THRESHOLD: i32 = 1;
|
||||
const MIN_DPR_VIEWPORT_INTEREST_AREA_THRESHOLD: i32 = 2;
|
||||
const MAX_BLOCKING_TIME_MS: i32 = 32;
|
||||
const MAX_BLOCKING_TIME_MS: i32 = 8;
|
||||
const NODE_BATCH_THRESHOLD: i32 = 3;
|
||||
const BLUR_DOWNSCALE_THRESHOLD: f32 = 8.0;
|
||||
const ANTIALIAS_THRESHOLD: f32 = 7.0;
|
||||
|
||||
@ -25,6 +25,7 @@ const TILE_DRAWABLE_RECT: IRect = IRect {
|
||||
right: TILE_MARGIN_SIZE + TILE_SIZE,
|
||||
bottom: TILE_MARGIN_SIZE + TILE_SIZE,
|
||||
};
|
||||
const DOC_ATLAS_MAX_DIM: i32 = 4096;
|
||||
|
||||
pub fn get_cache_size(viewbox: &Viewbox, interest: i32) -> skia::ISize {
|
||||
// First we retrieve the extended area of the viewport that we could render.
|
||||
@ -178,7 +179,10 @@ impl DocAtlas {
|
||||
|
||||
// Compute atlas scale needed to fit within the fixed texture cap.
|
||||
// Keep the highest possible scale (closest to 1.0) that still fits.
|
||||
let cap = gpu_state.max_texture_size().max(TILE_SIZE) as f32;
|
||||
let cap = gpu_state
|
||||
.max_texture_size()
|
||||
.clamp(TILE_SIZE, DOC_ATLAS_MAX_DIM) as f32;
|
||||
|
||||
let required_scale = (cap / doc_w).min(cap / doc_h).clamp(0.01, 1.0);
|
||||
|
||||
// Never upscale the atlas (it would add blur and churn).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user