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

Side by Side Diff: tools/json/SkJSONCanvas.h

Issue 1662003002: Modify skia serve to return clip rect and view matrix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: todo Created 4 years, 10 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
« no previous file with comments | « no previous file | tools/json/SkJSONCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkJSONCanvas_DEFINED 8 #ifndef SkJSONCanvas_DEFINED
9 #define SkJSONCanvas_DEFINED 9 #define SkJSONCanvas_DEFINED
10 10
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 * SkJSONRenderer. Be sure to call finish() when you are done drawing. 142 * SkJSONRenderer. Be sure to call finish() when you are done drawing.
143 */ 143 */
144 class SkJSONCanvas : public SkCanvas { 144 class SkJSONCanvas : public SkCanvas {
145 public: 145 public:
146 /* Create a canvas which writes to the specified output stream. */ 146 /* Create a canvas which writes to the specified output stream. */
147 SkJSONCanvas(int width, int height, SkWStream& out, bool sendBinaries = fals e); 147 SkJSONCanvas(int width, int height, SkWStream& out, bool sendBinaries = fals e);
148 148
149 /* Complete the JSON document. */ 149 /* Complete the JSON document. */
150 void finish(); 150 void finish();
151 151
152 static Json::Value MakeMatrix(const SkMatrix& matrix);
153
154 static Json::Value MakeIRect(const SkIRect& irect);
155
152 // overridden SkCanvas API 156 // overridden SkCanvas API
153 157
154 void onDrawPaint(const SkPaint&) override; 158 void onDrawPaint(const SkPaint&) override;
155 159
156 void onDrawRect(const SkRect&, const SkPaint&) override; 160 void onDrawRect(const SkRect&, const SkPaint&) override;
157 161
158 void onDrawOval(const SkRect&, const SkPaint&) override; 162 void onDrawOval(const SkRect&, const SkPaint&) override;
159 163
160 void onDrawRRect(const SkRRect&, const SkPaint&) override; 164 void onDrawRRect(const SkRRect&, const SkPaint&) override;
161 165
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 223
220 void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) override; 224 void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) override;
221 225
222 void willSave() override; 226 void willSave() override;
223 227
224 void willRestore() override; 228 void willRestore() override;
225 229
226 SkCanvas::SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) ov erride; 230 SkCanvas::SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) ov erride;
227 231
228 private: 232 private:
233 // Helpers to turn values into JSON, these could probably be static
229 Json::Value makePoint(const SkPoint& point); 234 Json::Value makePoint(const SkPoint& point);
230 235
231 Json::Value makePoint(SkScalar x, SkScalar y); 236 Json::Value makePoint(SkScalar x, SkScalar y);
232 237
233 Json::Value makeRect(const SkRect& rect); 238 Json::Value makeRect(const SkRect& rect);
234 239
235 Json::Value makeRRect(const SkRRect& rrect); 240 Json::Value makeRRect(const SkRRect& rrect);
236 241
237 Json::Value makePath(const SkPath& path); 242 Json::Value makePath(const SkPath& path);
238 243
239 Json::Value makeRegion(const SkRegion& region); 244 Json::Value makeRegion(const SkRegion& region);
240 245
241 Json::Value makePaint(const SkPaint& paint); 246 Json::Value makePaint(const SkPaint& paint);
242 247
243 Json::Value makeRegionOp(SkRegion::Op op); 248 Json::Value makeRegionOp(SkRegion::Op op);
244 249
245 Json::Value makeEdgeStyle(SkCanvas::ClipEdgeStyle edgeStyle); 250 Json::Value makeEdgeStyle(SkCanvas::ClipEdgeStyle edgeStyle);
246 251
247 Json::Value makePointMode(SkCanvas::PointMode mode); 252 Json::Value makePointMode(SkCanvas::PointMode mode);
248 253
249 Json::Value makeMatrix(const SkMatrix& matrix);
250
251 void updateMatrix(); 254 void updateMatrix();
252 255
253 SkWStream& fOut; 256 SkWStream& fOut;
254 SkMatrix fLastMatrix; 257 SkMatrix fLastMatrix;
255 Json::Value fRoot; 258 Json::Value fRoot;
256 Json::Value fCommands; 259 Json::Value fCommands;
257 bool fSendBinaries; 260 bool fSendBinaries;
258 261
259 typedef SkCanvas INHERITED; 262 typedef SkCanvas INHERITED;
260 }; 263 };
261 264
262 #endif 265 #endif
OLDNEW
« no previous file with comments | « no previous file | tools/json/SkJSONCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698