Get SkiaServe Request started off with a little privacy
This CL moves the surface stuff into the request object so it
can maintain its internal state consistently
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1741823002
Review URL: https://codereview.chromium.org/1741823002
diff --git a/tools/skiaserve/Request.h b/tools/skiaserve/Request.h
index f6ee994..5685186 100644
--- a/tools/skiaserve/Request.h
+++ b/tools/skiaserve/Request.h
@@ -27,18 +27,14 @@
};
struct Request {
- Request(SkString rootUrl)
- : fUploadContext(nullptr)
- , fUrlDataManager(rootUrl)
- , fGPUEnabled(false) {}
+ Request(SkString rootUrl);
- SkSurface* createCPUSurface();
- SkSurface* createGPUSurface();
SkData* drawToPng(int n);
void drawToCanvas(int n);
SkCanvas* getCanvas();
SkData* writeCanvasToPng(SkCanvas* canvas);
SkBitmap* getBitmapFromCanvas(SkCanvas* canvas);
+ bool enableGPU(bool enable);
bool hasPicture() const { return SkToBool(fPicture.get()); }
int getLastOp() const { return fDebugCanvas->getSize() - 1; }
@@ -48,6 +44,9 @@
// 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;
@@ -55,9 +54,14 @@
UploadContext* fUploadContext;
SkAutoTUnref<SkPicture> fPicture;
SkAutoTUnref<SkDebugCanvas> fDebugCanvas;
+ UrlDataManager fUrlDataManager;
+
+private:
+ SkSurface* createCPUSurface();
+ SkSurface* createGPUSurface();
+
SkAutoTDelete<GrContextFactory> fContextFactory;
SkAutoTUnref<SkSurface> fSurface;
- UrlDataManager fUrlDataManager;
bool fGPUEnabled;
};