Flutter Engine
 
Loading...
Searching...
No Matches
display_list_raster_cache_item.h
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#ifndef FLUTTER_FLOW_LAYERS_DISPLAY_LIST_RASTER_CACHE_ITEM_H_
6#define FLUTTER_FLOW_LAYERS_DISPLAY_LIST_RASTER_CACHE_ITEM_H_
7
8#if !SLIMPELLER
9
10#include <memory>
11#include <optional>
12
16#include "third_party/skia/include/core/SkMatrix.h"
17#include "third_party/skia/include/core/SkPoint.h"
18
19namespace flutter {
20
22 public:
23 DisplayListRasterCacheItem(const sk_sp<DisplayList>& display_list,
24 const SkPoint& offset,
25 bool is_complex = true,
26 bool will_change = false);
27
28 static std::unique_ptr<DisplayListRasterCacheItem> Make(
29 const sk_sp<DisplayList>&,
30 const SkPoint& offset,
31 bool is_complex,
32 bool will_change);
33
34 void PrerollSetup(PrerollContext* context, const DlMatrix& matrix) override;
35
36 void PrerollFinalize(PrerollContext* context,
37 const DlMatrix& matrix) override;
38
39 bool Draw(const PaintContext& context, const DlPaint* paint) const override;
40
41 bool Draw(const PaintContext& context,
42 DlCanvas* canvas,
43 const DlPaint* paint) const override;
44
45 bool TryToPrepareRasterCache(const PaintContext& context,
46 bool parent_cached = false) const override;
47
48 void ModifyMatrix(SkPoint offset) const {
49 matrix_ = matrix_.preTranslate(offset.x(), offset.y());
50 }
51
52 const DisplayList* display_list() const { return display_list_.get(); }
53
54 private:
55 SkMatrix transformation_matrix_;
56 sk_sp<DisplayList> display_list_;
57 SkPoint offset_;
58 bool is_complex_;
59 bool will_change_;
60};
61
62} // namespace flutter
63
64#else // !SLIMPELLER
65
66class DisplayListRasterCacheItem;
67
68#endif // !SLIMPELLER
69
70#endif // FLUTTER_FLOW_LAYERS_DISPLAY_LIST_RASTER_CACHE_ITEM_H_
void PrerollSetup(PrerollContext *context, const DlMatrix &matrix) override
void PrerollFinalize(PrerollContext *context, const DlMatrix &matrix) override
bool TryToPrepareRasterCache(const PaintContext &context, bool parent_cached=false) const override
static std::unique_ptr< DisplayListRasterCacheItem > Make(const sk_sp< DisplayList > &, const SkPoint &offset, bool is_complex, bool will_change)
bool Draw(const PaintContext &context, const DlPaint *paint) const override
Developer-facing API for rendering anything within the engine.
Definition dl_canvas.h:32
A 4x4 matrix using column-major storage.
Definition matrix.h:37