• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef ProxyUtils_DEFINED
9 #define ProxyUtils_DEFINED
10 
11 #include "include/private/GrTypesPriv.h"
12 #include "src/gpu/GrTextureProxy.h"
13 
14 namespace sk_gpu_test {
15 
16 /** Makes a texture proxy containing the passed in color data. */
17 sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext*, GrRenderable, int width, int height,
18                                                GrColorType, SkAlphaType, GrSurfaceOrigin,
19                                                const void* data, size_t rowBytes);
20 
21 /** Version that takes SkColorType rather than GrColorType. */
MakeTextureProxyFromData(GrContext * context,GrRenderable renderable,int width,int height,SkColorType ct,SkAlphaType alphaType,GrSurfaceOrigin origin,const void * data,size_t rowBytes)22 inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, GrRenderable renderable,
23                                                       int width, int height, SkColorType ct,
24                                                       SkAlphaType alphaType, GrSurfaceOrigin origin,
25                                                       const void* data, size_t rowBytes) {
26     GrColorType grCT = SkColorTypeToGrColorType(ct);
27     if (GrColorType::kUnknown == grCT) {
28         return nullptr;
29     }
30 
31     return MakeTextureProxyFromData(context, renderable, width, height, grCT, alphaType, origin,
32                                     data, rowBytes);
33 }
34 
35 }  // namespace sk_gpu_test
36 
37 #endif
38