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

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

Issue 1329553004: Add a FOUC painting test. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix build. Created 5 years, 3 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 | « Source/web/tests/DocumentLoadingRenderingTest.cpp ('k') | Source/web/tests/sim/SimCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SimCanvas_h
6 #define SimCanvas_h
7
8 #include "platform/graphics/Color.h"
9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "wtf/Vector.h"
11
12 namespace blink {
13
14 class SimCanvas : public SkCanvas {
15 public:
16 SimCanvas(int width, int height);
17
18 enum CommandType {
19 Rect,
20 Text,
21 Image,
22 Shape,
23 };
24
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.
27 struct Command {
28 CommandType type;
29 RGBA32 color;
30 };
31
32 const Vector<Command>& commands() const { return m_commands; }
33
34 // Rect
35 void onDrawRect(const SkRect&, const SkPaint&) override;
36
37 // Shape
38 void onDrawOval(const SkRect&, const SkPaint&) override;
39 void onDrawRRect(const SkRRect&, const SkPaint&) override;
40 void onDrawPath(const SkPath&, const SkPaint&) override;
41
42 // Image
43 void onDrawImage(const SkImage*, SkScalar, SkScalar, const SkPaint*) overrid e;
44 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, c onst SkPaint*, SrcRectConstraint) override;
45
46 // Text
47 void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint&) override;
48 void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], const SkPaint&) override;
49 void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos [], SkScalar constY, const SkPaint&) override;
50 void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath&, co nst SkMatrix*, const SkPaint&) override;
51 void onDrawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint &) override;
52
53 private:
54 void addCommand(CommandType, RGBA32 = 0);
55
56 Vector<Command> m_commands;
57 };
58
59 } // namespace blink
60
61 #endif
OLDNEW
« no previous file with comments | « Source/web/tests/DocumentLoadingRenderingTest.cpp ('k') | Source/web/tests/sim/SimCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698