blob: 19c64d576accb56da7ebc9f5cb93e524a32e345c [file] [log] [blame]
/*
* Copyright 2020 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrStagingBuffer.h"
#include "src/core/SkMathPriv.h"
void GrStagingBuffer::markAvailable(void* data) {
fData = data;
fOffset = 0;
fGpu->markStagingBufferAvailable(this);
}
void GrStagingBuffer::unmap() {
this->onUnmap();
}
GrStagingBuffer::Slice GrStagingBuffer::allocate(size_t size) {
size_t offset = fOffset;
fOffset += size;
char* data = static_cast<char*>(fData) + offset;
return Slice(this, offset, data);
}