Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Request.h
Go to the documentation of this file.
1/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef Request_DEFINED
9#define Request_DEFINED
10
12
14
19
21
22namespace sk_gpu_test {
23class GrContextFactory;
24} // namespace sk_gpu_test
25struct MHD_Connection;
26struct MHD_PostProcessor;
27
30 MHD_PostProcessor* fPostProcessor;
31 MHD_Connection* connection;
32};
33
34struct Request {
35 Request(SkString rootUrl);
36 ~Request();
37
38 // draws to canvas operation N, highlighting the Mth GrOp. m = -1 means no highlight.
39 sk_sp<SkData> drawToPng(int n, int m = -1);
42 bool enableGPU(bool enable);
43 bool setOverdraw(bool enable);
44 bool setColorMode(int mode);
45 bool hasPicture() const { return SkToBool(fPicture.get()); }
46 int getLastOp() const { return fDebugCanvas->getSize() - 1; }
47
49
50 // Returns the json list of ops as an SkData
52
53 // Returns a json list of ops as an SkData
55
56 // Returns json with the viewMatrix and clipRect at the given command
58
59 // returns the color of the pixel at (x,y) in the canvas
60 SkColor getPixel(int x, int y);
61
63 std::unique_ptr<DebugCanvas> fDebugCanvas;
65
66private:
67 sk_sp<SkData> writeCanvasToPng(SkCanvas* canvas);
68 SkSurface* createCPUSurface();
69 SkSurface* createGPUSurface();
70 SkIRect getBounds();
71 GrDirectContext* directContext();
72
73 sk_sp<SkPicture> fPicture;
74 sk_gpu_test::GrContextFactory* fContextFactory;
75 sk_sp<SkSurface> fSurface;
76 bool fGPUEnabled;
77 bool fOverdraw;
78 int fColorMode;
79};
80
81#endif
uint32_t SkColor
Definition SkColor.h:37
static constexpr bool SkToBool(const T &x)
Definition SkTo.h:35
T * get() const
Definition SkRefCnt.h:303
double y
double x
bool hasPicture() const
Definition Request.h:45
bool setOverdraw(bool enable)
Definition Request.cpp:171
UploadContext * fUploadContext
Definition Request.h:62
SkColor getPixel(int x, int y)
Definition Request.cpp:282
sk_sp< SkData > getJsonInfo(int n)
Definition Request.cpp:255
sk_sp< SkData > drawToPng(int n, int m=-1)
Definition Request.cpp:81
SkCanvas * getCanvas()
Definition Request.cpp:58
bool enableGPU(bool enable)
Definition Request.cpp:181
~Request()
Definition Request.cpp:40
std::unique_ptr< DebugCanvas > fDebugCanvas
Definition Request.h:63
sk_sp< SkData > writeOutSkp()
Definition Request.cpp:90
sk_sp< SkData > getJsonOpsTask()
Definition Request.cpp:243
bool initPictureFromStream(SkStream *)
Definition Request.cpp:205
UrlDataManager fUrlDataManager
Definition Request.h:64
sk_sp< SkData > getJsonOps()
Definition Request.cpp:227
int getLastOp() const
Definition Request.h:46
bool setColorMode(int mode)
Definition Request.cpp:176
SkDynamicMemoryWStream fStream
Definition Request.h:29
MHD_Connection * connection
Definition Request.h:31
MHD_PostProcessor * fPostProcessor
Definition Request.h:30