7 namespace online_image {
9 static const char *
const TAG =
"online_image.decoder";
19 auto width = std::min(this->
image_->
buffer_width_, static_cast<int>(std::ceil((x + w) * this->x_scale_)));
20 auto height = std::min(this->
image_->
buffer_height_, static_cast<int>(std::ceil((y + h) * this->y_scale_)));
21 for (
int i = x * this->
x_scale_; i < width; i++) {
22 for (
int j = y * this->
y_scale_; j < height; j++) {
32 ESP_LOGE(TAG,
"Initial allocation of download buffer failed!");
38 if (offset > this->
size_) {
39 ESP_LOGE(TAG,
"Tried to access beyond download buffer bounds!!!");
54 if (this->
size_ >= size) {
65 ESP_LOGE(TAG,
"allocation of %zu bytes failed. Biggest block in heap: %zu Bytes", size,
void draw_pixel_(int x, int y, Color color)
Draw a pixel into the buffer.
size_t get_max_free_block_size() const
Return the maximum size block this allocator could allocate.
int buffer_width_
Actual width of the current image.
DownloadBuffer(size_t size)
size_t resize(size_t size)
int buffer_height_
Actual height of the current image.
RAMAllocator< uint8_t > allocator_
size_t resize_(int width, int height)
Resize the image buffer to the requested dimensions.
void deallocate(T *p, size_t n)
void draw(int x, int y, int w, int h, const Color &color)
Fill a rectangle on the display_buffer using the defined color.
bool set_size(int width, int height)
Request the image to be resized once the actual dimensions are known.
uint8_t * data(size_t offset=0)
size_t unread_
Total number of downloaded bytes not yet read.
Implementation of SPI Controller mode.