Skip to content
Repos

DevPlaceApp

C++ 1.3 KB24 lines Opens in site

Directory Raw Download

#pragma once
// Spec: SPEC.md UX-IMG-02. Hard caps for remote image loading (RemoteImages). Every value is a static ceiling.
#include <cstddef>

namespace dp::spec {

struct ImageLimits {
  static constexpr std::size_t kMaxCacheBytes = 64u * 1024u * 1024u;  // decoded pixels held in the LRU
  static constexpr std::size_t kMaxEntries = 512;                     // cache + failure memo + in flight
  static constexpr int kMaxConcurrentLoads = 6;                       // downloads plus decodes in flight
  static constexpr std::size_t kMaxQueuedLoads = 256;                 // waiting for a free load slot
  static constexpr int kDecodeThreads = 2;
  static constexpr int kMaxDecodedDimension = 2048;                   // longest side after decode, larger is downscaled
  static constexpr std::size_t kMaxDownloadBytes = 16u * 1024u * 1024u;
  static constexpr double kRequestTimeoutSeconds = 20.0;
  static constexpr double kFailureCooldownSeconds = 30.0;
  static constexpr std::size_t kMaxUrlLength = 2048;
  static constexpr int kMinRasterPx = 16;                             // SVG raster size clamp
  static constexpr int kMaxRasterPx = 2048;
  static constexpr int kRasterBucketPx = 64;                          // requested sizes round up to this step
  static constexpr int kDefaultRasterPx = 512;
};

}  // namespace dp::spec
20.8ms