1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrMockBuffer_DEFINED 9 #define GrMockBuffer_DEFINED 10 11 #include "GrBuffer.h" 12 #include "GrMockGpu.h" 13 14 class GrMockBuffer : public GrBuffer { 15 public: GrMockBuffer(GrMockGpu * gpu,size_t sizeInBytes,GrBufferType type,GrAccessPattern accessPattern)16 GrMockBuffer(GrMockGpu* gpu, size_t sizeInBytes, GrBufferType type, 17 GrAccessPattern accessPattern) 18 : INHERITED(gpu, sizeInBytes, type, accessPattern) { 19 this->registerWithCache(SkBudgeted::kYes); 20 } 21 22 private: onMap()23 void onMap() override {} onUnmap()24 void onUnmap() override {} onUpdateData(const void * src,size_t srcSizeInBytes)25 bool onUpdateData(const void* src, size_t srcSizeInBytes) override { return true; } 26 27 typedef GrBuffer INHERITED; 28 }; 29 30 #endif 31