79 std::uint32_t to_pixels(
float logical)
const {
80 const float p = logical *
scale;
81 return static_cast<std::uint32_t
>(
p < 1.0f ? 1.0f :
p);
140class PluginFrameRenderer {
146 static constexpr int kMaxConsecutiveRecreates = 3;
151 bool readback_ok =
true;
154 bool should_recreate_surface =
false;
157 bool gpu_path_exhausted =
false;
159 bool reached_output()
const {
165 View* root =
nullptr;
166 FrameGeometry geometry{};
167 bool partial_repaint =
false;
170 std::function<void()>
idle;
172 std::vector<std::uint8_t>* capture =
nullptr;
173 std::uint32_t* capture_width =
nullptr;
174 std::uint32_t* capture_height =
nullptr;
179 Frame
render(render::GpuSurface& gpu, render::SkiaSurface& skia,
180 PendingDamage& damage,
const Request& request);
185 void note_surfaces_created() { consecutive_recreates_ = 0; }
187 int consecutive_recreates()
const {
return consecutive_recreates_; }
193 Frame& finish(Frame& frame, render::FrameOutcome outcome);
195 int consecutive_recreates_ = 0;
200struct EditorSurfaces {
201 std::unique_ptr<render::GpuSurface>
gpu;
202 std::unique_ptr<render::SkiaSurface>
skia;
207 bool partial_repaint =
false;
209 bool ok()
const {
return gpu !=
nullptr &&
skia !=
nullptr; }
219render::GpuSurface::Config editor_surface_config(
245EditorSurfaces create_editor_surfaces(
void* native_handle,
248 bool enable_gpu_timing,
249 bool want_partial_repaint,
250 const char* log_tag);
255class RasterSceneCache {
260 RasterSceneCache(
const RasterSceneCache&) =
delete;
261 RasterSceneCache& operator=(
const RasterSceneCache&) =
delete;
265 std::unique_ptr<Impl> impl_;
266 friend std::vector<std::uint8_t> raster_plugin_scene_rgba(View&,
const FrameGeometry&,
267 std::uint32_t*, std::uint32_t*,
268 canvas::TextRasterPolicy,
285std::vector<std::uint8_t>
286raster_plugin_scene_rgba(
View& root,
const FrameGeometry& geometry, std::uint32_t* out_w,
287 std::uint32_t* out_h,
289 RasterSceneCache* retained_cache =
nullptr);
293std::vector<std::uint8_t> encode_rgba_png(
const std::vector<std::uint8_t>& rgba,
294 std::uint32_t
w, std::uint32_t
h);
Definition canvas.hpp:240
One frame's damage, taken atomically out of a PendingDamage.
Definition pending_damage.hpp:39
PresentPolicy
How a host presents finished frames (WAH-13).
Definition plugin_view_host.hpp:77
@ ok
Definition analyzer_provider.hpp:58
Definition affine_transform.hpp:24
TextRasterPolicy
Glyph preblend a surface is created with.
Definition text_raster_policy.hpp:33
@ legacy
Definition text_raster_policy.hpp:34
@ Request
Definition capabilities.hpp:19
constexpr bool frame_reached_output(FrameOutcome outcome)
True when outcome means the frame's pixels reached their intended output, i.e.
Definition skia_surface.hpp:50
FrameOutcome
Where a frame actually ended up.
Definition skia_surface.hpp:35
@ failed
Submission failed. The surface is still usable — retry the frame.
Definition skia_surface.hpp:44
@ idle
Definition voice.hpp:17
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
@ gpu
Offscreen GPU (Dawn + Skia via pulp::render::HeadlessSurface).
Definition screenshot.hpp:16
@ skia
CPU Skia raster (SkSurfaces::Raster).
Definition screenshot.hpp:15
bool compute_frame_clip(View &root, const PendingDamage::Snapshot &damage, const FrameGeometry &geometry, Rect &out_clip)
Decide the clip rect for a partial repaint, in SURFACE space.
constexpr std::uint32_t kEditorHostClearRgb
The background a plug-in editor host paints when the plug-in has not declared its own (Processor::edi...
Definition plugin_view_host.hpp:48
@ h
Definition input_events.hpp:39
@ p
Definition input_events.hpp:40
@ w
Definition input_events.hpp:41
void paint_plugin_scene(canvas::Canvas &canvas, View &root, const FrameGeometry &geometry, const Rect *clip)
Paint one editor frame: background fill (geometry.background_rgb), design-viewport transform,...
The size/scale/viewport a frame is painted against, in one value.
Definition plugin_frame_renderer.hpp:44
bool design_top_align
Definition plugin_frame_renderer.hpp:50
std::uint32_t physical_height
Definition plugin_frame_renderer.hpp:62
float design_width
0 disables the design viewport
Definition plugin_frame_renderer.hpp:48
std::uint32_t background_rgb
0xRRGGBB painted under the view tree: the whole frame before the editor's document mounts,...
Definition plugin_frame_renderer.hpp:54
bool has_design_viewport() const
Definition plugin_frame_renderer.hpp:64
float scale
Definition plugin_frame_renderer.hpp:47
float height
Definition plugin_frame_renderer.hpp:46
float design_height
Definition plugin_frame_renderer.hpp:49
std::uint32_t pixel_height() const
Definition plugin_frame_renderer.hpp:74
std::uint32_t physical_width
The surface's exact physical size, when the platform reports one (the client rect a Windows WM_SIZE c...
Definition plugin_frame_renderer.hpp:61
std::uint32_t pixel_width() const
Physical-pixel dimensions: the reported physical size when there is one, else logical × scale,...
Definition plugin_frame_renderer.hpp:71
float width
Definition plugin_frame_renderer.hpp:45
Axis-aligned rectangle in continuous (float) coordinates.
Definition geometry.hpp:52