mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-01 03:47:05 +01:00
260dd0ca24
Adds support for the OnAcceleratedPaint callback. Verified to work on macOS and Windows. Linux support is present but not implemented for cefclient, so it is not verified to work. To test: Run `cefclient --off-screen-rendering-enabled --shared-texture-enabled`
58 lines
2.0 KiB
C++
58 lines
2.0 KiB
C++
// Copyright 2018 The Chromium Embedded Framework Authors. All rights
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
// can be found in the LICENSE file.
|
|
|
|
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_OSR_RENDER_HANDLER_WIN_GL_H_
|
|
#define CEF_TESTS_CEFCLIENT_BROWSER_OSR_RENDER_HANDLER_WIN_GL_H_
|
|
#pragma once
|
|
|
|
#include "tests/cefclient/browser/osr_render_handler_win.h"
|
|
#include "tests/cefclient/browser/osr_renderer.h"
|
|
|
|
namespace client {
|
|
|
|
class OsrRenderHandlerWinGL : public OsrRenderHandlerWin {
|
|
public:
|
|
OsrRenderHandlerWinGL(const OsrRendererSettings& settings, HWND hwnd);
|
|
~OsrRenderHandlerWinGL() override;
|
|
|
|
// Must be called immediately after object creation.
|
|
void Initialize(CefRefPtr<CefBrowser> browser);
|
|
|
|
void SetSpin(float spinX, float spinY) override;
|
|
void IncrementSpin(float spinDX, float spinDY) override;
|
|
bool IsOverPopupWidget(int x, int y) const override;
|
|
int GetPopupXOffset() const override;
|
|
int GetPopupYOffset() const override;
|
|
void OnPopupShow(CefRefPtr<CefBrowser> browser, bool show) override;
|
|
void OnPopupSize(CefRefPtr<CefBrowser> browser, const CefRect& rect) override;
|
|
void OnPaint(CefRefPtr<CefBrowser> browser,
|
|
CefRenderHandler::PaintElementType type,
|
|
const CefRenderHandler::RectList& dirtyRects,
|
|
const void* buffer,
|
|
int width,
|
|
int height) override;
|
|
void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
|
|
CefRenderHandler::PaintElementType type,
|
|
const CefRenderHandler::RectList& dirtyRects,
|
|
const CefAcceleratedPaintInfo& info) override;
|
|
|
|
private:
|
|
void Render() override;
|
|
|
|
void EnableGL();
|
|
void DisableGL();
|
|
|
|
// The below members are only accessed on the UI thread.
|
|
OsrRenderer renderer_;
|
|
HDC hdc_ = nullptr;
|
|
HGLRC hrc_ = nullptr;
|
|
bool painting_popup_ = false;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(OsrRenderHandlerWinGL);
|
|
};
|
|
|
|
} // namespace client
|
|
|
|
#endif // CEF_TESTS_CEFCLIENT_BROWSER_OSR_RENDER_HANDLER_WIN_GL_H_
|