1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/utils/debugger/SkObjectParser.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,128 @@ 1.4 +/* 1.5 + * Copyright 2012 Google Inc. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef SKOBJECTPARSER_H_ 1.12 +#define SKOBJECTPARSER_H_ 1.13 + 1.14 +#include "SkCanvas.h" 1.15 +#include "SkString.h" 1.16 + 1.17 +/** \class SkObjectParser 1.18 + 1.19 + The ObjectParser is used to return string information about parameters 1.20 + in each draw command. 1.21 + */ 1.22 +class SkObjectParser { 1.23 +public: 1.24 + 1.25 + /** 1.26 + Returns a string about a bitmaps bounds and config. 1.27 + @param bitmap SkBitmap 1.28 + */ 1.29 + static SkString* BitmapToString(const SkBitmap& bitmap); 1.30 + 1.31 + /** 1.32 + Returns a string representation of a boolean. 1.33 + @param doAA boolean 1.34 + */ 1.35 + static SkString* BoolToString(bool doAA); 1.36 + 1.37 + /** 1.38 + Returns a string representation of the text pointer passed in. 1.39 + */ 1.40 + static SkString* CustomTextToString(const char* text); 1.41 + 1.42 + /** 1.43 + Returns a string representation of an integer with the text parameter 1.44 + at the front of the string. 1.45 + @param x integer 1.46 + @param text 1.47 + */ 1.48 + static SkString* IntToString(int x, const char* text); 1.49 + /** 1.50 + Returns a string representation of the SkIRects coordinates. 1.51 + @param rect SkIRect 1.52 + */ 1.53 + static SkString* IRectToString(const SkIRect& rect); 1.54 + 1.55 + /** 1.56 + Returns a string representation of an SkMatrix's contents 1.57 + @param matrix SkMatrix 1.58 + */ 1.59 + static SkString* MatrixToString(const SkMatrix& matrix); 1.60 + 1.61 + /** 1.62 + Returns a string representation of an SkPaint's color 1.63 + @param paint SkPaint 1.64 + */ 1.65 + static SkString* PaintToString(const SkPaint& paint); 1.66 + 1.67 + /** 1.68 + Returns a string representation of a SkPath's points. 1.69 + @param path SkPath 1.70 + */ 1.71 + static SkString* PathToString(const SkPath& path); 1.72 + 1.73 + /** 1.74 + Returns a string representation of the points in the point array. 1.75 + @param pts[] Array of SkPoints 1.76 + @param count 1.77 + */ 1.78 + static SkString* PointsToString(const SkPoint pts[], size_t count); 1.79 + 1.80 + /** 1.81 + Returns a string representation of the SkCanvas PointMode enum. 1.82 + */ 1.83 + static SkString* PointModeToString(SkCanvas::PointMode mode); 1.84 + 1.85 + /** 1.86 + Returns a string representation of the SkRects coordinates. 1.87 + @param rect SkRect 1.88 + */ 1.89 + static SkString* RectToString(const SkRect& rect, const char* title = NULL); 1.90 + 1.91 + /** 1.92 + Returns a string representation of an SkRRect. 1.93 + @param rrect SkRRect 1.94 + */ 1.95 + static SkString* RRectToString(const SkRRect& rrect, const char* title = NULL); 1.96 + 1.97 + /** 1.98 + Returns a string representation of the SkRegion enum. 1.99 + @param op SkRegion::op enum 1.100 + */ 1.101 + static SkString* RegionOpToString(SkRegion::Op op); 1.102 + 1.103 + /** 1.104 + Returns a string representation of the SkRegion. 1.105 + @param region SkRegion 1.106 + */ 1.107 + static SkString* RegionToString(const SkRegion& region); 1.108 + 1.109 + /** 1.110 + Returns a string representation of the SkCanvas::SaveFlags enum. 1.111 + @param flags SkCanvas::SaveFlags enum 1.112 + */ 1.113 + static SkString* SaveFlagsToString(SkCanvas::SaveFlags flags); 1.114 + 1.115 + /** 1.116 + Returns a string representation of an SkScalar with the text parameter 1.117 + at the front of the string. 1.118 + @param x SkScalar 1.119 + @param text 1.120 + */ 1.121 + static SkString* ScalarToString(SkScalar x, const char* text); 1.122 + 1.123 + /** 1.124 + Returns a string representation of the char pointer passed in. 1.125 + @param text const void* that will be cast to a char* 1.126 + */ 1.127 + static SkString* TextToString(const void* text, size_t byteLength, 1.128 + SkPaint::TextEncoding encoding); 1.129 +}; 1.130 + 1.131 +#endif