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>
diff --git a/src/compute/skc/surface.c b/src/compute/skc/surface.c
new file mode 100644
index 0000000..61bfac3
--- /dev/null
+++ b/src/compute/skc/surface.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can
+ * be found in the LICENSE file.
+ *
+ */
+
+//
+//
+//
+
+#include "surface.h"
+#include "composition.h"
+#include "styling.h"
+
+//
+//
+//
+
+skc_err
+skc_surface_retain(skc_surface_t surface)
+{
+ surface->ref_count += 1;
+
+ return SKC_ERR_SUCCESS;
+}
+
+skc_err
+skc_surface_release(skc_surface_t surface)
+{
+ surface->release(surface->impl);
+
+ return SKC_ERR_SUCCESS;
+}
+
+skc_err
+skc_surface_clear(skc_surface_t surface,
+ float const rgba[4],
+ uint32_t const rect[4],
+ void * fb)
+{
+ surface->clear(surface->impl,rgba,rect,fb);
+
+ return SKC_ERR_SUCCESS;
+}
+
+skc_err
+skc_surface_blit(skc_surface_t surface,
+ uint32_t const rect[4],
+ int32_t const txty[2])
+{
+ surface->blit(surface->impl,rect,txty);
+
+ return SKC_ERR_SUCCESS;
+}
+
+//
+//
+//
+
+skc_err
+skc_surface_render(skc_surface_t surface,
+ uint32_t const clip[4],
+ skc_styling_t styling,
+ skc_composition_t composition,
+ skc_surface_render_pfn_notify notify,
+ void * data,
+ void * fb)
+{
+ skc_err err;
+
+ // seal styling -- no dependencies so this will start immediately
+ if ((err = skc_styling_seal(styling)) != SKC_ERR_SUCCESS)
+ return err;
+
+ // seal composition -- force started
+ if ((err = skc_composition_seal(composition)) != SKC_ERR_SUCCESS)
+ return err;
+
+ //
+ // FIXME -- at some point, we will want non-overlapping clips to be
+ // rendered simultaneously. There is plenty of compute for nominal
+ // size render tasks so it might not make much a performance
+ // improvement.
+ //
+ surface->render(surface->impl,clip,styling,composition,notify,data,fb);
+
+ return SKC_ERR_SUCCESS;
+}
+
+//
+//
+//