Add makeBuffer and caps to GrOnFlushResourceProvider

Bug: skia:
Change-Id: Ie3101ca20743a953621815bdae886c995d39c9e6
Reviewed-on: https://skia-review.googlesource.com/20315
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2017-06-20 11:35:59 -07:00 committed by Skia Commit-Bot
parent ffa8484eb0
commit 6081ebb689
2 changed files with 16 additions and 0 deletions

View File

@ -64,3 +64,14 @@ sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext(
return renderTargetContext;
}
sk_sp<GrBuffer> GrOnFlushResourceProvider::makeBuffer(GrBufferType intendedType, size_t size,
const void* data) {
GrResourceProvider* rp = fDrawingMgr->getContext()->resourceProvider();
return sk_sp<GrBuffer>(rp->createBuffer(size, intendedType, kDynamic_GrAccessPattern,
GrResourceProvider::kNoPendingIO_Flag,
data));
}
const GrCaps* GrOnFlushResourceProvider::caps() const {
return fDrawingMgr->getContext()->caps();
}

View File

@ -68,6 +68,11 @@ public:
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* props);
// Creates a GPU buffer with a "dynamic" access pattern.
sk_sp<GrBuffer> makeBuffer(GrBufferType, size_t, const void* data = nullptr);
const GrCaps* caps() const;
private:
explicit GrOnFlushResourceProvider(GrDrawingManager* drawingMgr) : fDrawingMgr(drawingMgr) {}
GrOnFlushResourceProvider(const GrOnFlushResourceProvider&) = delete;