1/* 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 8@class { 9 #include "SkColorData.h" 10 11 GrColor4f constantOutputForConstantInput(GrColor4f input) const override { 12 float luma = SK_ITU_BT709_LUM_COEFF_R * input.fRGBA[0] + 13 SK_ITU_BT709_LUM_COEFF_G * input.fRGBA[1] + 14 SK_ITU_BT709_LUM_COEFF_B * input.fRGBA[2]; 15 return GrColor4f(0, 0, 0, luma); 16 } 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}