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

Side by Side Diff: content/renderer/skia_benchmarking_extension_unittest.cc

Issue 214603005: Remove explicit Skia save flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | skia/ext/analysis_canvas_unittest.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/renderer/skia_benchmarking_extension.h" 5 #include "content/renderer/skia_benchmarking_extension.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "third_party/skia/include/core/SkGraphics.h" 9 #include "third_party/skia/include/core/SkGraphics.h"
10 #include "third_party/skia/src/utils/debugger/SkDebugCanvas.h" 10 #include "third_party/skia/src/utils/debugger/SkDebugCanvas.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // Prepare canvas and resources. 44 // Prepare canvas and resources.
45 SkDebugCanvas canvas(100, 100); 45 SkDebugCanvas canvas(100, 100);
46 SkPaint red_paint; 46 SkPaint red_paint;
47 red_paint.setColor(SkColorSetARGB(255, 255, 0, 0)); 47 red_paint.setColor(SkColorSetARGB(255, 255, 0, 0));
48 SkRect fullRect = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100)); 48 SkRect fullRect = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100));
49 SkRect fillRect = SkRect::MakeXYWH(SkIntToScalar(25), SkIntToScalar(25), 49 SkRect fillRect = SkRect::MakeXYWH(SkIntToScalar(25), SkIntToScalar(25),
50 SkIntToScalar(50), SkIntToScalar(50)); 50 SkIntToScalar(50), SkIntToScalar(50));
51 51
52 // Draw a trivial scene. 52 // Draw a trivial scene.
53 canvas.save(SkCanvas::kMatrixClip_SaveFlag); 53 canvas.save();
54 canvas.clipRect(fullRect, SkRegion::kIntersect_Op, false); 54 canvas.clipRect(fullRect, SkRegion::kIntersect_Op, false);
55 canvas.translate(SkIntToScalar(10), SkIntToScalar(10)); 55 canvas.translate(SkIntToScalar(10), SkIntToScalar(10));
56 canvas.scale(SkIntToScalar(2), SkIntToScalar(2)); 56 canvas.scale(SkIntToScalar(2), SkIntToScalar(2));
57 canvas.drawRect(fillRect, red_paint); 57 canvas.drawRect(fillRect, red_paint);
58 canvas.restore(); 58 canvas.restore();
59 59
60 // Verify the recorded commands. 60 // Verify the recorded commands.
61 DrawType cmd; 61 DrawType cmd;
62 int idx = 0; 62 int idx = 0;
63 ASSERT_EQ(canvas.getSize(), 6); 63 ASSERT_EQ(canvas.getSize(), 6);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "Draw Rect"); 96 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "Draw Rect");
97 EXPECT_TRUE(HasInfoField(canvas, idx, "SkRect")); 97 EXPECT_TRUE(HasInfoField(canvas, idx, "SkRect"));
98 98
99 ASSERT_TRUE(canvas.getDrawCommandAt(++idx) != NULL); 99 ASSERT_TRUE(canvas.getDrawCommandAt(++idx) != NULL);
100 cmd = canvas.getDrawCommandAt(idx)->getType(); 100 cmd = canvas.getDrawCommandAt(idx)->getType();
101 EXPECT_EQ(cmd, RESTORE); 101 EXPECT_EQ(cmd, RESTORE);
102 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "Restore"); 102 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "Restore");
103 } 103 }
104 104
105 } // namespace content 105 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | skia/ext/analysis_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698