-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
581 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
#include "CefViewRendererFactory.h" | ||
#include "CefViewRendererFactory.h" | ||
|
||
#include "hardware/CefViewHardwareRenderer.h" | ||
#include "software/CefViewSoftwareRenderer.h" | ||
#include "software/QtSoftwareRenderer.h" | ||
|
||
std::shared_ptr<ICefViewRenderer> | ||
CefViewRendererFactory::createRenderer(bool hardware) | ||
namespace CefViewRendererFactory { | ||
CefViewRendererPtr | ||
createRenderer(bool hardware) | ||
{ | ||
if (hardware) { | ||
return std::make_shared<CefViewHardwareRenderer>(); | ||
return createHardwareRenderer(); | ||
} else { | ||
return std::make_shared<CefViewSoftwareRenderer>(); | ||
return std::make_shared<QtSoftwareRenderer>(); | ||
} | ||
} | ||
} // namespace CefViewRendererFactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
#ifndef CEFVIEWRENDERERFACTORY_H | ||
#ifndef CEFVIEWRENDERERFACTORY_H | ||
#define CEFVIEWRENDERERFACTORY_H | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
|
||
#include "ICefViewRenderer.h" | ||
|
||
class CefViewRendererFactory | ||
{ | ||
public: | ||
static std::shared_ptr<ICefViewRenderer> createRenderer(bool hardware); | ||
}; | ||
namespace CefViewRendererFactory { | ||
|
||
CefViewRendererPtr | ||
createRenderer(bool hardware); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,23 @@ | ||
#include "CefViewHardwareRenderer.h" | ||
#include "CefViewHardwareRenderer.h" | ||
|
||
#if defined(OS_WINDOWS) | ||
#include "win/details/render/hardware/DX11RenderBackend.h" | ||
#elif defined(OS_MACOS) | ||
#include "mac/details/render/hardware/MetalRenderBackend.h" | ||
#elif defined(OS_LINUX) | ||
#else | ||
#endif | ||
|
||
CefViewHardwareRenderer::CefViewHardwareRenderer() | ||
CefViewRendererPtr | ||
createHardwareRenderer() | ||
{ | ||
#if defined(OS_WINDOWS) | ||
: pBackend_(std::make_unique<DX11RenderBackend>()) | ||
return std::make_shared<DX11RenderBackend>(); | ||
#elif defined(OS_MACOS) | ||
: pBackend_(nullptr) | ||
return std::make_shared<MetalRenderBackend>(); | ||
#elif defined(OS_LINUX) | ||
: pBackend_(nullptr) | ||
return null; | ||
#else | ||
#error "Unsupported platform" | ||
#endif | ||
{ | ||
} | ||
|
||
CefViewHardwareRenderer::~CefViewHardwareRenderer() | ||
{ | ||
pBackend_.reset(); | ||
} | ||
|
||
bool | ||
CefViewHardwareRenderer::initialize(void* wid, int width, int height, float scale, const CefColor& background) | ||
{ | ||
return pBackend_->initialize(wid, width, height, scale, background); | ||
} | ||
|
||
void | ||
CefViewHardwareRenderer::uninitialize() | ||
{ | ||
pBackend_->uninitialize(); | ||
} | ||
|
||
void | ||
CefViewHardwareRenderer::resize(int width, int height, float scale) | ||
{ | ||
pBackend_->resize(width, height, scale); | ||
} | ||
|
||
void | ||
CefViewHardwareRenderer::updatePopupVisibility(bool visible) | ||
{ | ||
pBackend_->updatePopupVisibility(visible); | ||
} | ||
|
||
void | ||
CefViewHardwareRenderer::updatePopupRect(const CefRect& rect) | ||
{ | ||
pBackend_->updatePopupRect(rect); | ||
} | ||
|
||
void | ||
CefViewHardwareRenderer::updateFrameData(const CefRenderHandler::PaintElementType& type, | ||
const CefRenderHandler::RectList& dirtyRects, | ||
const FrameDataType& dataType, | ||
const FrameData& data) | ||
{ | ||
pBackend_->updateFrameData(type, dirtyRects, dataType, data); | ||
} | ||
|
||
void | ||
CefViewHardwareRenderer::render(void* painter) | ||
{ | ||
pBackend_->render(nullptr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,10 @@ | ||
#ifndef CEFVIEWHARDWARERENDERER_H | ||
#ifndef CEFVIEWHARDWARERENDERER_H | ||
#define CEFVIEWHARDWARERENDERER_H | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
|
||
#include "../ICefViewRenderer.h" | ||
|
||
class CefViewHardwareRenderer : public ICefViewRenderer | ||
{ | ||
private: | ||
std::unique_ptr<ICefViewRenderer> pBackend_; | ||
|
||
public: | ||
CefViewHardwareRenderer(); | ||
~CefViewHardwareRenderer(); | ||
|
||
bool isHardware() override { return true; } | ||
|
||
bool initialize(void* wid, int width, int height, float scale, const CefColor& background) override; | ||
|
||
void uninitialize() override; | ||
|
||
void resize(int width, int height, float scale) override; | ||
|
||
void updatePopupVisibility(bool visible) override; | ||
|
||
void updatePopupRect(const CefRect& rect) override; | ||
|
||
void updateFrameData(const CefRenderHandler::PaintElementType& type, | ||
const CefRenderHandler::RectList& dirtyRects, | ||
const FrameDataType& dataType, | ||
const FrameData& data) override; | ||
|
||
void render(void* painter) override; | ||
}; | ||
CefViewRendererPtr | ||
createHardwareRenderer(); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.