Skip to content

Commit

Permalink
Revert "Revert "Revert "Reland PerformanceOverlayLayer golden test (f…
Browse files Browse the repository at this point in the history
…lutter#7863)" (flutter#7895)" (flutter#7911)" (flutter#7916)

This breaks the Linux build with:
```
[ RUN      ] PerformanceOverlayLayer.Gold
../../flutter/flow/layers/performance_overlay_layer_unittests.cc:70: Failure
Value of: golden_data != nullptr
  Actual: false
Expected: true
Golden file not found: "/b/s/w/ir/k/src/flutter/testing/resources"/performance_overlay_gold.png.
Please either set --golden-dir, or make sure that the unit test is run from the right directory (e.g., flutter/engine/src).
```

This reverts commit 3f0ce76.
  • Loading branch information
cbracken authored Feb 22, 2019
1 parent 5db4b37 commit f1f19bb
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 234 deletions.
5 changes: 0 additions & 5 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ FILE: ../../../flutter/flow/layers/opacity_layer.cc
FILE: ../../../flutter/flow/layers/opacity_layer.h
FILE: ../../../flutter/flow/layers/performance_overlay_layer.cc
FILE: ../../../flutter/flow/layers/performance_overlay_layer.h
FILE: ../../../flutter/flow/layers/performance_overlay_layer_unittests.cc
FILE: ../../../flutter/flow/layers/physical_shape_layer.cc
FILE: ../../../flutter/flow/layers/physical_shape_layer.h
FILE: ../../../flutter/flow/layers/picture_layer.cc
Expand Down Expand Up @@ -728,13 +727,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
====================================================================================================

====================================================================================================
LIBRARY: engine
LIBRARY: txt
ORIGIN: ../../../flutter/third_party/txt/LICENSE
TYPE: LicenseType.apache
FILE: ../../../flutter/flow/flow_run_all_unittests.cc
FILE: ../../../flutter/flow/flow_test_utils.cc
FILE: ../../../flutter/flow/flow_test_utils.h
FILE: ../../../flutter/third_party/txt/benchmarks/paint_record_benchmarks.cc
FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_benchmarks.cc
FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_builder_benchmarks.cc
Expand Down
7 changes: 1 addition & 6 deletions flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,13 @@ executable("flow_unittests") {
testonly = true

sources = [
"flow_run_all_unittests.cc",
"flow_test_utils.h",
"flow_test_utils.cc",
"matrix_decomposition_unittests.cc",
"raster_cache_unittests.cc",
"layers/performance_overlay_layer_unittests.cc",
]

deps = [
":flow",
"$flutter_root/fml",
"//third_party/googletest:gtest",
"$flutter_root/testing",
"//third_party/dart/runtime:libdart_jit", # for tracing
"//third_party/skia",
]
Expand Down
32 changes: 0 additions & 32 deletions flow/flow_run_all_unittests.cc

This file was deleted.

40 changes: 0 additions & 40 deletions flow/flow_test_utils.cc

This file was deleted.

29 changes: 0 additions & 29 deletions flow/flow_test_utils.h

This file was deleted.

31 changes: 10 additions & 21 deletions flow/layers/performance_overlay_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ namespace {
void DrawStatisticsText(SkCanvas& canvas,
const std::string& string,
int x,
int y,
const std::string& font_path) {
int y) {
SkFont font;
if (font_path != "") {
font = SkFont(SkTypeface::MakeFromFile(font_path.c_str()));
}
font.setSize(15);
font.setLinearMetrics(false);
SkPaint paint;
Expand All @@ -37,8 +33,7 @@ void VisualizeStopWatch(SkCanvas& canvas,
SkScalar height,
bool show_graph,
bool show_labels,
const std::string& label_prefix,
const std::string& font_path) {
const std::string& label_prefix) {
const int label_x = 8; // distance from x
const int label_y = -10; // distance from y+height

Expand All @@ -56,20 +51,14 @@ void VisualizeStopWatch(SkCanvas& canvas,
stream << label_prefix << " "
<< "max " << max_ms_per_frame << " ms/frame, "
<< "avg " << average_ms_per_frame << " ms/frame";
DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y,
font_path);
DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y);
}
}

} // namespace

PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options,
const char* font_path)
: options_(options) {
if (font_path != nullptr) {
font_path_ = font_path;
}
}
PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options)
: options_(options) {}

void PerformanceOverlayLayer::Paint(PaintContext& context) const {
const int padding = 8;
Expand All @@ -84,15 +73,15 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const {
SkScalar height = paint_bounds().height() / 2;
SkAutoCanvasRestore save(context.leaf_nodes_canvas, true);

VisualizeStopWatch(
*context.leaf_nodes_canvas, context.frame_time, x, y, width,
height - padding, options_ & kVisualizeRasterizerStatistics,
options_ & kDisplayRasterizerStatistics, "GPU", font_path_);
VisualizeStopWatch(*context.leaf_nodes_canvas, context.frame_time, x, y,
width, height - padding,
options_ & kVisualizeRasterizerStatistics,
options_ & kDisplayRasterizerStatistics, "GPU");

VisualizeStopWatch(*context.leaf_nodes_canvas, context.engine_time, x,
y + height, width, height - padding,
options_ & kVisualizeEngineStatistics,
options_ & kDisplayEngineStatistics, "UI", font_path_);
options_ & kDisplayEngineStatistics, "UI");
}

} // namespace flow
6 changes: 1 addition & 5 deletions flow/layers/performance_overlay_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#ifndef FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_
#define FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_

#include <string>

#include "flutter/flow/layers/layer.h"
#include "flutter/fml/macros.h"

Expand All @@ -19,14 +17,12 @@ const int kVisualizeEngineStatistics = 1 << 3;

class PerformanceOverlayLayer : public Layer {
public:
explicit PerformanceOverlayLayer(uint64_t options,
const char* font_path = nullptr);
explicit PerformanceOverlayLayer(uint64_t options);

void Paint(PaintContext& context) const override;

private:
int options_;
std::string font_path_;

FML_DISALLOW_COPY_AND_ASSIGN(PerformanceOverlayLayer);
};
Expand Down
96 changes: 0 additions & 96 deletions flow/layers/performance_overlay_layer_unittests.cc

This file was deleted.

Binary file removed testing/resources/performance_overlay_gold.png
Binary file not shown.

0 comments on commit f1f19bb

Please sign in to comment.