GrRenderTarget * renderTarget = _context->wrapBackendRenderTarget(desc);
SkSurface * surface = SkSurface::NewRenderTargetDirect(renderTarget);
and the iOSSampleApp and SimpleiOSApp in experimental do not feature an xcode project.
Any help appreciated to get me started!
// setup GrContext
sk_sp<const GrGLInterface> interface(GrGLCreateNativeInterface());
// setup contexts
sk_sp<GrContext> grContext(GrContext::MakeGL(interface.get()));
SkASSERT(grContext);
// Wrap the frame buffer object attached to the screen in a Skia render target so Skia can
// render to it
GrGLint buffer;
GR_GL_GetIntegerv(interface.get(), GR_GL_FRAMEBUFFER_BINDING, &buffer);
GrGLFramebufferInfo info;
info.fFBOID = (GrGLuint) buffer;
GrBackendRenderTarget target(dm.w, dm.h, kMsaaSampleCount, kStencilBits,
kSkia8888_GrPixelConfig, info);
// setup SkSurface
SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
sk_sp<SkSurface> surface(SkSurface::MakeFromBackendRenderTarget(grContext.get(), target,
kBottomLeft_GrSurfaceOrigin,
nullptr, &props));
SkCanvas* canvas = surface->getCanvas();
Let me know if I can answer any other questions.
Jim
--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.
sk_sp<SkTypeface> eauTypeFace = SkTypeface::MakeFromFile([imagepath UTF8String]);
after making the surface and set the type face on my SkPaint object. However, even if I don't assign it to SkPaint with setTypeface and just let this go out of scope, it will lead to a memory leak. I create and remove the Skia/OpenGL views frequently in my app, and using the memory profiler in Xcode, I can see that this leaks. When removing the above line, there is no leak. I cannot call unref and reset does not help either.
Thoughts?
const char* str = [s_fontPath UTF8String];
sk_sp<SkTypeface> face = SkTypeface::MakeFromFile(str);
if (face && face.get())
}