aboutsummaryrefslogtreecommitdiffhomepage
path: root/debugger/SkObjectParser.h
blob: 16cd623b8d6e5ea896157be45f44a5ebccd69cba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#ifndef SKOBJECTPARSER_H_
#define SKOBJECTPARSER_H_

#include "SkCanvas.h"
#include "SkString.h"
/** \class SkObjectParser

    The ObjectParser is used to return string information about parameters
    in each draw command.
    TODO(chudy): Change std::string to SkString
 */
class SkObjectParser {
public:

    /**
        Returns a string about a bitmaps bounds and config.
        @param bitmap  SkBitmap
    */
    static SkString* BitmapToString(const SkBitmap& bitmap);

    /**
        Returns a string representation of a boolean.
        @param doAA  boolean
     */
    static SkString* BoolToString(bool doAA);

    /**
        Returns a string representation of the text pointer passed in.
     */
    static SkString* CustomTextToString(const char* text);

    /**
        Returns a string representation of an integer with the text parameter
        at the front of the string.
        @param x  integer
        @param text
     */
    static SkString* IntToString(int x, const char* text);
    /**
        Returns a string representation of the SkIRects coordinates.
        @param rect  SkIRect
     */
    static SkString* IRectToString(const SkIRect& rect);

    /**
        Returns a string representation of an SkMatrix's contents
        @param matrix  SkMatrix
     */
    static SkString* MatrixToString(const SkMatrix& matrix);

    /**
        Returns a string representation of an SkPaint's color
        @param paint  SkPaint
     */
    static SkString* PaintToString(const SkPaint& paint);

    /**
        Returns a string representation of a SkPath's points.
        @param path  SkPath
     */
    static SkString* PathToString(const SkPath& path);

    /**
        Returns a string representation of the points in the point array.
        @param pts[]  Array of SkPoints
        @param count
     */
    static SkString* PointsToString(const SkPoint pts[], size_t count);

    /**
        Returns a string representation of the SkCanvas PointMode enum.
     */
    static SkString* PointModeToString(SkCanvas::PointMode mode);

    /**
        Returns a string representation of the SkRects coordinates.
        @param rect  SkRect
     */
    static SkString* RectToString(const SkRect& rect);

    /**
        Returns a string representation of the SkRegion enum.
        @param op  SkRegion::op enum
     */
    static SkString* RegionOpToString(SkRegion::Op op);

    /**
        Returns a string representation of the SkRegion.
        @param region  SkRegion
     */
    static SkString* RegionToString(const SkRegion& region);

    /**
        Returns a string representation of the SkCanvas::SaveFlags enum.
        @param flags  SkCanvas::SaveFlags enum
     */
    static SkString* SaveFlagsToString(SkCanvas::SaveFlags flags);

    /**
        Returns a string representation of an SkScalar with the text parameter
        at the front of the string.
        @param x  SkScalar
        @param text
     */
    static SkString* ScalarToString(SkScalar x, const char* text);

    /**
        Returns a string representation of the char pointer passed in.
        @param text  const void* that will be cast to a char*
     */
    static SkString* TextToString(const void* text, size_t byteLength);
};

#endif