mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 07:57:46 +00:00
LibAccelGfx+LibWeb: Explicitly pass OpenGL context to Painter
Let's not assume there is one global OpenGL context because it might change once we will start creating >1 page inside single WebContent process or contexts for WebGL.
This commit is contained in:
parent
ed1ade0534
commit
161082e282
8 changed files with 25 additions and 20 deletions
|
@ -55,6 +55,12 @@ PageClient::PageClient(PageHost& owner, u64 id)
|
|||
client().async_did_invalidate_content_rect({ m_invalidation_rect.x().value(), m_invalidation_rect.y().value(), m_invalidation_rect.width().value(), m_invalidation_rect.height().value() });
|
||||
m_invalidation_rect = {};
|
||||
});
|
||||
|
||||
#ifdef HAS_ACCELERATED_GRAPHICS
|
||||
if (s_use_gpu_painter) {
|
||||
m_accelerated_graphics_context = AccelGfx::Context::create();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void PageClient::visit_edges(JS::Cell::Visitor& visitor)
|
||||
|
@ -169,7 +175,7 @@ void PageClient::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& ta
|
|||
|
||||
if (s_use_gpu_painter) {
|
||||
#ifdef HAS_ACCELERATED_GRAPHICS
|
||||
Web::Painting::PaintingCommandExecutorGPU painting_command_executor(target);
|
||||
Web::Painting::PaintingCommandExecutorGPU painting_command_executor(*m_accelerated_graphics_context, target);
|
||||
recording_painter.execute(painting_command_executor);
|
||||
#else
|
||||
static bool has_warned_about_configuration = false;
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
#include <LibWeb/PixelUnits.h>
|
||||
#include <WebContent/Forward.h>
|
||||
|
||||
#ifdef HAS_ACCELERATED_GRAPHICS
|
||||
# include <LibAccelGfx/Context.h>
|
||||
#endif
|
||||
|
||||
namespace WebContent {
|
||||
|
||||
class PageClient final : public Web::PageClient {
|
||||
|
@ -151,6 +155,10 @@ private:
|
|||
Web::CSS::PreferredColorScheme m_preferred_color_scheme { Web::CSS::PreferredColorScheme::Auto };
|
||||
|
||||
RefPtr<WebDriverConnection> m_webdriver;
|
||||
|
||||
#ifdef HAS_ACCELERATED_GRAPHICS
|
||||
OwnPtr<AccelGfx::Context> m_accelerated_graphics_context;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue