Commit 95f838f6 authored by Florin Malita's avatar Florin Malita Committed by Commit Bot

Fix image serialization in gpuBenchmarking.printToSkPicture

PrintToSkPicture currently uses a custom image serializer, but there is no
corresponding custom deserializer in Skia -> we cannot deserialize these
images.

The historical reason for using a custom serializer is support for
--skip-reencoding-on-skp-capture.  This flag was added in
https://crrev.com/1710553002, but is no longer used.

The simplest fix for image serialization is to remove the custom proc
and allow Skia to handle it instead.

BUG=820142

Change-Id: Id19851811e23dd828b5fea7248874740cfda8dea
Reviewed-on: https://chromium-review.googlesource.com/956025Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarLeon Scroggins <scroggo@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541911}
parent f65c4b6d
......@@ -772,12 +772,6 @@ const char kSingleProcess[] = "single-process";
// process consolidation, not isolation). You probably want this one.
const char kSitePerProcess[] = "site-per-process";
// Skips reencoding bitmaps as PNGs when the encoded data is unavailable
// during SKP capture. This allows for obtaining an accurate sample of
// the types of images on the web, rather than being weighted towards PNGs
// that we have encoded ourselves.
const char kSkipReencodingOnSKPCapture[] = "skip-reencoding-on-skp-capture";
// Specifies if the browser should start in fullscreen mode, like if the user
// had pressed F11 right after startup.
const char kStartFullscreen[] = "start-fullscreen";
......
......@@ -214,7 +214,6 @@ CONTENT_EXPORT extern const char kSavePreviousDocumentResources[];
extern const char kShowPaintRects[];
CONTENT_EXPORT extern const char kSingleProcess[];
CONTENT_EXPORT extern const char kSitePerProcess[];
extern const char kSkipReencodingOnSKPCapture[];
CONTENT_EXPORT extern const char kStartFullscreen[];
CONTENT_EXPORT extern const char kStatsCollectionController[];
CONTENT_EXPORT extern const char kTestType[];
......
......@@ -54,8 +54,6 @@
#include "third_party/skia/include/core/SkGraphics.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
#include "third_party/skia/include/core/SkSerialProcs.h"
#include "third_party/skia/include/core/SkStream.h"
// Note that headers in third_party/skia/src are fragile. This is
// an experimental, fragile, and diagnostic-only document type.
#include "third_party/skia/src/utils/SkMultiPictureDocument.h"
......@@ -108,20 +106,7 @@ class SkPictureSerializer {
SkFILEWStream file(filepath.c_str());
DCHECK(file.isValid());
SkSerialProcs procs;
procs.fImageProc = [](SkImage* image, void*) {
auto data = image->refEncodedData();
if (!data) {
const base::CommandLine& commandLine =
*base::CommandLine::ForCurrentProcess();
if (commandLine.HasSwitch(switches::kSkipReencodingOnSKPCapture)) {
data = SkData::MakeEmpty();
}
// else data is null, which triggers skia's default PNG encode
}
return data;
};
auto data = picture->serialize(&procs);
auto data = picture->serialize();
file.write(data->data(), data->size());
file.fsync();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment