2015-01-01 17:51:56 +01:00
|
|
|
// 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.
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_OSR_SOFTWARE_OUTPUT_DEVICE_OSR_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_OSR_SOFTWARE_OUTPUT_DEVICE_OSR_H_
|
2015-01-01 17:51:56 +01:00
|
|
|
|
|
|
|
#include "base/callback.h"
|
2017-10-20 19:45:20 +02:00
|
|
|
#include "components/viz/service/display/software_output_device.h"
|
2015-01-01 17:51:56 +01:00
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
class Compositor;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Device implementation for direct software rendering via DelegatedFrameHost.
|
|
|
|
// All Rect/Size values are in pixels.
|
2017-10-20 19:45:20 +02:00
|
|
|
class CefSoftwareOutputDeviceOSR : public viz::SoftwareOutputDevice {
|
2015-01-01 17:51:56 +01:00
|
|
|
public:
|
2017-05-17 11:29:28 +02:00
|
|
|
typedef base::Callback<void(const gfx::Rect&, int, int, void*)>
|
2015-01-01 17:51:56 +01:00
|
|
|
OnPaintCallback;
|
|
|
|
|
|
|
|
CefSoftwareOutputDeviceOSR(ui::Compositor* compositor,
|
|
|
|
bool transparent,
|
|
|
|
const OnPaintCallback& callback);
|
|
|
|
~CefSoftwareOutputDeviceOSR() override;
|
|
|
|
|
2017-10-20 19:45:20 +02:00
|
|
|
// viz::SoftwareOutputDevice implementation.
|
2015-01-01 17:51:56 +01:00
|
|
|
void Resize(const gfx::Size& viewport_pixel_size,
|
2017-05-17 11:29:28 +02:00
|
|
|
float scale_factor) override;
|
2015-01-01 17:51:56 +01:00
|
|
|
SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override;
|
2015-08-14 16:41:08 +02:00
|
|
|
void EndPaint() override;
|
2015-01-01 17:51:56 +01:00
|
|
|
|
|
|
|
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_;
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<SkCanvas> canvas_;
|
|
|
|
std::unique_ptr<SkBitmap> bitmap_;
|
2015-01-01 17:51:56 +01:00
|
|
|
gfx::Rect pending_damage_rect_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefSoftwareOutputDeviceOSR);
|
|
|
|
};
|
|
|
|
|
2015-11-17 19:20:13 +01:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_OSR_SOFTWARE_OUTPUT_DEVICE_OSR_H_
|