blob: fd015dc7cf8590f3ca307b2f920b0a6ab6392547 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef Request_DEFINED
#define Request_DEFINED
#include "GrContextFactory.h"
#include "SkDebugCanvas.h"
#include "SkPicture.h"
#include "SkStream.h"
#include "SkSurface.h"
#include "UrlDataManager.h"
struct MHD_Connection;
struct MHD_PostProcessor;
struct UploadContext {
SkDynamicMemoryWStream fStream;
MHD_PostProcessor* fPostProcessor;
MHD_Connection* connection;
};
struct Request {
Request(SkString rootUrl);
SkData* drawToPng(int n);
SkCanvas* getCanvas();
SkBitmap* getBitmapFromCanvas(SkCanvas* canvas);
bool enableGPU(bool enable);
bool hasPicture() const { return SkToBool(fPicture.get()); }
int getLastOp() const { return fDebugCanvas->getSize() - 1; }
bool initPictureFromStream(SkStream*);
// Returns the json list of ops as an SkData
SkData* getJsonOps(int n);
// Returns a json list of batches as an SkData
SkData* getJsonBatchList(int n);
// Returns json with the viewMatrix and clipRect
SkData* getJsonInfo(int n);
// TODO probably want to make this configurable
static const int kImageWidth;
static const int kImageHeight;
UploadContext* fUploadContext;
SkAutoTUnref<SkDebugCanvas> fDebugCanvas;
UrlDataManager fUrlDataManager;
private:
SkData* writeCanvasToPng(SkCanvas* canvas);
void drawToCanvas(int n);
SkSurface* createCPUSurface();
SkSurface* createGPUSurface();
SkAutoTUnref<SkPicture> fPicture;
SkAutoTDelete<GrContextFactory> fContextFactory;
SkAutoTUnref<SkSurface> fSurface;
bool fGPUEnabled;
};
#endif
|