• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/gm.h"
5 #include "include/core/SkBlendMode.h"
6 #include "include/core/SkCanvas.h"
7 #include "include/core/SkColor.h"
8 #include "include/core/SkColorFilter.h"
9 #include "include/core/SkPaint.h"
10 #include "include/core/SkRect.h"
11 #include "include/effects/SkLumaColorFilter.h"
12 
13 // PDF backend should produce correct results.
14 DEF_SIMPLE_GM(crbug_918512, canvas, 256, 256) {
15     canvas->drawColor(SK_ColorYELLOW);
16     {
17         SkAutoCanvasRestore autoCanvasRestore1(canvas, false);
18         canvas->saveLayer(nullptr, nullptr);
19         canvas->drawColor(SK_ColorCYAN);
20         {
21             SkAutoCanvasRestore autoCanvasRestore2(canvas, false);
22             SkPaint lumaFilter;
23             lumaFilter.setBlendMode(SkBlendMode::kDstIn);
24             lumaFilter.setColorFilter(SkLumaColorFilter::Make());
25             canvas->saveLayer(nullptr, &lumaFilter);
26 
27             canvas->drawColor(SK_ColorTRANSPARENT);
28             SkPaint paint;
29             paint.setColor(SK_ColorGRAY);
30             canvas->drawRect(SkRect{0, 0, 128, 256}, paint);
31         }
32     }
33 }
34