blob: f53139ee253107ad50bccc9f0ba4c01ced7b64b3 [file] [log] [blame]
Ethan Nicholas130fb3f2018-02-01 12:14:34 -05001/*
2 * Copyright 2018 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
Ethan Nicholas14efcbf2017-11-07 09:23:38 -05008@class {
9 #include "SkColorData.h"
10
Brian Osman1d5b5982018-10-01 13:41:39 -040011 SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override {
12 float luma = SK_ITU_BT709_LUM_COEFF_R * input.fR +
13 SK_ITU_BT709_LUM_COEFF_G * input.fG +
14 SK_ITU_BT709_LUM_COEFF_B * input.fB;
15 return { 0, 0, 0, luma };
Ethan Nicholas14efcbf2017-11-07 09:23:38 -050016 }
17}
18
19void main() {
20 const half3 SK_ITU_BT709_LUM_COEFF = half3(0.2126, 0.7152, 0.0722);
21 half luma = dot(SK_ITU_BT709_LUM_COEFF, sk_InColor.rgb);
22 sk_OutColor = half4(0, 0, 0, luma);
23}