Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: skia/ext/analysis_canvas_unittest.cc

Issue 2509983004: Revert "Change call-sites now that SkCanvas is not ref-counted" (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | skia/ext/bitmap_platform_device_cairo.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "skia/ext/analysis_canvas.h" 7 #include "skia/ext/analysis_canvas.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/skia/include/core/SkPicture.h" 9 #include "third_party/skia/include/core/SkPicture.h"
10 #include "third_party/skia/include/core/SkPictureRecorder.h" 10 #include "third_party/skia/include/core/SkPictureRecorder.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 SolidColorFill(canvas); 322 SolidColorFill(canvas);
323 EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor)); 323 EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
324 EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor); 324 EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
325 } 325 }
326 326
327 TEST(AnalysisCanvasTest, EarlyOutNotSolid) { 327 TEST(AnalysisCanvasTest, EarlyOutNotSolid) {
328 SkRTreeFactory factory; 328 SkRTreeFactory factory;
329 SkPictureRecorder recorder; 329 SkPictureRecorder recorder;
330 330
331 // Create a picture with 3 commands, last of which is non-solid. 331 // Create a picture with 3 commands, last of which is non-solid.
332 SkCanvas* record_canvas = recorder.beginRecording(256, 256, &factory); 332 sk_sp<SkCanvas> record_canvas = sk_ref_sp(recorder.beginRecording(256, 256, &f actory));
333 333
334 std::string text = "text"; 334 std::string text = "text";
335 SkPoint point = SkPoint::Make(SkIntToScalar(25), SkIntToScalar(25)); 335 SkPoint point = SkPoint::Make(SkIntToScalar(25), SkIntToScalar(25));
336 336
337 SkPaint paint; 337 SkPaint paint;
338 paint.setColor(SkColorSetARGB(255, 255, 255, 255)); 338 paint.setColor(SkColorSetARGB(255, 255, 255, 255));
339 paint.setBlendMode(SkBlendMode::kSrcOver); 339 paint.setBlendMode(SkBlendMode::kSrcOver);
340 340
341 record_canvas->drawRect(SkRect::MakeWH(256, 256), paint); 341 record_canvas->drawRect(SkRect::MakeWH(256, 256), paint);
342 record_canvas->drawRect(SkRect::MakeWH(256, 256), paint); 342 record_canvas->drawRect(SkRect::MakeWH(256, 256), paint);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 446
447 SkRRect rr; 447 SkRRect rr;
448 rr.setRectRadii(bounding_rect, radii); 448 rr.setRectRadii(bounding_rect, radii);
449 449
450 canvas.clipRRect(rr); 450 canvas.clipRRect(rr);
451 EXPECT_EQ(cases[i].expected, canvas.GetColorIfSolid(&outputColor)) << i; 451 EXPECT_EQ(cases[i].expected, canvas.GetColorIfSolid(&outputColor)) << i;
452 } 452 }
453 } 453 }
454 454
455 } // namespace skia 455 } // namespace skia
OLDNEW
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | skia/ext/bitmap_platform_device_cairo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698