skia2/include/utils/SkLua.h
Mike Klein c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00

70 lines
2.3 KiB
C++

/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkLua_DEFINED
#define SkLua_DEFINED
#include "include/core/SkColor.h"
#include "include/core/SkPathEffect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkString.h"
struct lua_State;
class SkCanvas;
class SkMatrix;
class SkPaint;
class SkPath;
struct SkRect;
class SkRRect;
class SkTextBlob;
#define SkScalarToLua(x) SkScalarToDouble(x)
#define SkLuaToScalar(x) SkDoubleToScalar(x)
class SkLua {
public:
static void Load(lua_State*);
SkLua(const char termCode[] = nullptr); // creates a new L, will close it
SkLua(lua_State*); // uses L, will not close it
~SkLua();
lua_State* get() const { return fL; }
lua_State* operator*() const { return fL; }
lua_State* operator->() const { return fL; }
bool runCode(const char code[]);
bool runCode(const void* code, size_t size);
void pushBool(bool, const char tableKey[] = nullptr);
void pushString(const char[], const char tableKey[] = nullptr);
void pushString(const char[], size_t len, const char tableKey[] = nullptr);
void pushString(const SkString&, const char tableKey[] = nullptr);
void pushArrayU16(const uint16_t[], int count, const char tableKey[] = nullptr);
void pushArrayPoint(const SkPoint[], int count, const char key[] = nullptr);
void pushArrayScalar(const SkScalar[], int count, const char key[] = nullptr);
void pushColor(SkColor, const char tableKey[] = nullptr);
void pushU32(uint32_t, const char tableKey[] = nullptr);
void pushScalar(SkScalar, const char tableKey[] = nullptr);
void pushRect(const SkRect&, const char tableKey[] = nullptr);
void pushRRect(const SkRRect&, const char tableKey[] = nullptr);
void pushDash(const SkPathEffect::DashInfo&, const char tableKey[] = nullptr);
void pushMatrix(const SkMatrix&, const char tableKey[] = nullptr);
void pushPaint(const SkPaint&, const char tableKey[] = nullptr);
void pushPath(const SkPath&, const char tableKey[] = nullptr);
void pushCanvas(SkCanvas*, const char tableKey[] = nullptr);
void pushTextBlob(const SkTextBlob*, const char tableKey[] = nullptr);
private:
lua_State* fL;
SkString fTermCode;
bool fWeOwnL;
};
#endif