blob: 28ec6ffbd76db73f860f8f11b54cd301a47a47ee [file] [log] [blame]
mtklein4afe21e2015-04-17 06:32:13 -07001/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "gm.h"
Mike Klein33d20552017-03-22 13:47:51 -04009#include "sk_tool_utils.h"
mtklein4afe21e2015-04-17 06:32:13 -070010
11DEF_SIMPLE_GM(blend, canvas, 300, 100) {
12 SkPaint p;
13
14 // All three of these blocks should be the same color.
15 canvas->save();
16 canvas->scale(100,100);
17
18 p.setColor(SK_ColorRED);
19 canvas->drawRect(SkRect::MakeXYWH(0,0,1,1), p);
lsalzman40254c22016-08-05 11:48:45 -070020 p.setColor(0xFC208000);
mtklein4afe21e2015-04-17 06:32:13 -070021 canvas->drawRect(SkRect::MakeXYWH(0,0,1,1), p);
22
23 p.setColor(SK_ColorRED);
24 canvas->drawRect(SkRect::MakeXYWH(1,0,1,1), p);
halcanary96fcdcc2015-08-27 07:41:13 -070025 canvas->saveLayer(nullptr, nullptr);
lsalzman40254c22016-08-05 11:48:45 -070026 p.setColor(0xFC208000);
mtklein4afe21e2015-04-17 06:32:13 -070027 canvas->drawRect(SkRect::MakeXYWH(1,0,1,1), p);
28 canvas->restore();
29
30 p.setColor(SK_ColorRED);
31 canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p);
halcanary96fcdcc2015-08-27 07:41:13 -070032 canvas->saveLayerAlpha(nullptr, 0xFC);
lsalzman40254c22016-08-05 11:48:45 -070033 p.setColor(sk_tool_utils::color_to_565(0xFF208000));
mtklein4afe21e2015-04-17 06:32:13 -070034 canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p);
35 canvas->restore();
36 canvas->restore();
mtklein4afe21e2015-04-17 06:32:13 -070037}