mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-10 17:23:26 +01:00
b12e172af0
- The |dirtyRects| argument to CefRenderHandler::OnPaint is now a single rectangle representing the union of all dirty rectangles since the last frame was generated. In most cases this rectangle will be smaller than the view (frame) size. - cefclient: Use a ScopedGLContext class on all platforms to manage the current GL context and avoid GL state leaks. - cefclient: Add debug checks in ClientOSRenderer for GL errors and fix some errors that were discovered. - cefclient: Add a new `--show-update-rect` command-line flag that provides visualization of the update rectangle by drawing a red border around it for each frame. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1945 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
68 lines
1.9 KiB
C++
68 lines
1.9 KiB
C++
// Copyright (c) 2012 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_OSRENDERER_H_
|
|
#define CEF_TESTS_CEFCLIENT_OSRENDERER_H_
|
|
#pragma once
|
|
|
|
#include "include/cef_browser.h"
|
|
#include "include/cef_render_handler.h"
|
|
|
|
class ClientOSRenderer {
|
|
public:
|
|
ClientOSRenderer(bool transparent,
|
|
bool show_update_rect);
|
|
virtual ~ClientOSRenderer();
|
|
|
|
// Initialize the OpenGL environment.
|
|
void Initialize();
|
|
|
|
// Clean up the OpenGL environment.
|
|
void Cleanup();
|
|
|
|
// Render to the screen.
|
|
void Render();
|
|
|
|
// Forwarded from CefRenderHandler callbacks.
|
|
void OnPopupShow(CefRefPtr<CefBrowser> browser,
|
|
bool show);
|
|
void OnPopupSize(CefRefPtr<CefBrowser> browser,
|
|
const CefRect& rect);
|
|
void OnPaint(CefRefPtr<CefBrowser> browser,
|
|
CefRenderHandler::PaintElementType type,
|
|
const CefRenderHandler::RectList& dirtyRects,
|
|
const void* buffer, int width, int height);
|
|
|
|
// Apply spin.
|
|
void SetSpin(float spinX, float spinY);
|
|
void IncrementSpin(float spinDX, float spinDY);
|
|
|
|
bool IsTransparent() { return transparent_; }
|
|
|
|
int GetViewWidth() { return view_width_; }
|
|
int GetViewHeight() { return view_height_; }
|
|
|
|
const CefRect& popup_rect() const { return popup_rect_; }
|
|
const CefRect& original_popup_rect() const { return original_popup_rect_; }
|
|
|
|
CefRect GetPopupRectInWebView(const CefRect& original_rect);
|
|
void ClearPopupRects();
|
|
|
|
private:
|
|
const bool transparent_;
|
|
const bool show_update_rect_;
|
|
bool initialized_;
|
|
unsigned int texture_id_;
|
|
int view_width_;
|
|
int view_height_;
|
|
CefRect popup_rect_;
|
|
CefRect original_popup_rect_;
|
|
float spin_x_;
|
|
float spin_y_;
|
|
CefRect update_rect_;
|
|
};
|
|
|
|
#endif // CEF_TESTS_CEFCLIENT_OSRENDERER_H_
|
|
|