Home | History | Annotate | Download | only in gm
      1 // Copyright 2019 Google LLC.
      2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
      3 
      4 #include "gm.h"
      5 
      6 #include "SkLumaColorFilter.h"
      7 
      8 // PDF backend should produce correct results.
      9 DEF_SIMPLE_GM(crbug_918512, canvas, 256, 256) {
     10     canvas->drawColor(SK_ColorYELLOW);
     11     {
     12         SkAutoCanvasRestore autoCanvasRestore1(canvas, false);
     13         canvas->saveLayer(nullptr, nullptr);
     14         canvas->drawColor(SK_ColorCYAN);
     15         {
     16             SkAutoCanvasRestore autoCanvasRestore2(canvas, false);
     17             SkPaint lumaFilter;
     18             lumaFilter.setBlendMode(SkBlendMode::kDstIn);
     19             lumaFilter.setColorFilter(SkLumaColorFilter::Make());
     20             canvas->saveLayer(nullptr, &lumaFilter);
     21 
     22             canvas->drawColor(SK_ColorTRANSPARENT);
     23             SkPaint paint;
     24             paint.setColor(SK_ColorGRAY);
     25             canvas->drawRect(SkRect{0, 0, 128, 256}, paint);
     26         }
     27     }
     28 }
     29