f9b0042423
Add helper to create self-managed BackendTexture-backed SkSurface for tests using MBET. GrGpu::createTestingOnlyBackendRenderTarget supports protected. Make SkSurfaceCharacterization tests use self-managed SkSurface factories and a use case of MakeFromBackendTextureAsRenderTarget is removed. Use self-managed BackendTexture-backed SkSurface factory in DM sinks and in fm. Bug: skia:9832 Change-Id: I0c1dc49697f8b3c942864e18b9112a3552f431ba Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323559 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
28 lines
620 B
C++
28 lines
620 B
C++
/*
|
|
* Copyright 2020 Google LLC
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "tools/gpu/ManagedBackendTexture.h"
|
|
|
|
namespace sk_gpu_test {
|
|
|
|
void ManagedBackendTexture::ReleaseProc(void* context) {
|
|
static_cast<ManagedBackendTexture*>(context)->unref();
|
|
}
|
|
|
|
ManagedBackendTexture::~ManagedBackendTexture() {
|
|
if (fDContext && fTexture.isValid()) {
|
|
fDContext->deleteBackendTexture(fTexture);
|
|
}
|
|
}
|
|
|
|
void* ManagedBackendTexture::releaseContext() {
|
|
this->ref();
|
|
return static_cast<void*>(this);
|
|
}
|
|
|
|
} // namespace sk_gpu_test
|