// Initialize the Skia surface and canvas.
auto interface = GrGLMakeNativeInterface();
assert(interface);
ctx_ = GrDirectContext::MakeGL(interface);
assert(ctx_);
GrGLint sampleCnt;
glGetIntegerv(GL_SAMPLES, &sampleCnt);
GrGLint stencil;
glGetIntegerv(GL_STENCIL_BITS, &stencil);
ctx_->resetContext(kRenderTarget_GrGLBackendState | kMisc_GrGLBackendState);
GrGLFramebufferInfo info;
info.fFBOID = 0;
sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeSRGB();
const auto colorSettings = ColorSettings(colorSpace);
info.fFormat = colorSettings.pixFormat;
target_ = GrBackendRenderTargets::MakeGL(canvas_width, canvas_height,
sampleCnt, stencil, info);
surface_ = SkSurfaces::WrapBackendRenderTarget(
ctx_.get(), target_, kBottomLeft_GrSurfaceOrigin, colorSettings.colorType,
colorSpace, nullptr);
assert(surface_);