Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
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
15 changes: 11 additions & 4 deletions shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "third_party/skia/include/core/SkEncodedImageFormat.h"
#include "third_party/skia/include/core/SkImageEncoder.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
#include "third_party/skia/include/core/SkSerialProcs.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "third_party/skia/include/core/SkSurfaceCharacterization.h"
#include "third_party/skia/include/utils/SkBase64.h"
Expand Down Expand Up @@ -130,7 +131,11 @@ bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) {
return false;
}

static sk_sp<SkPicture> ScreenshotLayerTreeAsPicture(
static sk_sp<SkData> SerializeTypeface(SkTypeface* typeface, void* ctx) {
return typeface->serialize(SkTypeface::SerializeBehavior::kDoIncludeData);
}

static sk_sp<SkData> ScreenshotLayerTreeAsPicture(
flow::LayerTree* tree,
flow::CompositorContext& compositor_context) {
FML_DCHECK(tree != nullptr);
Expand All @@ -147,7 +152,10 @@ static sk_sp<SkPicture> ScreenshotLayerTreeAsPicture(

frame->Raster(*tree, true);

return recorder.finishRecordingAsPicture();
SkSerialProcs procs = {0};
procs.fTypefaceProc = SerializeTypeface;

return recorder.finishRecordingAsPicture()->serialize(&procs);
}

static sk_sp<SkSurface> CreateSnapshotSurface(GrContext* surface_context,
Expand Down Expand Up @@ -240,8 +248,7 @@ Rasterizer::Screenshot Rasterizer::ScreenshotLastLayerTree(

switch (type) {
case ScreenshotType::SkiaPicture:
data = ScreenshotLayerTreeAsPicture(layer_tree, *compositor_context_)
->serialize();
data = ScreenshotLayerTreeAsPicture(layer_tree, *compositor_context_);
break;
case ScreenshotType::UncompressedImage:
data = ScreenshotLayerTreeAsImage(layer_tree, *compositor_context_,
Expand Down