Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 14d38f8

Browse files
authored
Re-write docs for DlSkCanvas{Adapter|Dispatcher}. (#44961)
Closes flutter/flutter#132994. I suspect this is imperfect, so please suggest any changes or additions (either using GitHub's tooling or as a review comment). /cc @dnfield
1 parent 571735b commit 14d38f8

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed

display_list/dl_canvas.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@
2020

2121
namespace flutter {
2222

23-
// The primary class used to express rendering operations in the
24-
// DisplayList ecosystem. This class is an API-only virtual class and
25-
// can be used to talk to a DisplayListBuilder to record a series of
26-
// rendering operations, or it could be the public facing API of an
27-
// adapter that forwards the calls to another rendering module, like
28-
// Skia.
29-
//
30-
// Developers familiar with Skia's SkCanvas API will be immediately
31-
// familiar with the methods below as they follow that API closely
32-
// but with DisplayList objects and values used as data instead.
23+
//------------------------------------------------------------------------------
24+
/// @brief Developer-facing API for rendering anything *within* the engine.
25+
///
26+
/// |DlCanvas| should be used to render anything in the framework classes (i.e.
27+
/// `lib/ui`), flow and flow layers, embedders, shell, and elsewhere.
28+
///
29+
/// The only state carried by implementations of this interface are the clip
30+
/// and transform which are saved and restored by the |save|, |saveLayer|, and
31+
/// |restore| calls.
32+
///
33+
/// @note The interface resembles closely the familiar |SkCanvas| interface
34+
/// used throughout the engine.
3335
class DlCanvas {
3436
public:
3537
enum class ClipOp {

display_list/dl_op_receiver.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,22 @@ namespace flutter {
2323
class DisplayList;
2424

2525
//------------------------------------------------------------------------------
26-
/// @brief The pure virtual interface for interacting with a display list.
27-
/// This interface represents the methods used to build a list
28-
/// through the DisplayListBuilder and also the methods that will be
29-
/// invoked through the DisplayList::dispatch() method.
26+
/// @brief Internal API for rendering recorded display lists to backends.
3027
///
28+
/// The |DisplayList| object will play back recorded operations in this format.
29+
/// Most developers should not need to deal with this interface unless they are
30+
/// writing a utility that needs to examine the contents of a display list.
31+
///
32+
/// Similar to |DlCanvas|, this interface carries clip and transform state
33+
/// which are saved and restored by the |save|, |saveLayer|, and |restore|
34+
/// calls.
35+
///
36+
/// Unlike DlCanvas, this interface has attribute state which is global across
37+
/// an entire DisplayList (not affected by save/restore).
38+
///
39+
/// @see DlSkCanvasDispatcher
40+
/// @see impeller::DlDispatcher
41+
/// @see DlOpSpy
3142
class DlOpReceiver {
3243
protected:
3344
using ClipOp = DlCanvas::ClipOp;

display_list/skia/dl_sk_canvas.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
namespace flutter {
1212

13-
// An adapter to receive DlCanvas calls and dispatch them into
14-
// an SkCanvas.
13+
// -----------------------------------------------------------------------------
14+
/// @brief Backend implementation of |DlCanvas| for |SkCanvas|.
15+
///
16+
/// @see DlCanvas
1517
class DlSkCanvasAdapter final : public virtual DlCanvas {
1618
public:
1719
DlSkCanvasAdapter() : delegate_(nullptr) {}

display_list/skia/dl_sk_dispatcher.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
namespace flutter {
1515

1616
//------------------------------------------------------------------------------
17-
/// Can be fed to the dispatch() method of a DisplayList to feed the resulting
18-
/// rendering operations to an SkCanvas instance.
19-
///
20-
/// Receives all methods on Dispatcher and sends them to an SkCanvas
17+
/// @brief Backend implementation of |DlOpReceiver| for |SkCanvas|.
2118
///
19+
/// @see DlOpReceiver
2220
class DlSkCanvasDispatcher : public virtual DlOpReceiver,
2321
public DlSkPaintDispatchHelper {
2422
public:

0 commit comments

Comments
 (0)