Fuzz: RasterN32CanvasViaSerialization,
Change-Id: I0ea4f96263aec4b272ead5f541ee304942499f68 Reviewed-on: https://skia-review.googlesource.com/79161 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
parent
3cd22cc543
commit
e292443972
@ -60,6 +60,7 @@
|
||||
|
||||
// SRC
|
||||
#include "SkUtils.h"
|
||||
#include "SkValidatingReadBuffer.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrContextFactory.h"
|
||||
@ -1762,6 +1763,22 @@ DEF_FUZZ(RasterN32Canvas, fuzz) {
|
||||
fuzz_canvas(fuzz, surface->getCanvas());
|
||||
}
|
||||
|
||||
DEF_FUZZ(RasterN32CanvasViaSerialization, fuzz) {
|
||||
SkPictureRecorder recorder;
|
||||
fuzz_canvas(fuzz, recorder.beginRecording(SkIntToScalar(kCanvasSize.width()),
|
||||
SkIntToScalar(kCanvasSize.height())));
|
||||
sk_sp<SkPicture> pic(recorder.finishRecordingAsPicture());
|
||||
if (!pic) { fuzz->signalBug(); }
|
||||
sk_sp<SkData> data = pic->serialize();
|
||||
if (!data) { fuzz->signalBug(); }
|
||||
SkValidatingReadBuffer vrb(data->data(), data->size());
|
||||
auto deserialized = SkPicture::MakeFromBuffer(vrb);
|
||||
if (!deserialized) { fuzz->signalBug(); }
|
||||
auto surface = SkSurface::MakeRasterN32Premul(kCanvasSize.width(), kCanvasSize.height());
|
||||
SkASSERT(surface && surface->getCanvas());
|
||||
surface->getCanvas()->drawPicture(deserialized);
|
||||
}
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
static void fuzz_ganesh(Fuzz* fuzz, GrContext* context) {
|
||||
SkASSERT(context);
|
||||
|
Loading…
Reference in New Issue
Block a user