MCPcopy Create free account
hub / github.com/WayfireWM/wayfire / sanitize_buffer_size

Function sanitize_buffer_size

src/render.cpp:107–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107static wf::dimensions_t sanitize_buffer_size(wf::dimensions_t size, float max_allowed_size)
108{
109 if ((size.width > max_allowed_size) || (size.height > max_allowed_size))
110 {
111 LOGW("Attempting to allocate a buffer which is too large ", size, "!");
112 float scale = std::min(max_allowed_size / size.width, max_allowed_size / size.height);
113 size.width = std::ceil(size.width * scale);
114 size.height = std::ceil(size.height * scale);
115 }
116
117 return size;
118}
119
120wf::buffer_reallocation_result_t wf::auxilliary_buffer_t::allocate(wf::dimensions_t size, float scale,
121 buffer_allocation_hints_t hints)

Callers 1

allocateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected