| 105 | } |
| 106 | |
| 107 | static 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 | |
| 120 | wf::buffer_reallocation_result_t wf::auxilliary_buffer_t::allocate(wf::dimensions_t size, float scale, |
| 121 | buffer_allocation_hints_t hints) |