2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
+ #include < utility>
6
+
5
7
#include " flutter/display_list/display_list.h"
6
8
#include " flutter/display_list/display_list_canvas_dispatcher.h"
7
9
#include " flutter/display_list/display_list_canvas_recorder.h"
@@ -239,7 +241,8 @@ static void EmptyDlRenderer(DisplayListBuilder&) {}
239
241
240
242
class RenderSurface {
241
243
public:
242
- explicit RenderSurface (sk_sp<SkSurface> surface) : surface_(surface) {
244
+ explicit RenderSurface (sk_sp<SkSurface> surface)
245
+ : surface_(std::move(surface)) {
243
246
EXPECT_EQ (canvas ()->save (), 1 );
244
247
}
245
248
~RenderSurface () { sk_free (addr_); }
@@ -597,10 +600,10 @@ class TestParameters {
597
600
class CaseParameters {
598
601
public:
599
602
explicit CaseParameters (std::string info)
600
- : CaseParameters(info, EmptyCvRenderer, EmptyDlRenderer) {}
603
+ : CaseParameters(std::move( info) , EmptyCvRenderer, EmptyDlRenderer) {}
601
604
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) ,
604
607
cv_setup,
605
608
dl_setup,
606
609
EmptyCvRenderer,
@@ -611,15 +614,15 @@ class CaseParameters {
611
614
false ) {}
612
615
613
616
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,
618
621
DlColor bg,
619
622
bool has_diff_clip,
620
623
bool has_mutating_save_layer,
621
624
bool fuzzy_compare_components)
622
- : info_(info),
625
+ : info_(std::move( info) ),
623
626
bg_ (bg),
624
627
cv_setup_(cv_setup),
625
628
dl_setup_(dl_setup),
@@ -629,8 +632,8 @@ class CaseParameters {
629
632
has_mutating_save_layer_(has_mutating_save_layer),
630
633
fuzzy_compare_components_(fuzzy_compare_components) {}
631
634
632
- CaseParameters with_restore (CvRenderer cv_restore,
633
- DlRenderer dl_restore,
635
+ CaseParameters with_restore (CvRenderer& cv_restore,
636
+ DlRenderer& dl_restore,
634
637
bool mutating_layer,
635
638
bool fuzzy_compare_components = false ) {
636
639
return CaseParameters (info_, cv_setup_, dl_setup_, cv_restore, dl_restore,
@@ -1945,9 +1948,9 @@ class CanvasCompareTester {
1945
1948
}
1946
1949
1947
1950
static void checkGroupOpacity (const RenderEnvironment& env,
1948
- sk_sp<DisplayList> display_list,
1951
+ const sk_sp<DisplayList>& display_list,
1949
1952
const SkPixmap* ref_pixmap,
1950
- const std::string info,
1953
+ const std::string& info,
1951
1954
DlColor bg) {
1952
1955
SkScalar opacity = 128.0 / 255.0 ;
1953
1956
@@ -2002,7 +2005,7 @@ class CanvasCompareTester {
2002
2005
2003
2006
static void checkPixels (const SkPixmap* ref_pixels,
2004
2007
const SkRect ref_bounds,
2005
- const std::string info,
2008
+ const std::string& info,
2006
2009
const DlColor bg) {
2007
2010
uint32_t untouched = bg.premultipliedArgb ();
2008
2011
int pixels_touched = 0 ;
@@ -2026,7 +2029,7 @@ class CanvasCompareTester {
2026
2029
static void quickCompareToReference (const SkPixmap* ref_pixels,
2027
2030
const SkPixmap* test_pixels,
2028
2031
bool should_match,
2029
- const std::string info) {
2032
+ const std::string& info) {
2030
2033
ASSERT_EQ (test_pixels->width (), ref_pixels->width ()) << info;
2031
2034
ASSERT_EQ (test_pixels->height (), ref_pixels->height ()) << info;
2032
2035
ASSERT_EQ (test_pixels->info ().bytesPerPixel (), 4 ) << info;
@@ -2050,7 +2053,7 @@ class CanvasCompareTester {
2050
2053
2051
2054
static void compareToReference (const SkPixmap* test_pixels,
2052
2055
const SkPixmap* ref_pixels,
2053
- const std::string info,
2056
+ const std::string& info,
2054
2057
SkRect* bounds,
2055
2058
const BoundsTolerance* tolerance,
2056
2059
const DlColor bg,
@@ -2121,7 +2124,7 @@ class CanvasCompareTester {
2121
2124
ASSERT_EQ (pixels_different, 0 ) << info;
2122
2125
}
2123
2126
2124
- static void showBoundsOverflow (std::string info,
2127
+ static void showBoundsOverflow (const std::string& info,
2125
2128
SkIRect& bounds,
2126
2129
const BoundsTolerance* tolerance,
2127
2130
int pixLeft,
@@ -2186,7 +2189,7 @@ class CanvasCompareTester {
2186
2189
2187
2190
static const DlImageColorSource kTestImageColorSource ;
2188
2191
2189
- static sk_sp<SkTextBlob> MakeTextBlob (std::string string,
2192
+ static sk_sp<SkTextBlob> MakeTextBlob (const std::string& string,
2190
2193
SkScalar font_height) {
2191
2194
SkFont font (SkTypeface::MakeFromName (" ahem" , SkFontStyle::Normal ()),
2192
2195
font_height);
0 commit comments