1/*
2 * Copyright 2020 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#include "src/gpu/GrGpu.h"
9#include "src/gpu/GrStagingBuffer.h"
10
11#include "src/core/SkMathPriv.h"
12
13void GrStagingBuffer::markAvailable(void* data) {
14 fData = data;
15 fOffset = 0;
16 fGpu->markStagingBufferAvailable(this);
17}
18
19void GrStagingBuffer::unmap() {
20 this->onUnmap();
21}
22
23GrStagingBuffer::Slice GrStagingBuffer::allocate(size_t size) {
24 size_t offset = fOffset;
25 fOffset += size;
26 char* data = static_cast<char*>(fData) + offset;
27 return Slice(this, offset, data);
28}
29