blob: 0cac81a9f9c422f12ac18c8f78d3004135c129c4 [file] [log] [blame]
halcanary86e5ab62015-04-14 06:25:19 -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
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "gm/gm.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -04009#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"
Michael Ludwig898bbfa2019-08-02 15:21:23 -040015#include "include/effects/SkImageFilters.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040016
17#include <utility>
halcanary86e5ab62015-04-14 06:25:19 -070018
19// This GM renders correctly in 8888, but fails in PDF
20DEF_SIMPLE_GM(fadefilter, canvas, 256, 256) {
Mike Reede869a1e2019-04-30 12:18:54 -040021 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));
halcanary86e5ab62015-04-14 06:25:19 -070026 SkPaint layerPaint;
Michael Ludwig898bbfa2019-08-02 15:21:23 -040027 layerPaint.setImageFilter(SkImageFilters::ColorFilter(std::move(colorFilter), nullptr));
halcanary86e5ab62015-04-14 06:25:19 -070028 canvas->drawRect(SkRect::MakeLTRB(64, 64, 192, 192), layerPaint);
29}