cef/libcef/browser/software_output_device_osr.h
Marshall Greenblatt d0a45cfbbb Add support for begin frame scheduling and direct rendering when GPU compositing is disabled (issue #1368).
- Always set the browser process VSync rate (frame rate) to CefSettings.windowless_frame_rate.
- When the `enable-begin-frame-scheduling` command-line flag is specified the VSync rate for all processes will be synchronized to CefSettings.windowless_frame_rate. This flag cannot be used in combination with windowed rendering.
- When the `disable-gpu` and `disable-gpu-compositing` command-line flags are specified the CefRenderHandler::OnPaint method will be called directly from the compositor instead of requiring an additional copy for each frame.
- CefRenderHandler::OnPopupSize now passes view coordinates instead of (potentially scaled) pixel coordinates.
- Add OSR unit tests for 2x (HiDPI) pixel scaling.
- Improve CefRenderHandler documentation.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1960 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2015-01-01 16:51:56 +00:00

57 lines
1.8 KiB
C++

// Copyright (c) 2014 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2014 The Chromium 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_LIBCEF_BROWSER_SOFTWARE_OUTPUT_DEVICE_OSR_H_
#define CEF_LIBCEF_BROWSER_SOFTWARE_OUTPUT_DEVICE_OSR_H_
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "cc/output/software_output_device.h"
namespace ui {
class Compositor;
}
// Device implementation for direct software rendering via DelegatedFrameHost.
// All Rect/Size values are in pixels.
class CefSoftwareOutputDeviceOSR : public cc::SoftwareOutputDevice {
public:
typedef base::Callback<void(const gfx::Rect&,int,int,void*)>
OnPaintCallback;
CefSoftwareOutputDeviceOSR(ui::Compositor* compositor,
bool transparent,
const OnPaintCallback& callback);
~CefSoftwareOutputDeviceOSR() override;
// cc::SoftwareOutputDevice implementation.
void Resize(const gfx::Size& viewport_pixel_size,
float scale_factor) override;
SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override;
void EndPaint(cc::SoftwareFrameData* frame_data) override;
void CopyToPixels(const gfx::Rect& rect, void* pixels) override;
void SetActive(bool active);
// Include |damage_rect| the next time OnPaint is called.
void Invalidate(const gfx::Rect& damage_rect);
// Deliver the OnPaint notification immediately.
void OnPaint(const gfx::Rect& damage_rect);
private:
const bool transparent_;
const OnPaintCallback callback_;
bool active_;
scoped_ptr<SkCanvas> canvas_;
scoped_ptr<SkBitmap> bitmap_;
gfx::Rect pending_damage_rect_;
DISALLOW_COPY_AND_ASSIGN(CefSoftwareOutputDeviceOSR);
};
#endif // CEF_LIBCEF_BROWSER_SOFTWARE_OUTPUT_DEVICE_OSR_H_