101 {
102 if (argc != 2) {
104 return 1;
105 }
106
109 printf(
"Cannot open output file %s\n",
argv[1]);
110 return 1;
111 }
112
115#if defined(__linux__)
116 if (!initialize_gl_linux()) {
117 return 1;
118 }
120#elif defined(__APPLE__) && TARGET_OS_MAC == 1
122 return 1;
123 }
125#endif
126 if (!interface) {
127 printf(
"Could not make GL interface\n");
128 return 1;
129 }
130
132 if (!ctx) {
133 printf(
"Could not make GrDirectContext\n");
134 return 1;
135 }
136 printf(
"Context made, now to make the surface\n");
137
140
144 printf(
"Could not make surface from GL DirectContext\n");
145 return 1;
146 }
147
151
154 paint.setAntiAlias(
true);
155
157
159
160 printf(
"Drew to surface, now doing readback\n");
163 if (!webp) {
164 printf(
"Readback of pixels (or encoding) failed\n");
165 return 1;
166 }
169
170 return 0;
171}
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
GrSemaphoresSubmitted flush(const GrFlushInfo &info)
void clear(SkColor color)
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
const void * data() const
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
SK_API sk_sp< GrDirectContext > MakeGL(sk_sp< const GrGLInterface >, const GrContextOptions &)
SK_API sk_sp< const GrGLInterface > MakeMac()
SK_API sk_sp< const GrGLInterface > MakeGLX()
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
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)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)