HumanRender/human_render/CEF/OsrRenderHandlerWinNative.h
2024-12-20 01:46:41 +08:00

56 lines
1.8 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.
#pragma once
#include "CEF/OsrRenderHandlerWin.h"
class OsrRenderHandlerWinNative : public OsrRenderHandlerWin {
public:
OsrRenderHandlerWinNative(const OsrRendererSettings& settings, HWND hwnd);
virtual ~OsrRenderHandlerWinNative();
// 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,
void* share_handle) override;
private:
void Render() override;
CefRect GetPopupRectInWebView(const CefRect& original_rect);
// The below members are only accessed on the UI thread.
HDC hdc_;
HGLRC hrc_;
bool painting_popup_;
int view_width_;
int view_height_;
CefRect popup_rect_;
CefRect original_popup_rect_;
float spin_x_;
float spin_y_;
CefRect update_rect_;
DISALLOW_COPY_AND_ASSIGN(OsrRenderHandlerWinNative);
};