From 7c4981799d4776f154d3efcf5bedee4ccd506e5a Mon Sep 17 00:00:00 2001 From: mikee47 Date: Mon, 5 Jun 2023 14:12:42 +0100 Subject: [PATCH] Blenders do not require transparent color --- src/MipiDisplay.cpp | 2 +- src/Renderer.cpp | 13 ++++++------- src/Surface.cpp | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/MipiDisplay.cpp b/src/MipiDisplay.cpp index c198818a..cb0d285e 100644 --- a/src/MipiDisplay.cpp +++ b/src/MipiDisplay.cpp @@ -281,7 +281,7 @@ bool MipiSurface::render(const Object& object, const Rect& location, std::unique case Object::Kind::FilledRect: { // Handle small transparent fills using display list auto obj = reinterpret_cast(object); - if(obj.radius != 0 || !obj.brush.isTransparent() || !isSmall(obj.rect)) { + if(obj.blender || obj.radius != 0 || !obj.brush.isTransparent() || !isSmall(obj.rect)) { break; } auto color = obj.brush.getPackedColor(PixelFormat::RGB565); diff --git a/src/Renderer.cpp b/src/Renderer.cpp index 1bb0e587..b261a41a 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -492,13 +492,12 @@ bool FilledRectRenderer::execute(Surface& surface) if(!buffer.status.readComplete) { return false; } - if(brush.isTransparent()) { + if(blender) { auto color = brush.getPackedColor(); - if(blender) { - blender->transform(buffer.format, color, buffer.data.get(), buffer.status.bytesRead); - } else { - BlendAlpha::blend(buffer.format, color, buffer.data.get(), buffer.status.bytesRead); - } + blender->transform(buffer.format, color, buffer.data.get(), buffer.status.bytesRead); + } else if(brush.isTransparent()) { + auto color = brush.getPackedColor(); + BlendAlpha::blend(buffer.format, color, buffer.data.get(), buffer.status.bytesRead); } else { buffer.status.bytesRead = brush.writePixels({buffer.r, buffer.r}, buffer.data.get(), buffer.r.w); } @@ -524,7 +523,7 @@ int FilledRectRenderer::queueRead(Surface& surface) auto w = std::min(blockSize.w, uint16_t(rect.w - pos.x)); auto h = std::min(blockSize.h, uint16_t(rect.h - pos.y)); buffer.r = Rect(rect.x + pos.x, rect.y + pos.y, w, h); - if(brush.isTransparent()) { + if(blender || brush.isTransparent()) { if(!surface.setAddrWindow(buffer.r)) { return -1; } diff --git a/src/Surface.cpp b/src/Surface.cpp index ff109064..3cfc802f 100644 --- a/src/Surface.cpp +++ b/src/Surface.cpp @@ -56,7 +56,7 @@ bool Surface::render(const Object& object, const Rect& location, std::unique_ptr case Object::Kind::FilledRect: { // Draw solid filled non-rounded rectangles auto obj = reinterpret_cast(object); - if(obj.radius != 0 || obj.brush.isTransparent()) { + if(obj.blender || obj.radius != 0 || obj.brush.isTransparent()) { break; } if(!obj.brush.isSolid() && !isSmall(obj.rect)) {