Flutter Engine
color_filter_layer.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "flutter/flow/layers/color_filter_layer.h"
6 
7 namespace flutter {
8 
9 ColorFilterLayer::ColorFilterLayer(sk_sp<SkColorFilter> filter)
10  : filter_(std::move(filter)) {}
11 
13  const SkMatrix& matrix) {
16  ContainerLayer::Preroll(context, matrix);
17 }
18 
19 void ColorFilterLayer::Paint(PaintContext& context) const {
20  TRACE_EVENT0("flutter", "ColorFilterLayer::Paint");
22 
23  SkPaint paint;
24  paint.setColorFilter(filter_);
25 
27  Layer::AutoSaveLayer::Create(context, paint_bounds(), &paint);
28  PaintChildren(context);
29 }
30 
31 } // namespace flutter
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:75
#define FML_DCHECK(condition)
Definition: logging.h:86
Definition: ref_ptr.h:252
static AutoSaveLayer Create(const PaintContext &paint_context, const SkRect &bounds, const SkPaint *paint)
Definition: layer.cc:96
void Paint(PaintContext &context) const override
ColorFilterLayer(sk_sp< SkColorFilter > filter)
bool needs_painting() const
Definition: layer.h:174
static AutoPrerollSaveLayerState Create(PrerollContext *preroll_context, bool save_layer_is_active=true, bool layer_itself_performs_readback=false)
Definition: layer.cc:43
const SkRect & paint_bounds() const
Definition: layer.h:166
void Preroll(PrerollContext *context, const SkMatrix &matrix) override
void Preroll(PrerollContext *context, const SkMatrix &matrix) override
void PaintChildren(PaintContext &context) const