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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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 #ifndef SimCanvas_h 5 #ifndef SimCanvas_h
6 #define SimCanvas_h 6 #define SimCanvas_h
7 7
8 #include "platform/graphics/Color.h" 8 #include "platform/graphics/Color.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "skia/ext/cdl_canvas.h"
10 #include "wtf/Vector.h" 10 #include "wtf/Vector.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class SimCanvas : public SkCanvas { 14 class SimCanvas : public CdlCanvas {
15 public: 15 public:
16 SimCanvas(int width, int height); 16 SimCanvas(int width, int height);
17 17
18 enum CommandType { 18 enum CommandType {
19 Rect, 19 Rect,
20 Text, 20 Text,
21 Image, 21 Image,
22 Shape, 22 Shape,
23 }; 23 };
24 24
25 // TODO(esprehn): Ideally we'd put the text in here too, but SkTextBlob 25 // TODO(esprehn): Ideally we'd put the text in here too, but SkTextBlob
26 // has no way to get the text back out so we can't assert about drawn text. 26 // has no way to get the text back out so we can't assert about drawn text.
27 struct Command { 27 struct Command {
28 CommandType type; 28 CommandType type;
29 RGBA32 color; 29 RGBA32 color;
30 }; 30 };
31 31
32 const Vector<Command>& commands() const { return m_commands; } 32 const Vector<Command>& commands() const { return m_commands; }
33 33
34 // Rect 34 // Rect
35 void onDrawRect(const SkRect&, const SkPaint&) override; 35 void onDrawRect(const SkRect&, const CdlPaint&) override;
36 36
37 // Shape 37 // Shape
38 void onDrawOval(const SkRect&, const SkPaint&) override; 38 void onDrawOval(const SkRect&, const CdlPaint&) override;
39 void onDrawRRect(const SkRRect&, const SkPaint&) override; 39 void onDrawRRect(const SkRRect&, const CdlPaint&) override;
40 void onDrawPath(const SkPath&, const SkPaint&) override; 40 void onDrawPath(const SkPath&, const CdlPaint&) override;
41 41
42 // Image 42 // Image
43 void onDrawImage(const SkImage*, SkScalar, SkScalar, const SkPaint*) override; 43 void onDrawImage(const SkImage*,
44 SkScalar,
45 SkScalar,
46 const CdlPaint*) override;
44 void onDrawImageRect(const SkImage*, 47 void onDrawImageRect(const SkImage*,
45 const SkRect* src, 48 const SkRect* src,
46 const SkRect& dst, 49 const SkRect& dst,
47 const SkPaint*, 50 const CdlPaint*,
48 SrcRectConstraint) override; 51 SkCanvas::SrcRectConstraint) override;
49 52
50 // Text 53 // Text
51 void onDrawText(const void* text, 54 void onDrawText(const void* text,
52 size_t byteLength, 55 size_t byteLength,
53 SkScalar x, 56 SkScalar x,
54 SkScalar y, 57 SkScalar y,
55 const SkPaint&) override; 58 const CdlPaint&) override;
56 void onDrawPosText(const void* text, 59 void onDrawPosText(const void* text,
57 size_t byteLength, 60 size_t byteLength,
58 const SkPoint pos[], 61 const SkPoint pos[],
59 const SkPaint&) override; 62 const CdlPaint&) override;
63 /*
60 void onDrawPosTextH(const void* text, 64 void onDrawPosTextH(const void* text,
61 size_t byteLength, 65 size_t byteLength,
62 const SkScalar xpos[], 66 const SkScalar xpos[],
63 SkScalar constY, 67 SkScalar constY,
64 const SkPaint&) override; 68 const CdlPaint&) override;
69
65 void onDrawTextOnPath(const void* text, 70 void onDrawTextOnPath(const void* text,
66 size_t byteLength, 71 size_t byteLength,
67 const SkPath&, 72 const SkPath&,
68 const SkMatrix*, 73 const SkMatrix*,
69 const SkPaint&) override; 74 const CdlPaint&) override;
75 */
70 void onDrawTextBlob(const SkTextBlob*, 76 void onDrawTextBlob(const SkTextBlob*,
71 SkScalar x, 77 SkScalar x,
72 SkScalar y, 78 SkScalar y,
73 const SkPaint&) override; 79 const CdlPaint&) override;
74 80
75 private: 81 private:
76 void addCommand(CommandType, RGBA32 = 0); 82 void addCommand(CommandType, RGBA32 = 0);
77 83
78 Vector<Command> m_commands; 84 Vector<Command> m_commands;
79 }; 85 };
80 86
81 } // namespace blink 87 } // namespace blink
82 88
83 #endif 89 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebViewTest.cpp ('k') | third_party/WebKit/Source/web/tests/sim/SimCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698