Index: src/gpu/GrResourceProvider.cpp |
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp |
index a8c9e5a3c76ab67c5898b7bb0285a5beda043fe1..9a2fff31418eb5b53610eb7d75ab8b865b3bc7f6 100644 |
--- a/src/gpu/GrResourceProvider.cpp |
+++ b/src/gpu/GrResourceProvider.cpp |
@@ -91,7 +91,8 @@ GrPathRange* GrResourceProvider::createGlyphs(const SkTypeface* tf, |
} |
GrBuffer* GrResourceProvider::createBuffer(size_t size, GrBufferType intendedType, |
- GrAccessPattern accessPattern, uint32_t flags) { |
+ GrAccessPattern accessPattern, uint32_t flags, |
+ const void* data) { |
if (this->isAbandoned()) { |
return nullptr; |
} |
@@ -110,11 +111,14 @@ GrBuffer* GrResourceProvider::createBuffer(size_t size, GrBufferType intendedTyp |
scratchFlags = GrResourceCache::kPreferNoPendingIO_ScratchFlag; |
} |
GrGpuResource* resource = this->cache()->findAndRefScratchResource(key, size, scratchFlags); |
- if (resource) { |
- return static_cast<GrBuffer*>(resource); |
+ if (GrBuffer* buffer = static_cast<GrBuffer*>(resource)) { |
+ if (data) { |
+ buffer->updateData(data, size); |
+ } |
+ return buffer; |
} |
} |
- return this->gpu()->createBuffer(size, intendedType, accessPattern); |
+ return this->gpu()->createBuffer(size, intendedType, accessPattern, data); |
} |
GrBatchAtlas* GrResourceProvider::createAtlas(GrPixelConfig config, |