Bug 1968618 Comment 1 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Chromium tries to enable dither by calling [PaintFlags::()](https://source.chromium.org/chromium/chromium/src/+/main:cc/paint/paint_flags.h;l=67;drc=ce105292810e6be50e97686ae76b32fb6c3579c8) or [SkPaint::setDither()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/include/core/SkPaint.h;l=182;drc=ce105292810e6be50e97686ae76b32fb6c3579c8).

They are called in the followings
- [1] [RasterBufferProvider::PlaybackToMemory()](https://source.chromium.org/chromium/chromium/src/+/main:cc/raster/raster_buffer_provider.cc;l=111;drc=90f1c4aeaa2621f4e7d5b0466f12917c89ecbadc)
    - Dither is set only when format is SinglePlaneFormat::kRGBA_4444)
- [2][DecodingImageGenerator::GetPixels()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/decoding_image_generator.cc;l=233;drc=5a8420db088cf253940ab71c1f1cad1f5ecc95ce)
    - Dither is set only when it is necessary.
- [3][Gradient::ApplyToFlags()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=359;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)
    - gradients are always dithered.

[1] and [2] seems not related to WebRender. Only [3] seems necessary for WebRender.

3 Types of gradients are created related to [3] by the followings.
* [Gradient::CreateLinear()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=533;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)
* [Gradient::CreateRadial()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=543;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)
* [Gradient::CreateConic()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=557;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)
Chromium tries to enable dither by calling [PaintFlags::()](https://source.chromium.org/chromium/chromium/src/+/main:cc/paint/paint_flags.h;l=67;drc=ce105292810e6be50e97686ae76b32fb6c3579c8) or [SkPaint::setDither()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/include/core/SkPaint.h;l=182;drc=ce105292810e6be50e97686ae76b32fb6c3579c8).

They are called in the followings
- [1] [RasterBufferProvider::PlaybackToMemory()](https://source.chromium.org/chromium/chromium/src/+/main:cc/raster/raster_buffer_provider.cc;l=111;drc=90f1c4aeaa2621f4e7d5b0466f12917c89ecbadc)
    - Dither is set only when format is SinglePlaneFormat::kRGBA_4444)
- [2][DecodingImageGenerator::GetPixels()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/decoding_image_generator.cc;l=233;drc=5a8420db088cf253940ab71c1f1cad1f5ecc95ce)
    - Dither is set only when it is necessary.
- [3][Gradient::ApplyToFlags()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=359;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)
    - gradients are always dithered.

[1] and [2] seems not related to WebRender. Only [3] seems necessary for WebRender.

3 Types of gradients are created related to [3] by the followings.
* [Gradient::CreateLinear()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=533;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)
* [Gradient::CreateRadial()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=543;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)
* [Gradient::CreateConic()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=557;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)


And Skia could disable dither with the following check
- [SkPaintPriv::ShouldDither()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/core/SkPaintPriv.cpp;l=113;drc=5c607daf4cfbb6f00aac7d95141b0dbbef7ceb09)
- [should_dither()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/gpu/graphite/PaintParams.cpp;l=32;drc=e8a1f3eee38ac86838fa4a9537697ac97ff0c590)
Chromium tries to enable dither by calling [PaintFlags::()](https://source.chromium.org/chromium/chromium/src/+/main:cc/paint/paint_flags.h;l=67;drc=ce105292810e6be50e97686ae76b32fb6c3579c8) or [SkPaint::setDither()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/include/core/SkPaint.h;l=182;drc=ce105292810e6be50e97686ae76b32fb6c3579c8).

They are called in the followings
- [1] [RasterBufferProvider::PlaybackToMemory()](https://source.chromium.org/chromium/chromium/src/+/main:cc/raster/raster_buffer_provider.cc;l=111;drc=90f1c4aeaa2621f4e7d5b0466f12917c89ecbadc)
    - Dither is set only when format is SinglePlaneFormat::kRGBA_4444)
- [2][DecodingImageGenerator::GetPixels()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/decoding_image_generator.cc;l=233;drc=5a8420db088cf253940ab71c1f1cad1f5ecc95ce)
    - Dither is set only when it is necessary.
- [3][Gradient::ApplyToFlags()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=359;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)
    - gradients are always dithered.

[1] and [2] seems not related to WebRender. Only [3] seems necessary for WebRender.

3 Types of gradients are created related to [3] by the followings.
* [Gradient::CreateLinear()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=533;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)
* [Gradient::CreateRadial()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=543;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)
* [Gradient::CreateConic()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/graphics/gradient.cc;l=557;drc=027e878caf6a749eb5fb47ac4f43b580ea25dbbe)


And Skia could disable dither with the following checks
- [SkPaintPriv::ShouldDither()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/core/SkPaintPriv.cpp;l=113;drc=5c607daf4cfbb6f00aac7d95141b0dbbef7ceb09)
- [should_dither()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/gpu/graphite/PaintParams.cpp;l=32;drc=e8a1f3eee38ac86838fa4a9537697ac97ff0c590)

Back to Bug 1968618 Comment 1