Brian Salomon | f9b0042 | 2020-10-08 16:00:14 -0400 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2020 Google LLC |
| 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 "tools/gpu/ManagedBackendTexture.h" |
| 9 | |
| 10 | namespace sk_gpu_test { |
| 11 | |
| 12 | void ManagedBackendTexture::ReleaseProc(void* context) { |
| 13 | static_cast<ManagedBackendTexture*>(context)->unref(); |
| 14 | } |
| 15 | |
| 16 | ManagedBackendTexture::~ManagedBackendTexture() { |
| 17 | if (fDContext && fTexture.isValid()) { |
| 18 | fDContext->deleteBackendTexture(fTexture); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | void* ManagedBackendTexture::releaseContext() { |
| 23 | this->ref(); |
| 24 | return static_cast<void*>(this); |
| 25 | } |
| 26 | |
| 27 | } // namespace sk_gpu_test |