mtklein | 4afe21e | 2015-04-17 06:32:13 -0700 | [diff] [blame] | 1 | /* |
| 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" |
| 9 | |
| 10 | DEF_SIMPLE_GM(blend, canvas, 300, 100) { |
| 11 | SkPaint p; |
| 12 | |
| 13 | // All three of these blocks should be the same color. |
| 14 | canvas->save(); |
| 15 | canvas->scale(100,100); |
| 16 | |
| 17 | p.setColor(SK_ColorRED); |
| 18 | canvas->drawRect(SkRect::MakeXYWH(0,0,1,1), p); |
| 19 | p.setColor(0xFC008000); |
| 20 | canvas->drawRect(SkRect::MakeXYWH(0,0,1,1), p); |
| 21 | |
| 22 | p.setColor(SK_ColorRED); |
| 23 | canvas->drawRect(SkRect::MakeXYWH(1,0,1,1), p); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 24 | canvas->saveLayer(nullptr, nullptr); |
mtklein | 4afe21e | 2015-04-17 06:32:13 -0700 | [diff] [blame] | 25 | p.setColor(0xFC008000); |
| 26 | canvas->drawRect(SkRect::MakeXYWH(1,0,1,1), p); |
| 27 | canvas->restore(); |
| 28 | |
| 29 | p.setColor(SK_ColorRED); |
| 30 | canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 31 | canvas->saveLayerAlpha(nullptr, 0xFC); |
caryclark | 1259601 | 2015-07-29 05:27:47 -0700 | [diff] [blame] | 32 | p.setColor(sk_tool_utils::color_to_565(0xFF008000)); |
mtklein | 4afe21e | 2015-04-17 06:32:13 -0700 | [diff] [blame] | 33 | canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p); |
| 34 | canvas->restore(); |
| 35 | canvas->restore(); |
mtklein | 4afe21e | 2015-04-17 06:32:13 -0700 | [diff] [blame] | 36 | } |