2016-02-25 16:37:54 +00:00
|
|
|
/*
|
|
|
|
* 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 {
|
2016-02-26 16:36:25 +00:00
|
|
|
Request(SkString rootUrl);
|
2016-02-25 16:37:54 +00:00
|
|
|
|
2016-02-25 18:50:28 +00:00
|
|
|
SkData* drawToPng(int n);
|
|
|
|
SkCanvas* getCanvas();
|
|
|
|
SkBitmap* getBitmapFromCanvas(SkCanvas* canvas);
|
2016-02-26 16:36:25 +00:00
|
|
|
bool enableGPU(bool enable);
|
2016-02-26 16:22:49 +00:00
|
|
|
bool hasPicture() const { return SkToBool(fPicture.get()); }
|
|
|
|
int getLastOp() const { return fDebugCanvas->getSize() - 1; }
|
|
|
|
|
2016-02-29 13:35:04 +00:00
|
|
|
bool initPictureFromStream(SkStream*);
|
|
|
|
|
2016-02-26 16:22:49 +00:00
|
|
|
// 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);
|
2016-02-25 18:50:28 +00:00
|
|
|
|
2016-02-26 16:36:25 +00:00
|
|
|
// Returns json with the viewMatrix and clipRect
|
|
|
|
SkData* getJsonInfo(int n);
|
|
|
|
|
2016-02-25 18:50:28 +00:00
|
|
|
// TODO probably want to make this configurable
|
|
|
|
static const int kImageWidth;
|
|
|
|
static const int kImageHeight;
|
|
|
|
|
2016-02-25 16:37:54 +00:00
|
|
|
UploadContext* fUploadContext;
|
|
|
|
SkAutoTUnref<SkDebugCanvas> fDebugCanvas;
|
2016-02-26 16:36:25 +00:00
|
|
|
UrlDataManager fUrlDataManager;
|
|
|
|
|
|
|
|
private:
|
2016-02-29 13:35:04 +00:00
|
|
|
SkData* writeCanvasToPng(SkCanvas* canvas);
|
|
|
|
void drawToCanvas(int n);
|
2016-02-26 16:36:25 +00:00
|
|
|
SkSurface* createCPUSurface();
|
|
|
|
SkSurface* createGPUSurface();
|
2016-02-29 15:44:02 +00:00
|
|
|
GrAuditTrail* getAuditTrail(SkCanvas*);
|
|
|
|
void cleanupAuditTrail(SkCanvas*);
|
2016-02-26 16:36:25 +00:00
|
|
|
|
2016-02-29 13:35:04 +00:00
|
|
|
SkAutoTUnref<SkPicture> fPicture;
|
2016-02-25 16:37:54 +00:00
|
|
|
SkAutoTDelete<GrContextFactory> fContextFactory;
|
|
|
|
SkAutoTUnref<SkSurface> fSurface;
|
|
|
|
bool fGPUEnabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|