Hal Canary | 8cb7376 | 2019-01-09 09:46:43 -0500 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 4 | #include "gm/gm.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 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" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/effects/SkLumaColorFilter.h" |
Hal Canary | 8cb7376 | 2019-01-09 09:46:43 -0500 | [diff] [blame] | 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 | } |