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