Commit e27aea34 authored by Adrienne Walker's avatar Adrienne Walker Committed by Commit Bot

cc: don't scale paint record shaders in fuzzer

Currently we scale all such shaders and rewrite them out as fixed scale
(with a local matrix).  This changes the serialization process and also
adds a matrix where there was not one before.

For the sake of the equality fuzzer, add an option where we don't modify
what we are serializing in this case.

Bug: 898356
Change-Id: I433b921a6e799c2f2d912e6fa61d61bd6a82e2a8
Reviewed-on: https://chromium-review.googlesource.com/c/1298423Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Commit-Queue: enne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602553}
parent e5ad4adf
......@@ -164,6 +164,9 @@ class CC_PAINT_EXPORT PaintOp {
SkColorSpace* color_space = nullptr;
bool can_use_lcd_text = false;
bool context_supports_distance_field_text = true;
// If true, will calculate a fixed scale for PaintRecord-backed PaintShaders
// based on the current canvas scale. May be turned off for tests.
bool scale_paint_record_shaders = true;
int max_texture_size = 0;
size_t max_texture_bytes = 0.f;
SkMatrix original_ctm = SkMatrix::I();
......
......@@ -40,6 +40,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
SkNoDrawCanvas canvas(100, 100);
cc::TestOptionsProvider test_options_provider;
// This test is trying to verify that serializing and deserializing doesn't
// change the results. Scaling paint shaders and changed them to a fixed
// scale when serializing defeats this purpose, so turn that off.
test_options_provider.mutable_serialize_options().scale_paint_record_shaders =
false;
// Need 4 bytes to be able to read the type/skip.
if (size < 4)
return 0;
......
......@@ -335,7 +335,8 @@ sk_sp<PaintShader> PaintOpWriter::TransformShaderIfNecessary(
&quality, paint_image_needs_mips);
}
if (type == PaintShader::Type::kPaintRecord) {
if (type == PaintShader::Type::kPaintRecord &&
options_.scale_paint_record_shaders) {
return original->CreateScaledPaintRecord(ctm, paint_record_post_scale);
}
......
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