Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73420dd3 authored by Nathaniel Nifong's avatar Nathaniel Nifong Committed by Android (Google) Code Review
Browse files

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

parents be15e3e2 429fff4b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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;