Skip to content

Commit

Permalink
Blenders do not require transparent color
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Oct 20, 2023
1 parent e95df30 commit d33c72f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/MipiDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const FilledRectObject&>(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);
Expand Down
13 changes: 6 additions & 7 deletions src/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const FilledRectObject&>(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)) {
Expand Down

0 comments on commit d33c72f

Please sign in to comment.