Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: src/utils/SkLua.cpp

Issue 1852743002: Update SkBlurImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT & address code review comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkDropShadowImageFilter.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 return 0; 1956 return 0;
1957 } else { 1957 } else {
1958 push_ref(L, doc)->unref(); 1958 push_ref(L, doc)->unref();
1959 return 1; 1959 return 1;
1960 } 1960 }
1961 } 1961 }
1962 1962
1963 static int lsk_newBlurImageFilter(lua_State* L) { 1963 static int lsk_newBlurImageFilter(lua_State* L) {
1964 SkScalar sigmaX = lua2scalar_def(L, 1, 0); 1964 SkScalar sigmaX = lua2scalar_def(L, 1, 0);
1965 SkScalar sigmaY = lua2scalar_def(L, 2, 0); 1965 SkScalar sigmaY = lua2scalar_def(L, 2, 0);
1966 SkImageFilter* imf = SkBlurImageFilter::Create(sigmaX, sigmaY); 1966 sk_sp<SkImageFilter> imf(SkBlurImageFilter::Make(sigmaX, sigmaY, nullptr));
1967 if (nullptr == imf) { 1967 if (!imf) {
1968 lua_pushnil(L); 1968 lua_pushnil(L);
1969 } else { 1969 } else {
1970 push_ref(L, imf)->unref(); 1970 push_ref(L, std::move(imf));
1971 } 1971 }
1972 return 1; 1972 return 1;
1973 } 1973 }
1974 1974
1975 static int lsk_newLinearGradient(lua_State* L) { 1975 static int lsk_newLinearGradient(lua_State* L) {
1976 SkScalar x0 = lua2scalar_def(L, 1, 0); 1976 SkScalar x0 = lua2scalar_def(L, 1, 0);
1977 SkScalar y0 = lua2scalar_def(L, 2, 0); 1977 SkScalar y0 = lua2scalar_def(L, 2, 0);
1978 SkColor c0 = lua2color(L, 3); 1978 SkColor c0 = lua2color(L, 3);
1979 SkScalar x1 = lua2scalar_def(L, 4, 0); 1979 SkScalar x1 = lua2scalar_def(L, 4, 0);
1980 SkScalar y1 = lua2scalar_def(L, 5, 0); 1980 SkScalar y1 = lua2scalar_def(L, 5, 0);
1981 SkColor c1 = lua2color(L, 6); 1981 SkColor c1 = lua2color(L, 6);
1982 1982
1983 SkPoint pts[] = { { x0, y0 }, { x1, y1 } }; 1983 SkPoint pts[] = { { x0, y0 }, { x1, y1 } };
1984 SkColor colors[] = { c0, c1 }; 1984 SkColor colors[] = { c0, c1 };
1985 auto s = SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkShader::kCl amp_TileMode); 1985 sk_sp<SkShader> s(SkGradientShader::MakeLinear(pts, colors, nullptr, 2,
1986 SkShader::kClamp_TileMode));
1986 if (!s) { 1987 if (!s) {
1987 lua_pushnil(L); 1988 lua_pushnil(L);
1988 } else { 1989 } else {
1989 push_ref(L, std::move(s)); 1990 push_ref(L, std::move(s));
1990 } 1991 }
1991 return 1; 1992 return 1;
1992 } 1993 }
1993 1994
1994 static int lsk_newMatrix(lua_State* L) { 1995 static int lsk_newMatrix(lua_State* L) {
1995 push_new<SkMatrix>(L)->reset(); 1996 push_new<SkMatrix>(L)->reset();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 REG_CLASS(L, SkTextBlob); 2137 REG_CLASS(L, SkTextBlob);
2137 REG_CLASS(L, SkTypeface); 2138 REG_CLASS(L, SkTypeface);
2138 REG_CLASS(L, SkXfermode); 2139 REG_CLASS(L, SkXfermode);
2139 } 2140 }
2140 2141
2141 extern "C" int luaopen_skia(lua_State* L); 2142 extern "C" int luaopen_skia(lua_State* L);
2142 extern "C" int luaopen_skia(lua_State* L) { 2143 extern "C" int luaopen_skia(lua_State* L) {
2143 SkLua::Load(L); 2144 SkLua::Load(L);
2144 return 0; 2145 return 0;
2145 } 2146 }
OLDNEW
« no previous file with comments | « src/effects/SkDropShadowImageFilter.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698