Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
DM::BisectSrc Class Reference

#include <DMSrcSink.h>

Inheritance diagram for DM::BisectSrc:
DM::SKPSrc DM::Src

Public Member Functions

 BisectSrc (Path path, const char *trail)
 
Result draw (SkCanvas *, GraphiteTestContext *) const override
 
- Public Member Functions inherited from DM::SKPSrc
 SKPSrc (Path path)
 
Result draw (SkCanvas *, GraphiteTestContext *) const override
 
SkISize size () const override
 
Name name () const override
 
- Public Member Functions inherited from DM::Src
virtual ~Src ()
 
virtual Result draw (SkCanvas *canvas, GraphiteTestContext *) const =0
 
virtual SkISize size () const =0
 
virtual Name name () const =0
 
virtual void modifyGrContextOptions (GrContextOptions *) const
 
virtual void modifyGraphiteContextOptions (skgpu::graphite::ContextOptions *) const
 
virtual bool veto (SinkFlags) const
 
virtual int pageCount () const
 
virtual Result draw (int page, SkCanvas *canvas, GraphiteTestContext *graphiteTestContext) const
 
virtual SkISize size (int page) const
 
virtual bool serial () const
 

Additional Inherited Members

- Public Types inherited from DM::Src
using GraphiteTestContext = skiatest::graphite::GraphiteTestContext
 

Detailed Description

Definition at line 280 of file DMSrcSink.h.

Constructor & Destructor Documentation

◆ BisectSrc()

DM::BisectSrc::BisectSrc ( Path  path,
const char *  trail 
)
explicit

Definition at line 1214 of file DMSrcSink.cpp.

1214: INHERITED(path), fTrail(trail) {}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

Member Function Documentation

◆ draw()

Result DM::BisectSrc::draw ( SkCanvas canvas,
GraphiteTestContext testContext 
) const
overridevirtual

Reimplemented from DM::SKPSrc.

Definition at line 1216 of file DMSrcSink.cpp.

1216 {
1217 struct FoundPath {
1218 SkPath fPath;
1219 SkPaint fPaint;
1221 };
1222
1223 // This subclass of SkCanvas just extracts all the SkPaths (drawn via drawPath) from an SKP.
1224 class PathFindingCanvas : public SkCanvas {
1225 public:
1226 PathFindingCanvas(int width, int height) : SkCanvas(width, height, nullptr) {}
1227 const TArray<FoundPath>& foundPaths() const { return fFoundPaths; }
1228
1229 private:
1230 void onDrawPath(const SkPath& path, const SkPaint& paint) override {
1231 fFoundPaths.push_back() = {path, paint, this->getTotalMatrix()};
1232 }
1233
1234 TArray<FoundPath> fFoundPaths;
1235 };
1236
1237 PathFindingCanvas pathFinder(canvas->getBaseLayerSize().width(),
1238 canvas->getBaseLayerSize().height());
1239 Result result = this->INHERITED::draw(&pathFinder, testContext);
1240 if (!result.isOk()) {
1241 return result;
1242 }
1243
1244 int start = 0, end = pathFinder.foundPaths().size();
1245 for (const char* ch = fTrail.c_str(); *ch; ++ch) {
1246 int midpt = (start + end) / 2;
1247 if ('l' == *ch) {
1248 start = midpt;
1249 } else if ('r' == *ch) {
1250 end = midpt;
1251 }
1252 }
1253
1254 for (int i = start; i < end; ++i) {
1255 const FoundPath& path = pathFinder.foundPaths()[i];
1256 SkAutoCanvasRestore acr(canvas, true);
1257 canvas->concat(path.fViewMatrix);
1258 canvas->drawPath(path.fPath, path.fPaint);
1259 }
1260
1261 return Result::Ok();
1262}
SkPath fPath
SkMatrix fViewMatrix
static Result Ok()
Definition: DMSrcSink.h:50
Result draw(SkCanvas *, GraphiteTestContext *) const override
Definition: DMSrcSink.cpp:1137
virtual SkISize getBaseLayerSize() const
Definition: SkCanvas.cpp:369
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318
Definition: SkPath.h:59
const char * c_str() const
Definition: SkString.h:133
const Paint & paint
Definition: color_source.cc:38
glong glong end
GAsyncResult * result
int32_t height
int32_t width
constexpr int32_t width() const
Definition: SkSize.h:36
constexpr int32_t height() const
Definition: SkSize.h:37

The documentation for this class was generated from the following files: