2015-04-14 13:25:19 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gm.h"
|
|
|
|
#include "SkColorMatrixFilter.h"
|
|
|
|
#include "SkColorFilterImageFilter.h"
|
|
|
|
|
|
|
|
// This GM renders correctly in 8888, but fails in PDF
|
|
|
|
DEF_SIMPLE_GM(fadefilter, canvas, 256, 256) {
|
|
|
|
SkScalar matrix[20] = { 1, 0, 0, 0, 128.0f,
|
|
|
|
0, 1, 0, 0, 128.0f,
|
|
|
|
0, 0, 1, 0, 128.0f,
|
|
|
|
0, 0, 0, 1, 0 };
|
2019-04-08 20:23:20 +00:00
|
|
|
sk_sp<SkColorFilter> colorFilter(SkColorFilters::MatrixRowMajor255(matrix));
|
2015-04-14 13:25:19 +00:00
|
|
|
SkPaint layerPaint;
|
2016-04-05 18:50:42 +00:00
|
|
|
layerPaint.setImageFilter(SkColorFilterImageFilter::Make(std::move(colorFilter), nullptr));
|
2015-04-14 13:25:19 +00:00
|
|
|
canvas->drawRect(SkRect::MakeLTRB(64, 64, 192, 192), layerPaint);
|
|
|
|
}
|