skia2/tools/skiaserve/Request.h
Mike Klein c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00

82 lines
2.0 KiB
C++

/*
* 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 "include/core/SkTypes.h"
#include "tools/gpu/GrContextFactory.h"
#include "include/core/SkPicture.h"
#include "include/core/SkStream.h"
#include "include/core/SkSurface.h"
#include "tools/debugger/DebugCanvas.h"
#include "tools/UrlDataManager.h"
namespace sk_gpu_test {
class GrContextFactory;
}
struct MHD_Connection;
struct MHD_PostProcessor;
struct UploadContext {
SkDynamicMemoryWStream fStream;
MHD_PostProcessor* fPostProcessor;
MHD_Connection* connection;
};
struct Request {
Request(SkString rootUrl);
~Request();
// draws to canvas operation N, highlighting the Mth GrOp. m = -1 means no highlight.
sk_sp<SkData> drawToPng(int n, int m = -1);
sk_sp<SkData> writeOutSkp();
SkCanvas* getCanvas();
bool enableGPU(bool enable);
bool setOverdraw(bool enable);
bool setColorMode(int mode);
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
sk_sp<SkData> getJsonOps(int n);
// Returns a json list of ops as an SkData
sk_sp<SkData> getJsonOpList(int n);
// Returns json with the viewMatrix and clipRect
sk_sp<SkData> getJsonInfo(int n);
// returns the color of the pixel at (x,y) in the canvas
SkColor getPixel(int x, int y);
UploadContext* fUploadContext;
std::unique_ptr<DebugCanvas> fDebugCanvas;
UrlDataManager fUrlDataManager;
private:
sk_sp<SkData> writeCanvasToPng(SkCanvas* canvas);
SkSurface* createCPUSurface();
SkSurface* createGPUSurface();
SkIRect getBounds();
GrContext* getContext();
sk_sp<SkPicture> fPicture;
sk_gpu_test::GrContextFactory* fContextFactory;
sk_sp<SkSurface> fSurface;
bool fGPUEnabled;
bool fOverdraw;
int fColorMode;
};
#endif