blob: bd592a36bb5aa395827a9297f7d8ff3133770af4 [file] [log] [blame]
Hal Canary8cb73762019-01-09 09:46:43 -05001// 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 Kleinc0bd9f92019-04-23 12:05:21 -05004#include "gm/gm.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -04005#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 Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/effects/SkLumaColorFilter.h"
Hal Canary8cb73762019-01-09 09:46:43 -050012
13// PDF backend should produce correct results.
14DEF_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}