Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.

Fix black rectangles because of data synchronization problem (issue #54) #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Source/Blu/Private/RenderHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ RenderHandler::RenderHandler(int32 width, int32 height, UBluEye* ui)
this->Width = width;
this->Height = height;
this->parentUI = ui;
this->BackBufferSizeCached = width * height * 4;
this->BackBuffer = new uint8[this->BackBufferSizeCached];
}

RenderHandler::~RenderHandler()
{
delete this->BackBuffer;
}

bool RenderHandler::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect)
Expand All @@ -28,8 +35,10 @@ void RenderHandler::OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type
current++;
}

memcpy(BackBuffer, buffer, BackBufferSizeCached);

// Trigger our parent UIs Texture to update
parentUI->TextureUpdate(buffer, updateRegions, dirtyRects.size());
parentUI->TextureUpdate(BackBuffer, updateRegions, dirtyRects.size());
}

bool BrowserClient::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, CefProcessId source_process, CefRefPtr<CefProcessMessage> message)
Expand Down
5 changes: 4 additions & 1 deletion Source/Blu/Public/RenderHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ class RenderHandler : public CefRenderHandler
{
private:
UBluEye* parentUI;

uint8* BackBuffer;
uint32 BackBufferSizeCached;

public:

int32 Width;
Expand All @@ -28,6 +30,7 @@ class RenderHandler : public CefRenderHandler
void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList &dirtyRects, const void *buffer, int width, int height) override;

RenderHandler(int32 width, int32 height, UBluEye* ui);
~RenderHandler();

// CefBase interface
// NOTE: Must be at bottom
Expand Down