Move action_runner.py out of actions folder prior to moving actions to internal.
[chromium-blink-merge.git] / skia / ext / benchmarking_canvas.h
bloba33c42d9fd1ac9d274348f57b11f20580b5470ee
1 // Copyright (c) 2013 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.
5 #ifndef SKIA_EXT_BENCHMARKING_CANVAS_H_
6 #define SKIA_EXT_BENCHMARKING_CANVAS_H_
8 #include "base/values.h"
9 #include "skia/ext/refptr.h"
10 #include "third_party/skia/include/utils/SkNWayCanvas.h"
12 class SkXfermode;
14 namespace skia {
16 class SK_API BenchmarkingCanvas : public SkNWayCanvas {
17 public:
18 BenchmarkingCanvas(SkCanvas* canvas, unsigned flags = 0);
19 ~BenchmarkingCanvas() override;
21 enum Flags {
22 kOverdrawVisualization_Flag = 0x01,
25 // Returns the number of draw commands executed on this canvas.
26 size_t CommandCount() const;
28 // Returns the list of executed draw commands.
29 const base::ListValue& Commands() const;
31 // Return the recorded render time (milliseconds) for a draw command index.
32 double GetTime(size_t index);
34 protected:
35 // SkCanvas overrides
36 void willSave() override;
37 SaveLayerStrategy willSaveLayer(const SkRect*,
38 const SkPaint*,
39 SaveFlags) override;
40 void willRestore() override;
42 void didConcat(const SkMatrix&) override;
43 void didSetMatrix(const SkMatrix&) override;
45 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
46 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
47 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
48 void onClipRegion(const SkRegion&, SkRegion::Op) override;
50 void onDrawPaint(const SkPaint&) override;
51 void onDrawPoints(PointMode, size_t count, const SkPoint pts[],
52 const SkPaint&) override;
53 void onDrawRect(const SkRect&, const SkPaint&) override;
54 void onDrawOval(const SkRect&, const SkPaint&) override;
55 void onDrawRRect(const SkRRect&, const SkPaint&) override;
56 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
57 void onDrawPath(const SkPath&, const SkPaint&) override;
59 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
61 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override;
62 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
63 const SkPaint*, DrawBitmapRectFlags flags) override;
64 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override;
65 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
66 const SkPaint*) override;
67 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
68 const SkPaint*) override;
69 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) override;
71 void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
72 const SkPaint&) override;
73 void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
74 const SkPaint&) override;
75 void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
76 SkScalar constY, const SkPaint&) override;
77 void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
78 const SkMatrix* matrix, const SkPaint&) override;
79 void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
80 const SkPaint& paint) override;
82 private:
83 typedef SkNWayCanvas INHERITED;
85 class AutoOp;
87 base::ListValue op_records_;
88 unsigned flags_;
89 RefPtr<SkXfermode> overdraw_xfermode_;
93 #endif // SKIA_EXT_BENCHMARKING_CANVAS_H