OLD | NEW |
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 Request_DEFINED | 8 #ifndef Request_DEFINED |
9 #define Request_DEFINED | 9 #define Request_DEFINED |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 SkDynamicMemoryWStream fStream; | 24 SkDynamicMemoryWStream fStream; |
25 MHD_PostProcessor* fPostProcessor; | 25 MHD_PostProcessor* fPostProcessor; |
26 MHD_Connection* connection; | 26 MHD_Connection* connection; |
27 }; | 27 }; |
28 | 28 |
29 struct Request { | 29 struct Request { |
30 Request(SkString rootUrl); | 30 Request(SkString rootUrl); |
31 | 31 |
32 // draws to skia draw op N, highlighting the Mth batch(-1 means no highlight
) | 32 // draws to skia draw op N, highlighting the Mth batch(-1 means no highlight
) |
33 SkData* drawToPng(int n, int m = -1); | 33 SkData* drawToPng(int n, int m = -1); |
| 34 SkData* writeOutSkp(); |
34 SkCanvas* getCanvas(); | 35 SkCanvas* getCanvas(); |
35 SkBitmap* getBitmapFromCanvas(SkCanvas* canvas); | 36 SkBitmap* getBitmapFromCanvas(SkCanvas* canvas); |
36 bool enableGPU(bool enable); | 37 bool enableGPU(bool enable); |
37 bool hasPicture() const { return SkToBool(fPicture.get()); } | 38 bool hasPicture() const { return SkToBool(fPicture.get()); } |
38 int getLastOp() const { return fDebugCanvas->getSize() - 1; } | 39 int getLastOp() const { return fDebugCanvas->getSize() - 1; } |
39 | 40 |
40 bool initPictureFromStream(SkStream*); | 41 bool initPictureFromStream(SkStream*); |
41 | 42 |
42 // Returns the json list of ops as an SkData | 43 // Returns the json list of ops as an SkData |
43 SkData* getJsonOps(int n); | 44 SkData* getJsonOps(int n); |
44 | 45 |
45 // Returns a json list of batches as an SkData | 46 // Returns a json list of batches as an SkData |
46 SkData* getJsonBatchList(int n); | 47 SkData* getJsonBatchList(int n); |
47 | 48 |
48 // Returns json with the viewMatrix and clipRect | 49 // Returns json with the viewMatrix and clipRect |
49 SkData* getJsonInfo(int n); | 50 SkData* getJsonInfo(int n); |
50 | 51 |
51 // TODO probably want to make this configurable | 52 // returns the color of the pixel at (x,y) in the canvas |
52 static const int kImageWidth; | 53 SkColor getPixel(int x, int y); |
53 static const int kImageHeight; | |
54 | 54 |
55 UploadContext* fUploadContext; | 55 UploadContext* fUploadContext; |
56 SkAutoTUnref<SkDebugCanvas> fDebugCanvas; | 56 SkAutoTUnref<SkDebugCanvas> fDebugCanvas; |
57 UrlDataManager fUrlDataManager; | 57 UrlDataManager fUrlDataManager; |
58 | 58 |
59 private: | 59 private: |
60 SkData* writeCanvasToPng(SkCanvas* canvas); | 60 SkData* writeCanvasToPng(SkCanvas* canvas); |
61 void drawToCanvas(int n, int m = -1); | 61 void drawToCanvas(int n, int m = -1); |
62 SkSurface* createCPUSurface(); | 62 SkSurface* createCPUSurface(); |
63 SkSurface* createGPUSurface(); | 63 SkSurface* createGPUSurface(); |
64 GrAuditTrail* getAuditTrail(SkCanvas*); | 64 GrAuditTrail* getAuditTrail(SkCanvas*); |
65 void cleanupAuditTrail(SkCanvas*); | 65 void cleanupAuditTrail(SkCanvas*); |
66 | 66 |
67 SkAutoTUnref<SkPicture> fPicture; | 67 SkAutoTUnref<SkPicture> fPicture; |
68 SkAutoTDelete<GrContextFactory> fContextFactory; | 68 SkAutoTDelete<GrContextFactory> fContextFactory; |
69 SkAutoTUnref<SkSurface> fSurface; | 69 SkAutoTUnref<SkSurface> fSurface; |
70 bool fGPUEnabled; | 70 bool fGPUEnabled; |
71 }; | 71 }; |
72 | 72 |
73 #endif | 73 #endif |
74 | 74 |
OLD | NEW |