22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5+ #include < utility>
6+
57#include " flutter/display_list/display_list.h"
68#include " flutter/display_list/display_list_canvas_dispatcher.h"
79#include " flutter/display_list/display_list_canvas_recorder.h"
@@ -239,7 +241,8 @@ static void EmptyDlRenderer(DisplayListBuilder&) {}
239241
240242class RenderSurface {
241243 public:
242- explicit RenderSurface (sk_sp<SkSurface> surface) : surface_(surface) {
244+ explicit RenderSurface (sk_sp<SkSurface> surface)
245+ : surface_(std::move(surface)) {
243246 EXPECT_EQ (canvas ()->save (), 1 );
244247 }
245248 ~RenderSurface () { sk_free (addr_); }
@@ -597,10 +600,10 @@ class TestParameters {
597600class CaseParameters {
598601 public:
599602 explicit CaseParameters (std::string info)
600- : CaseParameters(info, EmptyCvRenderer, EmptyDlRenderer) {}
603+ : CaseParameters(std::move( info) , EmptyCvRenderer, EmptyDlRenderer) {}
601604
602- CaseParameters (std::string info, CvSetup cv_setup, DlRenderer dl_setup)
603- : CaseParameters(info,
605+ CaseParameters (std::string info, CvSetup& cv_setup, DlRenderer& dl_setup)
606+ : CaseParameters(std::move( info) ,
604607 cv_setup,
605608 dl_setup,
606609 EmptyCvRenderer,
@@ -611,15 +614,15 @@ class CaseParameters {
611614 false ) {}
612615
613616 CaseParameters (std::string info,
614- CvSetup cv_setup,
615- DlRenderer dl_setup,
616- CvRenderer cv_restore,
617- DlRenderer dl_restore,
617+ CvSetup& cv_setup,
618+ DlRenderer& dl_setup,
619+ CvRenderer& cv_restore,
620+ DlRenderer& dl_restore,
618621 DlColor bg,
619622 bool has_diff_clip,
620623 bool has_mutating_save_layer,
621624 bool fuzzy_compare_components)
622- : info_(info),
625+ : info_(std::move( info) ),
623626 bg_ (bg),
624627 cv_setup_(cv_setup),
625628 dl_setup_(dl_setup),
@@ -629,8 +632,8 @@ class CaseParameters {
629632 has_mutating_save_layer_(has_mutating_save_layer),
630633 fuzzy_compare_components_(fuzzy_compare_components) {}
631634
632- CaseParameters with_restore (CvRenderer cv_restore,
633- DlRenderer dl_restore,
635+ CaseParameters with_restore (CvRenderer& cv_restore,
636+ DlRenderer& dl_restore,
634637 bool mutating_layer,
635638 bool fuzzy_compare_components = false ) {
636639 return CaseParameters (info_, cv_setup_, dl_setup_, cv_restore, dl_restore,
@@ -1945,9 +1948,9 @@ class CanvasCompareTester {
19451948 }
19461949
19471950 static void checkGroupOpacity (const RenderEnvironment& env,
1948- sk_sp<DisplayList> display_list,
1951+ const sk_sp<DisplayList>& display_list,
19491952 const SkPixmap* ref_pixmap,
1950- const std::string info,
1953+ const std::string& info,
19511954 DlColor bg) {
19521955 SkScalar opacity = 128.0 / 255.0 ;
19531956
@@ -2002,7 +2005,7 @@ class CanvasCompareTester {
20022005
20032006 static void checkPixels (const SkPixmap* ref_pixels,
20042007 const SkRect ref_bounds,
2005- const std::string info,
2008+ const std::string& info,
20062009 const DlColor bg) {
20072010 uint32_t untouched = bg.premultipliedArgb ();
20082011 int pixels_touched = 0 ;
@@ -2026,7 +2029,7 @@ class CanvasCompareTester {
20262029 static void quickCompareToReference (const SkPixmap* ref_pixels,
20272030 const SkPixmap* test_pixels,
20282031 bool should_match,
2029- const std::string info) {
2032+ const std::string& info) {
20302033 ASSERT_EQ (test_pixels->width (), ref_pixels->width ()) << info;
20312034 ASSERT_EQ (test_pixels->height (), ref_pixels->height ()) << info;
20322035 ASSERT_EQ (test_pixels->info ().bytesPerPixel (), 4 ) << info;
@@ -2050,7 +2053,7 @@ class CanvasCompareTester {
20502053
20512054 static void compareToReference (const SkPixmap* test_pixels,
20522055 const SkPixmap* ref_pixels,
2053- const std::string info,
2056+ const std::string& info,
20542057 SkRect* bounds,
20552058 const BoundsTolerance* tolerance,
20562059 const DlColor bg,
@@ -2121,7 +2124,7 @@ class CanvasCompareTester {
21212124 ASSERT_EQ (pixels_different, 0 ) << info;
21222125 }
21232126
2124- static void showBoundsOverflow (std::string info,
2127+ static void showBoundsOverflow (const std::string& info,
21252128 SkIRect& bounds,
21262129 const BoundsTolerance* tolerance,
21272130 int pixLeft,
@@ -2186,7 +2189,7 @@ class CanvasCompareTester {
21862189
21872190 static const DlImageColorSource kTestImageColorSource ;
21882191
2189- static sk_sp<SkTextBlob> MakeTextBlob (std::string string,
2192+ static sk_sp<SkTextBlob> MakeTextBlob (const std::string& string,
21902193 SkScalar font_height) {
21912194 SkFont font (SkTypeface::MakeFromName (" ahem" , SkFontStyle::Normal ()),
21922195 font_height);
0 commit comments