Bug 1415407 - Add webrender support for filters (hue-rotate, opacity, saturate). r=kats
authorEthan Lin <ethlin@mozilla.com>
Wed, 08 Nov 2017 04:04:27 +0000
changeset 392077 60ed7a647f38bc9dc34d2f54838d01e03b29d9d2
parent 392076 07d02e9d114ca21b7d59b222ef49e2ffe18c6172
child 392078 b73b29bfcbdeb4824059f23e8d0d704a0b256c65
push id32910
push userrgurzau@mozilla.com
push dateThu, 16 Nov 2017 10:02:59 +0000
treeherdermozilla-central@9941e68b5a53 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1415407
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1415407 - Add webrender support for filters (hue-rotate, opacity, saturate). r=kats MozReview-Commit-ID: 7LGmFOsyPUU
layout/painting/nsDisplayList.cpp
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -9670,24 +9670,34 @@ nsDisplayFilter::CreateWebRenderCommands
   nsTArray<mozilla::wr::WrFilterOp> wrFilters;
   const nsTArray<nsStyleFilter>& filters = mFrame->StyleEffects()->mFilters;
   for (const nsStyleFilter& filter : filters) {
     switch (filter.GetType()) {
       case NS_STYLE_FILTER_BRIGHTNESS:
       case NS_STYLE_FILTER_CONTRAST:
       case NS_STYLE_FILTER_GRAYSCALE:
       case NS_STYLE_FILTER_INVERT:
+      case NS_STYLE_FILTER_OPACITY:
+      case NS_STYLE_FILTER_SATURATE:
       case NS_STYLE_FILTER_SEPIA: {
         mozilla::wr::WrFilterOp filterOp = {
           wr::ToWrFilterOpType(filter.GetType()),
           filter.GetFilterParameter().GetFactorOrPercentValue(),
         };
         wrFilters.AppendElement(filterOp);
         break;
       }
+    case NS_STYLE_FILTER_HUE_ROTATE: {
+        mozilla::wr::WrFilterOp filterOp = {
+          wr::ToWrFilterOpType(filter.GetType()),
+          (float)filter.GetFilterParameter().GetAngleValueInDegrees(),
+        };
+        wrFilters.AppendElement(filterOp);
+        break;
+      }
       case NS_STYLE_FILTER_BLUR: {
         float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
         mozilla::wr::WrFilterOp filterOp = {
           wr::ToWrFilterOpType(filter.GetType()),
           ClampStdDeviation(
             NSAppUnitsToFloatPixels(
               filter.GetFilterParameter().GetCoordValue(),
               appUnitsPerDevPixel)),