d9ea816b1f
This started with a search for gammaCloseToSRGB and turned into me removing a bunch of really crazy bitmap code here. Like DM, just use SkPngEncoder to encode PNGs. With that change, we don't need the custom raster pipeline step, and we can remove that (along with several other unused functions) from picture_utils. (The one remaining function should just move to tool_utils, but I'll save that for another rainy day). In getPixel, we can skip ALL of the processing work, and also only read the one pixel we need. That makes break-on-change feel much faster from my anecdotal testing. Change-Id: I3d18f1e7a15dd12ac4661da1b724e9d8e1cdee96 Reviewed-on: https://skia-review.googlesource.com/146442 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
82 lines
2.0 KiB
C++
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 "SkTypes.h"
|
|
|
|
#include "GrContextFactory.h"
|
|
|
|
#include "SkDebugCanvas.h"
|
|
#include "SkPicture.h"
|
|
#include "SkStream.h"
|
|
#include "SkSurface.h"
|
|
|
|
#include "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<SkDebugCanvas> 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
|