aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gpu/ProxyUtils.h
blob: 6dfcd713f8028b39d121bd99cf1c92fb14ade6e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * 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 "GrTextureProxy.h"
#include "GrTypesPriv.h"

namespace sk_gpu_test {

/** Makes a texture proxy containing the passed in color data. */
sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT, int width, int height,
                                               GrColorType, GrSRGBEncoded, GrSurfaceOrigin,
                                               const void* data, size_t rowBytes);

/** Version that assumes GrSRGBEncoded::kNo. */
inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT, int width,
                                                      int height, GrColorType ct,
                                                      GrSurfaceOrigin origin, const void* data,
                                                      size_t rowBytes) {
    return MakeTextureProxyFromData(context, isRT, width, height, ct, GrSRGBEncoded::kNo, origin,
                                    data, rowBytes);
}

/** Version that takes SkColorType rather than GrColorType and assumes GrSRGBEncoded::kNo. */
inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT, int width,
                                                      int height, SkColorType ct,
                                                      GrSurfaceOrigin origin, const void* data,
                                                      size_t rowBytes) {
    return MakeTextureProxyFromData(context, isRT, width, height, SkColorTypeToGrColorType(ct),
                                    origin, data, rowBytes);
}

}  // namespace sk_gpu_test

#endif