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

Side by Side Diff: third_party/WebKit/Source/web/tests/sim/SimCanvas.cpp

Issue 2612903007: Migrate WTF::Vector::append() to ::push_back() [part 15 of N] (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "web/tests/sim/SimCanvas.h" 5 #include "web/tests/sim/SimCanvas.h"
6 6
7 #include "third_party/skia/include/core/SkPaint.h" 7 #include "third_party/skia/include/core/SkPaint.h"
8 #include "third_party/skia/include/core/SkPath.h" 8 #include "third_party/skia/include/core/SkPath.h"
9 #include "third_party/skia/include/core/SkRRect.h" 9 #include "third_party/skia/include/core/SkRRect.h"
10 #include "third_party/skia/include/core/SkRect.h" 10 #include "third_party/skia/include/core/SkRect.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 static int s_depth = 0; 14 static int s_depth = 0;
15 15
16 class DrawScope { 16 class DrawScope {
17 public: 17 public:
18 DrawScope() { ++s_depth; } 18 DrawScope() { ++s_depth; }
19 ~DrawScope() { --s_depth; } 19 ~DrawScope() { --s_depth; }
20 }; 20 };
21 21
22 SimCanvas::SimCanvas(int width, int height) : SkCanvas(width, height) {} 22 SimCanvas::SimCanvas(int width, int height) : SkCanvas(width, height) {}
23 23
24 void SimCanvas::addCommand(CommandType type, RGBA32 color) { 24 void SimCanvas::addCommand(CommandType type, RGBA32 color) {
25 if (s_depth > 1) 25 if (s_depth > 1)
26 return; 26 return;
27 Command command = {type, color}; 27 Command command = {type, color};
28 m_commands.append(command); 28 m_commands.push_back(command);
29 } 29 }
30 30
31 void SimCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { 31 void SimCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
32 DrawScope scope; 32 DrawScope scope;
33 addCommand(CommandType::Rect, paint.getColor()); 33 addCommand(CommandType::Rect, paint.getColor());
34 SkCanvas::onDrawRect(rect, paint); 34 SkCanvas::onDrawRect(rect, paint);
35 } 35 }
36 36
37 void SimCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) { 37 void SimCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
38 DrawScope scope; 38 DrawScope scope;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 void SimCanvas::onDrawTextBlob(const SkTextBlob* blob, 113 void SimCanvas::onDrawTextBlob(const SkTextBlob* blob,
114 SkScalar x, 114 SkScalar x,
115 SkScalar y, 115 SkScalar y,
116 const SkPaint& paint) { 116 const SkPaint& paint) {
117 DrawScope scope; 117 DrawScope scope;
118 addCommand(CommandType::Text, paint.getColor()); 118 addCommand(CommandType::Text, paint.getColor());
119 SkCanvas::onDrawTextBlob(blob, x, y, paint); 119 SkCanvas::onDrawTextBlob(blob, x, y, paint);
120 } 120 }
121 121
122 } // namespace blink 122 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698