Provide a typeface proc during SKP serialization that forces typefaces to be written.

Test: flashed to Pixel 3, confirmed system typeface is written, normal drawing unaffected.
Change-Id: I0016224f628b4e564670cc05b982460ff001b6ac
This commit is contained in:
Nathaniel Nifong
2020-01-30 14:38:21 -05:00
parent b2cbd9dcc2
commit 429fff4bcc

View File

@@ -24,6 +24,7 @@
#include <SkOverdrawColorFilter.h>
#include <SkPicture.h>
#include <SkPictureRecorder.h>
#include <SkTypeface.h>
#include <SkSerialProcs.h>
#include "LightingInfo.h"
#include "VectorDrawable.h"
@@ -264,6 +265,9 @@ bool SkiaPipeline::setupMultiFrameCapture() {
SkSerialProcs procs;
procs.fImageProc = SkSharingSerialContext::serializeImage;
procs.fImageCtx = mSerialContext.get();
procs.fTypefaceProc = [](SkTypeface* tf, void* ctx){
return tf->serialize(SkTypeface::SerializeBehavior::kDoIncludeData);
};
// SkDocuments don't take owership of the streams they write.
// we need to keep it until after mMultiPic.close()
// procs is passed as a pointer, but just as a method of having an optional default.
@@ -405,6 +409,10 @@ void SkiaPipeline::endCapture(SkSurface* surface) {
std::invoke(mPictureCapturedCallback, std::move(picture));
} else {
// single frame skp to file
SkSerialProcs procs;
procs.fTypefaceProc = [](SkTypeface* tf, void* ctx){
return tf->serialize(SkTypeface::SerializeBehavior::kDoIncludeData);
};
auto data = picture->serialize();
savePictureAsync(data, mCapturedFile);
mCaptureSequence = 0;