[go: nahoru, domu]

[Reland] Use glUnpremultiplyAndDitherCopyCHROMIUM in GPU Raster

This change addresses banding issues by using the newly added
glUnpremultiplyAndDitherCopyCHROMIUM.

In cases where we previously rasterized into a RGBA4444 target, we
instead rasterize into a temporary RGBA8888 target, then do an
unpremultiply/dither copy into the RGBA4444 target.

This means that tiles may be either unpremultiplied or premultiplied, so
we need a way to pipe this information to the GLRenderer, so it can
blend correctly. This change introduces a is_premultiplied property to
ContentDrawQuadBase to handle this.

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: I769a51e6a5f37dd5b9bede42577dbfade17e27e2
Reviewed-on: https://chromium-review.googlesource.com/937991
Reviewed-by: enne <enne@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Eric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543283}
diff --git a/cc/raster/zero_copy_raster_buffer_provider.cc b/cc/raster/zero_copy_raster_buffer_provider.cc
index fd311dd9..c17f9753 100644
--- a/cc/raster/zero_copy_raster_buffer_provider.cc
+++ b/cc/raster/zero_copy_raster_buffer_provider.cc
@@ -250,6 +250,11 @@
   return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha));
 }
 
+bool ZeroCopyRasterBufferProvider::IsResourcePremultiplied(
+    bool must_support_alpha) const {
+  return true;
+}
+
 bool ZeroCopyRasterBufferProvider::CanPartialRasterIntoProvidedResource()
     const {
   return false;