skia2/tools/gpu/ProxyUtils.h
Robert Phillips 9dbcdcc8ba Alter createTestingOnlyBackendTexture methods
This intended to bring this API more into line with the proposed GrBackendObject API with an eye towards replacing the former with the latter.

TBR=bsalomon@google.com
Change-Id: I4367f03fb10fff788749f21c4843060111a6df1c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213220
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-05-13 15:39:33 +00:00

49 lines
2.1 KiB
C++

/*
* Copyright 2018 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef ProxyUtils_DEFINED
#define ProxyUtils_DEFINED
#include "include/private/GrTextureProxy.h"
#include "include/private/GrTypesPriv.h"
namespace sk_gpu_test {
/** Makes a texture proxy containing the passed in color data. */
sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext*, GrRenderable, int width, int height,
GrColorType, GrSRGBEncoded, GrSurfaceOrigin,
const void* data, size_t rowBytes);
/** Version that takes GrColorType rather than SkColorType and assumes GrSRGBEncoded::kNo. */
inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context,
GrRenderable renderable, int width,
int height, GrColorType grCT,
GrSurfaceOrigin origin, const void* data,
size_t rowBytes) {
return MakeTextureProxyFromData(context, renderable, width, height,
grCT, GrSRGBEncoded::kNo, origin, data, rowBytes);
}
/** Version that takes SkColorType rather than GrColorType and assumes GrSRGBEncoded::kNo. */
inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context,
GrRenderable renderable, int width,
int height, SkColorType ct,
GrSurfaceOrigin origin, const void* data,
size_t rowBytes) {
GrColorType grCT = SkColorTypeToGrColorType(ct);
if (GrColorType::kUnknown == grCT) {
return nullptr;
}
return MakeTextureProxyFromData(context, renderable, width, height,
grCT, GrSRGBEncoded::kNo, origin, data, rowBytes);
}
} // namespace sk_gpu_test
#endif