skia2/tools/gpu/BackendTextureImageFactory.h
Brian Salomon 7205080055 Revert "Reland "Revert "Use ManagedBackendTexture in place of TestUtils backend texture helpers."""
This reverts commit 4efaf5e9fe.

Cq-Include-Trybots: luci.skia.skia.primary:Test-Win10-MSVC-Golo-GPU-QuadroP400-x86_64-Debug-All-Direct3D,Test-Win10-Clang-ShuttleA-GPU-RadeonHD7770-x86_64-Debug-All-Direct3D
Change-Id: I0f5f1c427e8892a67b027b0fbe4863d9fcee2363
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325863
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-13 01:22:13 +00:00

40 lines
1.5 KiB
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 "include/core/SkColor.h"
#include "include/core/SkRefCnt.h"
#include "include/gpu/GrTypes.h"
class GrDirectContext;
class SkColorSpace;
class SkImage;
class SkPixmap;
struct SkISize;
namespace sk_gpu_test {
/**
* Creates a backend texture with pixmap contents and wraps it in a SkImage that safely deletes
* the texture when it goes away. Unlike using makeTextureImage() on a non-GPU image, this will
* fail rather than fallback if the pixmaps's color type doesn't map to a supported texture format.
* For testing purposes the texture can be made renderable to exercise different code paths for
* renderable textures/formats.
*/
sk_sp<SkImage> MakeBackendTextureImage(GrDirectContext*,
const SkPixmap&,
GrRenderable,
GrSurfaceOrigin);
/** Creates an image of with a solid color. */
sk_sp<SkImage> MakeBackendTextureImage(GrDirectContext*,
const SkImageInfo& info,
SkColor4f,
GrMipmapped = GrMipmapped::kNo,
GrRenderable = GrRenderable::kNo,
GrSurfaceOrigin = GrSurfaceOrigin::kTopLeft_GrSurfaceOrigin);
} // namespace sk_gpu_test