OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkLua.h" | 8 #include "SkLua.h" |
9 | 9 |
10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
11 #include "GrReducedClip.h" | 11 #include "GrReducedClip.h" |
12 #endif | 12 #endif |
13 | 13 |
14 #include "SkBlurImageFilter.h" | 14 #include "SkBlurImageFilter.h" |
15 #include "SkCanvas.h" | 15 #include "SkCanvas.h" |
16 #include "SkData.h" | 16 #include "SkData.h" |
17 #include "SkDecodingImageGenerator.h" | |
18 #include "SkDocument.h" | 17 #include "SkDocument.h" |
19 #include "SkGradientShader.h" | 18 #include "SkGradientShader.h" |
20 #include "SkImage.h" | 19 #include "SkImage.h" |
21 #include "SkMatrix.h" | 20 #include "SkMatrix.h" |
22 #include "SkPaint.h" | 21 #include "SkPaint.h" |
23 #include "SkPath.h" | 22 #include "SkPath.h" |
24 #include "SkPictureRecorder.h" | 23 #include "SkPictureRecorder.h" |
25 #include "SkPixelRef.h" | 24 #include "SkPixelRef.h" |
26 #include "SkRRect.h" | 25 #include "SkRRect.h" |
27 #include "SkString.h" | 26 #include "SkString.h" |
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2001 push_ref(L, surface)->unref(); | 2000 push_ref(L, surface)->unref(); |
2002 } | 2001 } |
2003 return 1; | 2002 return 1; |
2004 } | 2003 } |
2005 | 2004 |
2006 static int lsk_loadImage(lua_State* L) { | 2005 static int lsk_loadImage(lua_State* L) { |
2007 if (lua_gettop(L) > 0 && lua_isstring(L, 1)) { | 2006 if (lua_gettop(L) > 0 && lua_isstring(L, 1)) { |
2008 const char* name = lua_tolstring(L, 1, NULL); | 2007 const char* name = lua_tolstring(L, 1, NULL); |
2009 SkAutoDataUnref data(SkData::NewFromFileName(name)); | 2008 SkAutoDataUnref data(SkData::NewFromFileName(name)); |
2010 if (data.get()) { | 2009 if (data.get()) { |
2011 SkImage* image = SkImage::NewFromGenerator( | 2010 SkImage* image = SkImage::NewFromData(data); |
2012 SkDecodingImageGenerator::Create(data, SkDecodingImageGenerator:
:Options())); | |
2013 | |
2014 if (image) { | 2011 if (image) { |
2015 push_ref(L, image)->unref(); | 2012 push_ref(L, image)->unref(); |
2016 return 1; | 2013 return 1; |
2017 } | 2014 } |
2018 } | 2015 } |
2019 } | 2016 } |
2020 return 0; | 2017 return 0; |
2021 } | 2018 } |
2022 | 2019 |
2023 static void register_Sk(lua_State* L) { | 2020 static void register_Sk(lua_State* L) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2067 REG_CLASS(L, SkSurface); | 2064 REG_CLASS(L, SkSurface); |
2068 REG_CLASS(L, SkTextBlob); | 2065 REG_CLASS(L, SkTextBlob); |
2069 REG_CLASS(L, SkTypeface); | 2066 REG_CLASS(L, SkTypeface); |
2070 } | 2067 } |
2071 | 2068 |
2072 extern "C" int luaopen_skia(lua_State* L); | 2069 extern "C" int luaopen_skia(lua_State* L); |
2073 extern "C" int luaopen_skia(lua_State* L) { | 2070 extern "C" int luaopen_skia(lua_State* L) { |
2074 SkLua::Load(L); | 2071 SkLua::Load(L); |
2075 return 0; | 2072 return 0; |
2076 } | 2073 } |
OLD | NEW |