• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "sk_tool_utils.h"
10 
11 DEF_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);
20         p.setColor(0xFC208000);
21         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);
25         canvas->saveLayer(nullptr, nullptr);
26             p.setColor(0xFC208000);
27             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);
32         canvas->saveLayerAlpha(nullptr, 0xFC);
33             p.setColor(sk_tool_utils::color_to_565(0xFF208000));
34             canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p);
35         canvas->restore();
36     canvas->restore();
37 }
38