30 : fUploadContext(nullptr)
31 , fUrlDataManager(rootUrl)
41 if (fContextFactory) {
42 delete fContextFactory;
55 return buffer.detachAsData();
62 GrContextFactory::ContextOverrides::kNone).glContext();
65 GrContextFactory::ContextOverrides::kNone).glContext();
87 return writeCanvasToPng(this->
getCanvas());
92 SkIRect bounds = this->getBounds();
103 auto result = fContextFactory->
get(skgpu::ContextType::kGL,
104 GrContextFactory::ContextOverrides::kNone);
106 result = fContextFactory->
get(skgpu::ContextType::kGLES,
107 GrContextFactory::ContextOverrides::kNone);
119 std::min(
bounds.height(), maxRTSize));
134struct ColorAndProfile {
139ColorAndProfile ColorModes[] = {
140 { kN32_SkColorType,
false },
141 { kN32_SkColorType,
true },
149 ColorAndProfile cap = ColorModes[fColorMode];
154 cap.fSRGB ? colorSpace : nullptr);
159 auto context = this->directContext();
161 ColorAndProfile cap = ColorModes[fColorMode];
166 cap.fSRGB ? colorSpace : nullptr);
193 this->directContext()->
flush(fSurface.
get());
200 fSurface.
reset(this->createCPUSurface());
209 fprintf(stderr,
"Could not create picture from stream.\n");
217 SkIRect bounds = this->getBounds();
218 fDebugCanvas = std::make_unique<DebugCanvas>(bounds.width(), bounds.height());
223 this->directContext()->
flush(fSurface.
get());
235 writer.
appendS32(
"colorMode", fColorMode);
240 return stream.detachAsData();
252 return stream.detachAsData();
279 return stream.detachAsData();
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static constexpr int kMaxHeight
static constexpr int kMaxWidth
static int kDefaultHeight
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkAssertResult(cond)
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
constexpr SkColor SK_ColorTRANSPARENT
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
static void MakeJsonMatrix44(SkJSONWriter &, const SkM44 &)
static void MakeJsonIRect(SkJSONWriter &, const SkIRect &)
static void WritePNG(const SkBitmap &bitmap, SkWStream &out)
GrSemaphoresSubmitted flush(const GrFlushInfo &info)
SK_API int maxRenderTargetSize() const
void allocPixels(const SkImageInfo &info, size_t rowBytes)
SkColor getColor(int x, int y) const
void clear(SkColor color)
SkImageInfo imageInfo() const
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY)
static sk_sp< SkColorSpace > MakeSRGBLinear()
void appendS32(int32_t value)
void beginObject(const char *name=nullptr, bool multiline=true)
void appendBool(bool value)
void appendName(const char *name)
void appendCString(const char *value)
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
sk_sp< SkData > serialize(const SkSerialProcs *procs=nullptr) const
virtual SkRect cullRect() const =0
static sk_sp< SkPicture > MakeFromStream(SkStream *stream, const SkDeserialProcs *procs=nullptr)
ContextInfo getContextInfo(ContextType type, ContextOverrides=ContextOverrides::kNone)
GrDirectContext * get(ContextType type, ContextOverrides overrides=ContextOverrides::kNone)
void reset(T *ptr=nullptr)
static const uint8_t buffer[]
Optional< SkRect > bounds
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
GrContextOptions grContextOpts
bool setOverdraw(bool enable)
SkColor getPixel(int x, int y)
sk_sp< SkData > getJsonInfo(int n)
sk_sp< SkData > drawToPng(int n, int m=-1)
bool enableGPU(bool enable)
std::unique_ptr< DebugCanvas > fDebugCanvas
sk_sp< SkData > writeOutSkp()
sk_sp< SkData > getJsonOpsTask()
bool initPictureFromStream(SkStream *)
UrlDataManager fUrlDataManager
sk_sp< SkData > getJsonOps()
Request(SkString rootUrl)
bool setColorMode(int mode)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
void roundOut(SkIRect *dst) const