Skip to content

Commit 4ae2b5f

Browse files
ScalibqDennis de Bruijn
authored andcommitted
Implement AcceleratedPaintInfo (#4796)
* Implement AcceleratedPaintInfo so the shared texture can be used for accelerated rendering in a custom IRenderHandler. * Make AcceleratedPaintInfo members get-only properties, set via constructor. Add XML comments, based on CEF. --------- Co-authored-by: Dennis de Bruijn <d.de.bruijn@tss.nl>
1 parent 1790188 commit 4ae2b5f

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

CefSharp.Core.Runtime/Internals/RenderClientAdapter.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ namespace CefSharp
153153
virtual DECL void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList& dirtyRects, const CefAcceleratedPaintInfo& info) override
154154
{
155155
CefRect r = dirtyRects.front();
156-
_renderWebBrowser->OnAcceleratedPaint((CefSharp::PaintElementType)type, CefSharp::Structs::Rect(r.x, r.y, r.width, r.height), nullptr);
156+
AcceleratedPaintInfo^ api = gcnew AcceleratedPaintInfo((IntPtr)info.shared_texture_handle, (ColorType)info.format);
157+
_renderWebBrowser->OnAcceleratedPaint((CefSharp::PaintElementType)type, CefSharp::Structs::Rect(r.x, r.y, r.width, r.height), api);
157158
}
158159

159160
virtual DECL void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList& dirtyRects,

CefSharp/AcceleratedPaintInfo.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,36 @@
22
//
33
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
44

5+
using System;
6+
using CefSharp.Enums;
7+
58
namespace CefSharp
69
{
710
/// <summary>
8-
/// AcceleratedPaintInfo
11+
/// Class representing accelerated paint info.
912
/// </summary>
1013
public sealed class AcceleratedPaintInfo
1114
{
15+
/// <summary>
16+
/// Handle for the shared texture. The shared texture is instantiated
17+
/// without a keyed mutex.
18+
/// </summary>
19+
public IntPtr SharedTextureHandle { get; }
20+
21+
/// <summary>
22+
/// The pixel format of the texture.
23+
/// </summary>
24+
public ColorType Format { get; }
25+
26+
/// <summary>
27+
/// AcceleratedPaintInfo
28+
/// </summary>
29+
/// <param name="sharedTextureHandle">Handle to the shared texture resource</param>
30+
/// <param name="format">The pixel format of the shared texture resource</param>
31+
public AcceleratedPaintInfo(IntPtr sharedTextureHandle, ColorType format)
32+
{
33+
SharedTextureHandle = sharedTextureHandle;
34+
Format = format;
35+
}
1236
}
1337
}

0 commit comments

Comments
 (0)