skia2/tools/skiaserve/Request.h
Greg Daniel f41b2bd449 Reland "Merge GrOpList and GrRTOpList and rename to GrOpsTask."
This reverts commit f21bf9e50b.

Reason for revert: relanding with infra fix

Original change's description:
> Revert "Merge GrOpList and GrRTOpList and rename to GrOpsTask."
>
> This reverts commit 2a5954140b.
>
> Reason for revert: breaking everything
>
> Original change's description:
> > Merge GrOpList and GrRTOpList and rename to GrOpsTask.
> >
> > Change-Id: I8f4f2218a30fd0541a8f79f7bb9850f9500cd243
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236343
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
>
> Change-Id: I27840ea0343e8e6b388556afb7bd2e76386d611d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236349
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com

Change-Id: Ibd3a06e4a91dbb1f225dcc8d17d0db3967b6f85f
No-Presubmit: true
No-Tree-Checks: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236350
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-08-22 20:52:09 +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> getJsonOpsTask(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