summaryrefslogtreecommitdiff
path: root/SharedGraphics/GraphicsBitmap.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-30 13:46:03 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-30 13:46:03 +0200
commitf4b190c58b5153c2f52ac610d1932dcce37ff712 (patch)
treeab98a491d48dabb634511cefc95315aa314b88db /SharedGraphics/GraphicsBitmap.cpp
parentd55ff4756a3e9f7bf48dfc86c52580dd7bd1279b (diff)
downloadserenity-f4b190c58b5153c2f52ac610d1932dcce37ff712.zip
PNGLoader: Tag the decoded bitmap with the source PNG path.
Diffstat (limited to 'SharedGraphics/GraphicsBitmap.cpp')
-rw-r--r--SharedGraphics/GraphicsBitmap.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/SharedGraphics/GraphicsBitmap.cpp b/SharedGraphics/GraphicsBitmap.cpp
index 16831acc84..160d39762f 100644
--- a/SharedGraphics/GraphicsBitmap.cpp
+++ b/SharedGraphics/GraphicsBitmap.cpp
@@ -20,8 +20,8 @@ GraphicsBitmap::GraphicsBitmap(Format format, const Size& size)
size_t size_in_bytes = size.area() * sizeof(RGBA32);
m_data = (RGBA32*)mmap(nullptr, size_in_bytes, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
ASSERT(m_data && m_data != (void*)-1);
- set_mmap_name(m_data, size_in_bytes, String::format("GraphicsBitmap [%dx%d]", width(), height()).characters());
m_needs_munmap = true;
+ set_mmap_name(String::format("GraphicsBitmap [%dx%d]", width(), height()).characters());
}
Retained<GraphicsBitmap> GraphicsBitmap::create_wrapper(Format format, const Size& size, RGBA32* data)
@@ -83,3 +83,9 @@ GraphicsBitmap::~GraphicsBitmap()
m_data = nullptr;
}
+void GraphicsBitmap::set_mmap_name(const String& name)
+{
+ ASSERT(m_needs_munmap);
+ size_t size_in_bytes = m_size.area() * sizeof(RGBA32);
+ ::set_mmap_name(m_data, size_in_bytes, name.characters());
+}