diff options
author | 2018-06-19 13:57:04 -0700 | |
---|---|---|
committer | 2018-06-20 01:19:18 +0000 | |
commit | 4359d529121fc1f39f882693d641c0133d138d41 (patch) | |
tree | d2c3239162e68d24d5c2cebc8a4f6659860cc2a0 /src/compute/sk/SkContext_Compute.cpp | |
parent | 47c29fa64b3ffc1eec7723d40e9862b2d2a8443f (diff) |
Skia Compute core files
Bug: skia:
Change-Id: I4bba49cf20eff013e581800a3f114c85acd8498c
Reviewed-on: https://skia-review.googlesource.com/135782
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src/compute/sk/SkContext_Compute.cpp')
-rw-r--r-- | src/compute/sk/SkContext_Compute.cpp | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/compute/sk/SkContext_Compute.cpp b/src/compute/sk/SkContext_Compute.cpp new file mode 100644 index 0000000000..331fad6df4 --- /dev/null +++ b/src/compute/sk/SkContext_Compute.cpp @@ -0,0 +1,95 @@ +/* + * Copyright 2016 Google Inc. + * + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + * + */ + +#include "SkContext_Compute.h" + +// +// +// + +// +// +// + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#define TARGET_PLATFORM_SUBSTRING "TO BE SET" +#define TARGET_DEVICE_SUBSTRING "TO BE SET" + +// +// +// + +// +// +// + +SkContext_Compute::SkContext_Compute(GrGLInterface const * fInterface) + : fInterface(fInterface) +{ + // + // Make sure fInterface destruction occurs after compute + // + SkSafeRef(fInterface); + + skc_err err; + + // + // CREATE A NEW SPINEL CONTEXT AND ATTACH TO WINDOW + // + err = skc_context_create(&context, TARGET_PLATFORM_SUBSTRING, TARGET_DEVICE_SUBSTRING); + SKC_ERR_CHECK(err); + + // + // CREATE A NEW REUSABLE INTEROP OBJECT + // + // interop = skc_interop_create(fInterface,1); TODO have this in skc.h + + // + // CREATE A NEW REUSABLE SURFACE OBJECT + // + err = skc_surface_create(context, + interop, + &surface); + SKC_ERR_CHECK(err); +} + +// +// +// + +SkContext_Compute::~SkContext_Compute() +{ + skc_err err; + + // dispose of surface + err = skc_surface_dispose(surface); + SKC_ERR_CHECK(err); + + // dispose of interop + // skc_interop_dispose(interop); TODO have this in skc.h + + // dispose of context + err = skc_context_release(context); + SKC_ERR_CHECK(err); + + // unref GL interface + SkSafeUnref(fInterface); +} + +// +// +// + |