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 12 matching lines...) Expand all Loading... |
23 struct UploadContext { | 23 struct UploadContext { |
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 SkData* drawToPng(int n); | 32 SkData* drawToPng(int n); |
33 void drawToCanvas(int n); | |
34 SkCanvas* getCanvas(); | 33 SkCanvas* getCanvas(); |
35 SkData* writeCanvasToPng(SkCanvas* canvas); | |
36 SkBitmap* getBitmapFromCanvas(SkCanvas* canvas); | 34 SkBitmap* getBitmapFromCanvas(SkCanvas* canvas); |
37 bool enableGPU(bool enable); | 35 bool enableGPU(bool enable); |
38 bool hasPicture() const { return SkToBool(fPicture.get()); } | 36 bool hasPicture() const { return SkToBool(fPicture.get()); } |
39 int getLastOp() const { return fDebugCanvas->getSize() - 1; } | 37 int getLastOp() const { return fDebugCanvas->getSize() - 1; } |
40 | 38 |
| 39 bool initPictureFromStream(SkStream*); |
| 40 |
41 // Returns the json list of ops as an SkData | 41 // Returns the json list of ops as an SkData |
42 SkData* getJsonOps(int n); | 42 SkData* getJsonOps(int n); |
43 | 43 |
44 // Returns a json list of batches as an SkData | 44 // Returns a json list of batches as an SkData |
45 SkData* getJsonBatchList(int n); | 45 SkData* getJsonBatchList(int n); |
46 | 46 |
47 // Returns json with the viewMatrix and clipRect | 47 // Returns json with the viewMatrix and clipRect |
48 SkData* getJsonInfo(int n); | 48 SkData* getJsonInfo(int n); |
49 | 49 |
50 // TODO probably want to make this configurable | 50 // TODO probably want to make this configurable |
51 static const int kImageWidth; | 51 static const int kImageWidth; |
52 static const int kImageHeight; | 52 static const int kImageHeight; |
53 | 53 |
54 UploadContext* fUploadContext; | 54 UploadContext* fUploadContext; |
55 SkAutoTUnref<SkPicture> fPicture; | |
56 SkAutoTUnref<SkDebugCanvas> fDebugCanvas; | 55 SkAutoTUnref<SkDebugCanvas> fDebugCanvas; |
57 UrlDataManager fUrlDataManager; | 56 UrlDataManager fUrlDataManager; |
58 | 57 |
59 private: | 58 private: |
| 59 SkData* writeCanvasToPng(SkCanvas* canvas); |
| 60 void drawToCanvas(int n); |
60 SkSurface* createCPUSurface(); | 61 SkSurface* createCPUSurface(); |
61 SkSurface* createGPUSurface(); | 62 SkSurface* createGPUSurface(); |
62 | 63 |
| 64 SkAutoTUnref<SkPicture> fPicture; |
63 SkAutoTDelete<GrContextFactory> fContextFactory; | 65 SkAutoTDelete<GrContextFactory> fContextFactory; |
64 SkAutoTUnref<SkSurface> fSurface; | 66 SkAutoTUnref<SkSurface> fSurface; |
65 bool fGPUEnabled; | 67 bool fGPUEnabled; |
66 }; | 68 }; |
67 | 69 |
68 #endif | 70 #endif |
69 | 71 |
OLD | NEW |