1 // Copyright 2018 The Chromium Embedded Framework Authors. All rights 2 // reserved. Use of this source code is governed by a BSD-style license that 3 // can be found in the LICENSE file. 4 5 #ifndef CEF_TESTS_CEFCLIENT_BROWSER_OSR_RENDER_HANDLER_WIN_GL_H_ 6 #define CEF_TESTS_CEFCLIENT_BROWSER_OSR_RENDER_HANDLER_WIN_GL_H_ 7 #pragma once 8 9 #include "tests/cefclient/browser/osr_render_handler_win.h" 10 #include "tests/cefclient/browser/osr_renderer.h" 11 12 namespace client { 13 14 class OsrRenderHandlerWinGL : public OsrRenderHandlerWin { 15 public: 16 OsrRenderHandlerWinGL(const OsrRendererSettings& settings, HWND hwnd); 17 virtual ~OsrRenderHandlerWinGL(); 18 19 // Must be called immediately after object creation. 20 void Initialize(CefRefPtr<CefBrowser> browser); 21 22 void SetSpin(float spinX, float spinY) override; 23 void IncrementSpin(float spinDX, float spinDY) override; 24 bool IsOverPopupWidget(int x, int y) const override; 25 int GetPopupXOffset() const override; 26 int GetPopupYOffset() const override; 27 void OnPopupShow(CefRefPtr<CefBrowser> browser, bool show) override; 28 void OnPopupSize(CefRefPtr<CefBrowser> browser, const CefRect& rect) override; 29 void OnPaint(CefRefPtr<CefBrowser> browser, 30 CefRenderHandler::PaintElementType type, 31 const CefRenderHandler::RectList& dirtyRects, 32 const void* buffer, 33 int width, 34 int height) override; 35 void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser, 36 CefRenderHandler::PaintElementType type, 37 const CefRenderHandler::RectList& dirtyRects, 38 void* share_handle) override; 39 40 private: 41 void Render() override; 42 43 void EnableGL(); 44 void DisableGL(); 45 46 // The below members are only accessed on the UI thread. 47 OsrRenderer renderer_; 48 HDC hdc_; 49 HGLRC hrc_; 50 bool painting_popup_; 51 52 DISALLOW_COPY_AND_ASSIGN(OsrRenderHandlerWinGL); 53 }; 54 55 } // namespace client 56 57 #endif // CEF_TESTS_CEFCLIENT_BROWSER_OSR_RENDER_HANDLER_WIN_GL_H_ 58