/* * Copyright 2013 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkLumaColorFilter.h" #include "SkPM4f.h" #include "SkColorData.h" #include "SkRasterPipeline.h" #include "SkString.h" #if SK_SUPPORT_GPU #include "GrContext.h" #include "effects/GrLumaColorFilterEffect.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #endif void SkLumaColorFilter::onAppendStages(SkRasterPipeline* p, SkColorSpace* dst, SkArenaAlloc* scratch, bool shaderIsOpaque) const { p->append(SkRasterPipeline::luminance_to_alpha); } sk_sp SkLumaColorFilter::Make() { return sk_sp(new SkLumaColorFilter); } SkLumaColorFilter::SkLumaColorFilter() : INHERITED() {} sk_sp SkLumaColorFilter::CreateProc(SkReadBuffer&) { return Make(); } void SkLumaColorFilter::flatten(SkWriteBuffer&) const {} #if SK_SUPPORT_GPU std::unique_ptr SkLumaColorFilter::asFragmentProcessor( GrContext*, const GrColorSpaceInfo&) const { return GrLumaColorFilterEffect::Make(); } #endif