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.
8 #include "platform/graphics/Color.h"
9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "wtf/Vector.h"
14 class SimCanvas
: public SkCanvas
{
16 SimCanvas(int width
, int height
);
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.
32 const Vector
<Command
>& commands() const { return m_commands
; }
35 void onDrawRect(const SkRect
&, const SkPaint
&) override
;
38 void onDrawOval(const SkRect
&, const SkPaint
&) override
;
39 void onDrawRRect(const SkRRect
&, const SkPaint
&) override
;
40 void onDrawPath(const SkPath
&, const SkPaint
&) override
;
43 void onDrawImage(const SkImage
*, SkScalar
, SkScalar
, const SkPaint
*) override
;
44 void onDrawImageRect(const SkImage
*, const SkRect
* src
, const SkRect
& dst
, const SkPaint
*, SrcRectConstraint
) override
;
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
&, const SkMatrix
*, const SkPaint
&) override
;
51 void onDrawTextBlob(const SkTextBlob
*, SkScalar x
, SkScalar y
, const SkPaint
&) override
;
54 void addCommand(CommandType
, RGBA32
= 0);
56 Vector
<Command
> m_commands
;