Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ FILE: ../../../flutter/display_list/display_list_benchmarks.cc
FILE: ../../../flutter/display_list/display_list_benchmarks.h
FILE: ../../../flutter/display_list/display_list_benchmarks_gl.cc
FILE: ../../../flutter/display_list/display_list_benchmarks_metal.cc
FILE: ../../../flutter/display_list/display_list_benchmarks_software.cc
FILE: ../../../flutter/display_list/display_list_builder.cc
FILE: ../../../flutter/display_list/display_list_builder.h
FILE: ../../../flutter/display_list/display_list_canvas_dispatcher.cc
Expand Down
1 change: 1 addition & 0 deletions display_list/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ if (enable_unittests) {
sources = [
"display_list_benchmarks.cc",
"display_list_benchmarks.h",
"display_list_benchmarks_software.cc",
]

deps = [
Expand Down
25 changes: 0 additions & 25 deletions display_list/display_list_benchmarks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,6 @@
namespace flutter {
namespace testing {

class SoftwareCanvasProvider : public CanvasProvider {
public:
virtual ~SoftwareCanvasProvider() = default;
void InitializeSurface(const size_t width, const size_t height) override {
surface_ = SkSurface::MakeRasterN32Premul(width, height);
surface_->getCanvas()->clear(SK_ColorTRANSPARENT);
}

sk_sp<SkSurface> GetSurface() override { return surface_; }

sk_sp<SkSurface> MakeOffscreenSurface(const size_t width,
const size_t height) override {
auto surface = SkSurface::MakeRasterN32Premul(width, height);
surface->getCanvas()->clear(SK_ColorTRANSPARENT);
return surface;
}

const std::string BackendName() override { return "Software"; }

private:
sk_sp<SkSurface> surface_;
};

// Constants chosen to produce benchmark results in the region of 1-50ms
constexpr size_t kLinesToDraw = 10000;
constexpr size_t kRectsToDraw = 5000;
Expand Down Expand Up @@ -1054,7 +1031,5 @@ void BM_DrawShadow(benchmark::State& state,
canvas_provider->Snapshot(filename);
}

RUN_DISPLAYLIST_BENCHMARKS(Software)

} // namespace testing
} // namespace flutter
39 changes: 39 additions & 0 deletions display_list/display_list_benchmarks_software.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/display_list/display_list_benchmarks.h"
#include "flutter/display_list/display_list_builder.h"
#include "third_party/skia/include/core/SkPoint.h"
#include "third_party/skia/include/core/SkTextBlob.h"

namespace flutter {
namespace testing {

class SoftwareCanvasProvider : public CanvasProvider {
public:
virtual ~SoftwareCanvasProvider() = default;
void InitializeSurface(const size_t width, const size_t height) override {
surface_ = SkSurface::MakeRasterN32Premul(width, height);
surface_->getCanvas()->clear(SK_ColorTRANSPARENT);
}

sk_sp<SkSurface> GetSurface() override { return surface_; }

sk_sp<SkSurface> MakeOffscreenSurface(const size_t width,
const size_t height) override {
auto surface = SkSurface::MakeRasterN32Premul(width, height);
surface->getCanvas()->clear(SK_ColorTRANSPARENT);
return surface;
}

const std::string BackendName() override { return "Software"; }

private:
sk_sp<SkSurface> surface_;
};

RUN_DISPLAYLIST_BENCHMARKS(Software)

} // namespace testing
} // namespace flutter