LibGfx+LibIPC: Add Gfx::ShareableBitmap, a bitmap for easy IPC usage

With this patch, it's now possible to pass a Gfx::ShareableBitmap in an
IPC message. As long as the message itself is synchronous, the bitmap
will be adopted by the receiving end, and disowned by the sender nicely
without any accounting effort like we've had to do in the past.

Use this in NotificationServer to allow sending arbitrary bitmaps as
icons instead of paths-to-icons.
This commit is contained in:
Andreas Kling 2020-03-29 19:04:05 +02:00
commit 7cfe712f4d
Notes: sideshowbarker 2024-07-19 08:04:01 +09:00
17 changed files with 115 additions and 17 deletions

View file

@ -228,6 +228,7 @@ int main(int argc, char** argv)
dbg() << "#include <AK/OwnPtr.h>";
dbg() << "#include <LibGfx/Color.h>";
dbg() << "#include <LibGfx/Rect.h>";
dbg() << "#include <LibGfx/ShareableBitmap.h>";
dbg() << "#include <LibIPC/Decoder.h>";
dbg() << "#include <LibIPC/Encoder.h>";
dbg() << "#include <LibIPC/Endpoint.h>";
@ -362,6 +363,10 @@ int main(int argc, char** argv)
dbg() << " stream << rect.width();";
dbg() << " stream << rect.height();";
dbg() << " }";
} else if (parameter.type == "Gfx::ShareableBitmap") {
dbg() << " stream << m_" << parameter.name << ".shbuf_id();";
dbg() << " stream << m_" << parameter.name << ".width();";
dbg() << " stream << m_" << parameter.name << ".height();";
} else {
dbg() << " stream << m_" << parameter.name << ";";
}