• 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/gm.h"
9 #include "include/core/SkCanvas.h"
10 #include "include/core/SkColorFilter.h"
11 #include "include/core/SkImageFilter.h"
12 #include "include/core/SkPaint.h"
13 #include "include/core/SkRect.h"
14 #include "include/core/SkRefCnt.h"
15 #include "include/effects/SkImageFilters.h"
16 
17 #include <utility>
18 
19 // This GM renders correctly in 8888, but fails in PDF
20 DEF_SIMPLE_GM(fadefilter, canvas, 256, 256) {
21     float matrix[20] = { 1, 0, 0, 0, 0.5f,
22                          0, 1, 0, 0, 0.5f,
23                          0, 0, 1, 0, 0.5f,
24                          0, 0, 0, 1, 0 };
25     sk_sp<SkColorFilter> colorFilter(SkColorFilters::Matrix(matrix));
26     SkPaint layerPaint;
27     layerPaint.setImageFilter(SkImageFilters::ColorFilter(std::move(colorFilter), nullptr));
28     canvas->drawRect(SkRect::MakeLTRB(64, 64, 192, 192), layerPaint);
29 }
30