2020-06-26 17:32:09 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2020 Google LLC
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2020-10-12 18:45:12 +00:00
|
|
|
#include "include/core/SkColor.h"
|
2020-06-26 17:32:09 +00:00
|
|
|
#include "include/core/SkRefCnt.h"
|
|
|
|
#include "include/gpu/GrTypes.h"
|
|
|
|
|
2020-07-20 20:02:05 +00:00
|
|
|
class GrDirectContext;
|
2020-10-12 18:45:12 +00:00
|
|
|
class SkColorSpace;
|
2020-06-26 17:32:09 +00:00
|
|
|
class SkImage;
|
|
|
|
class SkPixmap;
|
2020-10-12 18:45:12 +00:00
|
|
|
struct SkISize;
|
2020-06-26 17:32:09 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
2020-10-12 18:45:12 +00:00
|
|
|
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);
|
|
|
|
|
2020-06-26 17:32:09 +00:00
|
|
|
} // namespace sk_gpu_test
|