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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Rebase Created 3 years, 10 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
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 "platform/graphics/paint/PaintFlags.h"
7 #include "third_party/skia/include/core/SkPaint.h" 8 #include "third_party/skia/include/core/SkPaint.h"
8 #include "third_party/skia/include/core/SkPath.h" 9 #include "third_party/skia/include/core/SkPath.h"
9 #include "third_party/skia/include/core/SkRRect.h" 10 #include "third_party/skia/include/core/SkRRect.h"
10 #include "third_party/skia/include/core/SkRect.h" 11 #include "third_party/skia/include/core/SkRect.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 static int s_depth = 0; 15 static int s_depth = 0;
15 16
16 class DrawScope { 17 class DrawScope {
17 public: 18 public:
18 DrawScope() { ++s_depth; } 19 DrawScope() { ++s_depth; }
19 ~DrawScope() { --s_depth; } 20 ~DrawScope() { --s_depth; }
20 }; 21 };
21 22
22 SimCanvas::SimCanvas(int width, int height) : SkCanvas(width, height) {} 23 SimCanvas::SimCanvas(int width, int height) : PaintCanvas(width, height) {}
23 24
24 void SimCanvas::addCommand(CommandType type, RGBA32 color) { 25 void SimCanvas::addCommand(CommandType type, RGBA32 color) {
25 if (s_depth > 1) 26 if (s_depth > 1)
26 return; 27 return;
27 Command command = {type, color}; 28 Command command = {type, color};
28 m_commands.push_back(command); 29 m_commands.push_back(command);
29 } 30 }
30 31
31 void SimCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { 32 void SimCanvas::onDrawRect(const SkRect& rect, const PaintFlags& paint) {
32 DrawScope scope; 33 DrawScope scope;
33 addCommand(CommandType::Rect, paint.getColor()); 34 addCommand(CommandType::Rect, paint.getColor());
34 SkCanvas::onDrawRect(rect, paint); 35 PaintCanvas::onDrawRect(rect, paint);
35 } 36 }
36 37
37 void SimCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) { 38 void SimCanvas::onDrawOval(const SkRect& oval, const PaintFlags& paint) {
38 DrawScope scope; 39 DrawScope scope;
39 addCommand(CommandType::Shape, paint.getColor()); 40 addCommand(CommandType::Shape, paint.getColor());
40 SkCanvas::onDrawOval(oval, paint); 41 PaintCanvas::onDrawOval(oval, paint);
41 } 42 }
42 43
43 void SimCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { 44 void SimCanvas::onDrawRRect(const SkRRect& rrect, const PaintFlags& paint) {
44 DrawScope scope; 45 DrawScope scope;
45 addCommand(CommandType::Shape, paint.getColor()); 46 addCommand(CommandType::Shape, paint.getColor());
46 SkCanvas::onDrawRRect(rrect, paint); 47 PaintCanvas::onDrawRRect(rrect, paint);
47 } 48 }
48 49
49 void SimCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { 50 void SimCanvas::onDrawPath(const SkPath& path, const PaintFlags& paint) {
50 DrawScope scope; 51 DrawScope scope;
51 addCommand(CommandType::Shape, paint.getColor()); 52 addCommand(CommandType::Shape, paint.getColor());
52 SkCanvas::onDrawPath(path, paint); 53 PaintCanvas::onDrawPath(path, paint);
53 } 54 }
54 55
55 void SimCanvas::onDrawImage(const SkImage* image, 56 void SimCanvas::onDrawImage(const SkImage* image,
56 SkScalar left, 57 SkScalar left,
57 SkScalar top, 58 SkScalar top,
58 const SkPaint* paint) { 59 const PaintFlags* paint) {
59 DrawScope scope; 60 DrawScope scope;
60 addCommand(CommandType::Image); 61 addCommand(CommandType::Image);
61 SkCanvas::onDrawImage(image, left, top, paint); 62 PaintCanvas::onDrawImage(image, left, top, paint);
62 } 63 }
63 64
64 void SimCanvas::onDrawImageRect(const SkImage* image, 65 void SimCanvas::onDrawImageRect(const SkImage* image,
65 const SkRect* src, 66 const SkRect* src,
66 const SkRect& dst, 67 const SkRect& dst,
67 const SkPaint* paint, 68 const PaintFlags* paint,
68 SrcRectConstraint constraint) { 69 SkCanvas::SrcRectConstraint constraint) {
69 DrawScope scope; 70 DrawScope scope;
70 addCommand(CommandType::Image); 71 addCommand(CommandType::Image);
71 SkCanvas::onDrawImageRect(image, src, dst, paint, constraint); 72 PaintCanvas::onDrawImageRect(image, src, dst, paint, constraint);
72 } 73 }
73 74
74 void SimCanvas::onDrawText(const void* text, 75 void SimCanvas::onDrawText(const void* text,
75 size_t byteLength, 76 size_t byteLength,
76 SkScalar x, 77 SkScalar x,
77 SkScalar y, 78 SkScalar y,
78 const SkPaint& paint) { 79 const PaintFlags& paint) {
79 DrawScope scope; 80 DrawScope scope;
80 addCommand(CommandType::Text, paint.getColor()); 81 addCommand(CommandType::Text, paint.getColor());
81 SkCanvas::onDrawText(text, byteLength, x, y, paint); 82 PaintCanvas::onDrawText(text, byteLength, x, y, paint);
82 } 83 }
83 84
84 void SimCanvas::onDrawPosText(const void* text, 85 void SimCanvas::onDrawPosText(const void* text,
85 size_t byteLength, 86 size_t byteLength,
86 const SkPoint pos[], 87 const SkPoint pos[],
87 const SkPaint& paint) { 88 const PaintFlags& paint) {
88 DrawScope scope; 89 DrawScope scope;
89 addCommand(CommandType::Text, paint.getColor()); 90 addCommand(CommandType::Text, paint.getColor());
90 SkCanvas::onDrawPosText(text, byteLength, pos, paint); 91 PaintCanvas::onDrawPosText(text, byteLength, pos, paint);
91 } 92 }
92 93
93 void SimCanvas::onDrawPosTextH(const void* text, 94 void SimCanvas::onDrawPosTextH(const void* text,
94 size_t byteLength, 95 size_t byteLength,
95 const SkScalar xpos[], 96 const SkScalar xpos[],
96 SkScalar constY, 97 SkScalar constY,
97 const SkPaint& paint) { 98 const PaintFlags& paint) {
98 DrawScope scope; 99 DrawScope scope;
99 addCommand(CommandType::Text, paint.getColor()); 100 addCommand(CommandType::Text, paint.getColor());
100 SkCanvas::onDrawPosTextH(text, byteLength, xpos, constY, paint); 101 PaintCanvas::onDrawPosTextH(text, byteLength, xpos, constY, paint);
101 } 102 }
102 103
103 void SimCanvas::onDrawTextOnPath(const void* text, 104 void SimCanvas::onDrawTextOnPath(const void* text,
104 size_t byteLength, 105 size_t byteLength,
105 const SkPath& path, 106 const SkPath& path,
106 const SkMatrix* matrix, 107 const SkMatrix* matrix,
107 const SkPaint& paint) { 108 const PaintFlags& paint) {
108 DrawScope scope; 109 DrawScope scope;
109 addCommand(CommandType::Text, paint.getColor()); 110 addCommand(CommandType::Text, paint.getColor());
110 SkCanvas::onDrawTextOnPath(text, byteLength, path, matrix, paint); 111 PaintCanvas::onDrawTextOnPath(text, byteLength, path, matrix, paint);
111 } 112 }
112 113
113 void SimCanvas::onDrawTextBlob(const SkTextBlob* blob, 114 void SimCanvas::onDrawTextBlob(const SkTextBlob* blob,
114 SkScalar x, 115 SkScalar x,
115 SkScalar y, 116 SkScalar y,
116 const SkPaint& paint) { 117 const PaintFlags& paint) {
117 DrawScope scope; 118 DrawScope scope;
118 addCommand(CommandType::Text, paint.getColor()); 119 addCommand(CommandType::Text, paint.getColor());
119 SkCanvas::onDrawTextBlob(blob, x, y, paint); 120 PaintCanvas::onDrawTextBlob(blob, x, y, paint);
120 } 121 }
121 122
122 } // namespace blink 123 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698