| Index: src/utils/SkLua.cpp
|
| diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
|
| index e5d4c2b3a49ea93342f8fc07a20a7efe09c78b14..307e5f6152d0e72d445f3b051d7a3a6ea686d8af 100644
|
| --- a/src/utils/SkLua.cpp
|
| +++ b/src/utils/SkLua.cpp
|
| @@ -502,13 +502,13 @@ static SkPaint* lua2OptionalPaint(lua_State* L, int index, SkPaint* paint) {
|
| return paint;
|
| }
|
| }
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| static int lcanvas_drawImage(lua_State* L) {
|
| SkCanvas* canvas = get_ref<SkCanvas>(L, 1);
|
| SkImage* image = get_ref<SkImage>(L, 2);
|
| - if (NULL == image) {
|
| + if (nullptr == image) {
|
| return 0;
|
| }
|
| SkScalar x = lua2scalar(L, 3);
|
| @@ -522,12 +522,12 @@ static int lcanvas_drawImage(lua_State* L) {
|
| static int lcanvas_drawImageRect(lua_State* L) {
|
| SkCanvas* canvas = get_ref<SkCanvas>(L, 1);
|
| SkImage* image = get_ref<SkImage>(L, 2);
|
| - if (NULL == image) {
|
| + if (nullptr == image) {
|
| return 0;
|
| }
|
|
|
| SkRect srcR, dstR;
|
| - SkRect* srcRPtr = NULL;
|
| + SkRect* srcRPtr = nullptr;
|
| if (!lua_isnil(L, 3)) {
|
| srcRPtr = lua2rect(L, 3, &srcR);
|
| }
|
| @@ -543,8 +543,8 @@ static int lcanvas_drawPatch(lua_State* L) {
|
| SkColor colorStorage[4];
|
| SkPoint texStorage[4];
|
|
|
| - const SkColor* colors = NULL;
|
| - const SkPoint* texs = NULL;
|
| + const SkColor* colors = nullptr;
|
| + const SkPoint* texs = nullptr;
|
|
|
| getarray_points(L, 2, cubics, 12);
|
|
|
| @@ -560,7 +560,7 @@ static int lcanvas_drawPatch(lua_State* L) {
|
| texs = texStorage;
|
| }
|
|
|
| - get_ref<SkCanvas>(L, 1)->drawPatch(cubics, colors, texs, NULL, *get_obj<SkPaint>(L, 5));
|
| + get_ref<SkCanvas>(L, 1)->drawPatch(cubics, colors, texs, nullptr, *get_obj<SkPaint>(L, 5));
|
| return 0;
|
| }
|
|
|
| @@ -576,7 +576,7 @@ static int lcanvas_drawPicture(lua_State* L) {
|
| SkPicture* picture = get_ref<SkPicture>(L, 2);
|
| SkScalar x = lua2scalar_def(L, 3, 0);
|
| SkScalar y = lua2scalar_def(L, 4, 0);
|
| - SkMatrix matrix, *matrixPtr = NULL;
|
| + SkMatrix matrix, *matrixPtr = nullptr;
|
| if (x || y) {
|
| matrix.setTranslate(x, y);
|
| matrixPtr = &matrix;
|
| @@ -646,7 +646,7 @@ int SkLua::lcanvas_getReducedClipStack(lua_State* L) {
|
| &genID,
|
| &initialState,
|
| &resultBounds,
|
| - NULL);
|
| + nullptr);
|
|
|
| GrReducedClip::ElementList::Iter iter(elements);
|
| int i = 0;
|
| @@ -671,7 +671,7 @@ static int lcanvas_save(lua_State* L) {
|
|
|
| static int lcanvas_saveLayer(lua_State* L) {
|
| SkPaint paint;
|
| - lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->saveLayer(NULL, lua2OptionalPaint(L, 2, &paint)));
|
| + lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->saveLayer(nullptr, lua2OptionalPaint(L, 2, &paint)));
|
| return 1;
|
| }
|
|
|
| @@ -710,7 +710,7 @@ static int lcanvas_newSurface(lua_State* L) {
|
| int height = lua2int_def(L, 3, 0);
|
| SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
|
| SkSurface* surface = get_ref<SkCanvas>(L, 1)->newSurface(info);
|
| - if (NULL == surface) {
|
| + if (nullptr == surface) {
|
| lua_pushnil(L);
|
| } else {
|
| push_ref(L, surface)->unref();
|
| @@ -754,13 +754,13 @@ const struct luaL_Reg gSkCanvas_Methods[] = {
|
| { "newSurface", lcanvas_newSurface },
|
|
|
| { "__gc", lcanvas_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| static int ldocument_beginPage(lua_State* L) {
|
| - const SkRect* contentPtr = NULL;
|
| + const SkRect* contentPtr = nullptr;
|
| push_ref(L, get_ref<SkDocument>(L, 1)->beginPage(lua2scalar(L, 2),
|
| lua2scalar(L, 3),
|
| contentPtr));
|
| @@ -787,7 +787,7 @@ static const struct luaL_Reg gSkDocument_Methods[] = {
|
| { "endPage", ldocument_endPage },
|
| { "close", ldocument_close },
|
| { "__gc", ldocument_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1176,7 +1176,7 @@ static const struct luaL_Reg gSkPaint_Methods[] = {
|
| { "setShader", lpaint_setShader },
|
| { "getPathEffect", lpaint_getPathEffect },
|
| { "__gc", lpaint_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1260,7 +1260,7 @@ static const struct luaL_Reg gSkShader_Methods[] = {
|
| { "isABitmap", lshader_isABitmap },
|
| { "asAGradient", lshader_asAGradient },
|
| { "__gc", lshader_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1289,7 +1289,7 @@ static int lpatheffect_gc(lua_State* L) {
|
| static const struct luaL_Reg gSkPathEffect_Methods[] = {
|
| { "asADash", lpatheffect_asADash },
|
| { "__gc", lpatheffect_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1301,7 +1301,7 @@ static int lpimagefilter_gc(lua_State* L) {
|
|
|
| static const struct luaL_Reg gSkImageFilter_Methods[] = {
|
| { "__gc", lpimagefilter_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1390,7 +1390,7 @@ static const struct luaL_Reg gSkMatrix_Methods[] = {
|
| { "setRectToRect", lmatrix_setRectToRect },
|
| { "invert", lmatrix_invert },
|
| { "mapXY", lmatrix_mapXY },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1568,7 +1568,7 @@ static const struct luaL_Reg gSkPath_Methods[] = {
|
| { "cubicTo", lpath_cubicTo },
|
| { "close", lpath_close },
|
| { "__gc", lpath_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1620,7 +1620,7 @@ static const struct luaL_Reg gSkRRect_Methods[] = {
|
| { "type", lrrect_type },
|
| { "radii", lrrect_radii },
|
| { "__gc", lrrect_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1637,7 +1637,7 @@ static int limage_height(lua_State* L) {
|
|
|
| static int limage_newShader(lua_State* L) {
|
| SkShader::TileMode tmode = SkShader::kClamp_TileMode;
|
| - const SkMatrix* localM = NULL;
|
| + const SkMatrix* localM = nullptr;
|
| SkAutoTUnref<SkShader> shader(get_ref<SkImage>(L, 1)->newShader(tmode, tmode, localM));
|
| push_ref(L, shader.get());
|
| return 1;
|
| @@ -1653,7 +1653,7 @@ static const struct luaL_Reg gSkImage_Methods[] = {
|
| { "height", limage_height },
|
| { "newShader", limage_newShader },
|
| { "__gc", limage_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1670,7 +1670,7 @@ static int lsurface_height(lua_State* L) {
|
|
|
| static int lsurface_getCanvas(lua_State* L) {
|
| SkCanvas* canvas = get_ref<SkSurface>(L, 1)->getCanvas();
|
| - if (NULL == canvas) {
|
| + if (nullptr == canvas) {
|
| lua_pushnil(L);
|
| } else {
|
| push_ref(L, canvas);
|
| @@ -1685,7 +1685,7 @@ static int lsurface_getCanvas(lua_State* L) {
|
|
|
| static int lsurface_newImageSnapshot(lua_State* L) {
|
| SkImage* image = get_ref<SkSurface>(L, 1)->newImageSnapshot();
|
| - if (NULL == image) {
|
| + if (nullptr == image) {
|
| lua_pushnil(L);
|
| } else {
|
| push_ref(L, image)->unref();
|
| @@ -1698,7 +1698,7 @@ static int lsurface_newSurface(lua_State* L) {
|
| int height = lua2int_def(L, 3, 0);
|
| SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
|
| SkSurface* surface = get_ref<SkSurface>(L, 1)->newSurface(info);
|
| - if (NULL == surface) {
|
| + if (nullptr == surface) {
|
| lua_pushnil(L);
|
| } else {
|
| push_ref(L, surface)->unref();
|
| @@ -1718,7 +1718,7 @@ static const struct luaL_Reg gSkSurface_Methods[] = {
|
| { "newImageSnapshot", lsurface_newImageSnapshot },
|
| { "newSurface", lsurface_newSurface },
|
| { "__gc", lsurface_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1732,7 +1732,7 @@ static int lpicturerecorder_beginRecording(lua_State* L) {
|
| }
|
|
|
| SkCanvas* canvas = get_obj<SkPictureRecorder>(L, 1)->beginRecording(w, h);
|
| - if (NULL == canvas) {
|
| + if (nullptr == canvas) {
|
| lua_pushnil(L);
|
| return 1;
|
| }
|
| @@ -1743,7 +1743,7 @@ static int lpicturerecorder_beginRecording(lua_State* L) {
|
|
|
| static int lpicturerecorder_getCanvas(lua_State* L) {
|
| SkCanvas* canvas = get_obj<SkPictureRecorder>(L, 1)->getRecordingCanvas();
|
| - if (NULL == canvas) {
|
| + if (nullptr == canvas) {
|
| lua_pushnil(L);
|
| return 1;
|
| }
|
| @@ -1753,7 +1753,7 @@ static int lpicturerecorder_getCanvas(lua_State* L) {
|
|
|
| static int lpicturerecorder_endRecording(lua_State* L) {
|
| SkPicture* pic = get_obj<SkPictureRecorder>(L, 1)->endRecording();
|
| - if (NULL == pic) {
|
| + if (nullptr == pic) {
|
| lua_pushnil(L);
|
| return 1;
|
| }
|
| @@ -1771,7 +1771,7 @@ static const struct luaL_Reg gSkPictureRecorder_Methods[] = {
|
| { "getCanvas", lpicturerecorder_getCanvas },
|
| { "endRecording", lpicturerecorder_endRecording },
|
| { "__gc", lpicturerecorder_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1795,7 +1795,7 @@ static const struct luaL_Reg gSkPicture_Methods[] = {
|
| { "width", lpicture_width },
|
| { "height", lpicture_height },
|
| { "__gc", lpicture_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1813,7 +1813,7 @@ static int ltextblob_gc(lua_State* L) {
|
| static const struct luaL_Reg gSkTextBlob_Methods[] = {
|
| { "bounds", ltextblob_bounds },
|
| { "__gc", ltextblob_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1839,7 +1839,7 @@ static const struct luaL_Reg gSkTypeface_Methods[] = {
|
| { "getFamilyName", ltypeface_getFamilyName },
|
| { "getStyle", ltypeface_getStyle },
|
| { "__gc", ltypeface_gc },
|
| - { NULL, NULL }
|
| + { nullptr, nullptr }
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -1873,13 +1873,13 @@ private:
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| static int lsk_newDocumentPDF(lua_State* L) {
|
| - const char* file = NULL;
|
| + const char* file = nullptr;
|
| if (lua_gettop(L) > 0 && lua_isstring(L, 1)) {
|
| - file = lua_tolstring(L, 1, NULL);
|
| + file = lua_tolstring(L, 1, nullptr);
|
| }
|
|
|
| SkDocument* doc = SkDocument::CreatePDF(file);
|
| - if (NULL == doc) {
|
| + if (nullptr == doc) {
|
| // do I need to push a nil on the stack and return 1?
|
| return 0;
|
| } else {
|
| @@ -1892,7 +1892,7 @@ static int lsk_newBlurImageFilter(lua_State* L) {
|
| SkScalar sigmaX = lua2scalar_def(L, 1, 0);
|
| SkScalar sigmaY = lua2scalar_def(L, 2, 0);
|
| SkImageFilter* imf = SkBlurImageFilter::Create(sigmaX, sigmaY);
|
| - if (NULL == imf) {
|
| + if (nullptr == imf) {
|
| lua_pushnil(L);
|
| } else {
|
| push_ref(L, imf)->unref();
|
| @@ -1910,8 +1910,8 @@ static int lsk_newLinearGradient(lua_State* L) {
|
|
|
| SkPoint pts[] = { { x0, y0 }, { x1, y1 } };
|
| SkColor colors[] = { c0, c1 };
|
| - SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode);
|
| - if (NULL == s) {
|
| + SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
|
| + if (nullptr == s) {
|
| lua_pushnil(L);
|
| } else {
|
| push_ref(L, s)->unref();
|
| @@ -1947,7 +1947,7 @@ static int lsk_newRRect(lua_State* L) {
|
| #include "SkTextBox.h"
|
| // Sk.newTextBlob(text, rect, paint)
|
| static int lsk_newTextBlob(lua_State* L) {
|
| - const char* text = lua_tolstring(L, 1, NULL);
|
| + const char* text = lua_tolstring(L, 1, nullptr);
|
| SkRect bounds;
|
| lua2rect(L, 2, &bounds);
|
| const SkPaint& paint = *get_obj<SkPaint>(L, 3);
|
| @@ -1965,21 +1965,21 @@ static int lsk_newTextBlob(lua_State* L) {
|
| }
|
|
|
| static int lsk_newTypeface(lua_State* L) {
|
| - const char* name = NULL;
|
| + const char* name = nullptr;
|
| int style = SkTypeface::kNormal;
|
|
|
| int count = lua_gettop(L);
|
| if (count > 0 && lua_isstring(L, 1)) {
|
| - name = lua_tolstring(L, 1, NULL);
|
| + name = lua_tolstring(L, 1, nullptr);
|
| if (count > 1 && lua_isnumber(L, 2)) {
|
| - style = lua_tointegerx(L, 2, NULL) & SkTypeface::kBoldItalic;
|
| + style = lua_tointegerx(L, 2, nullptr) & SkTypeface::kBoldItalic;
|
| }
|
| }
|
|
|
| SkTypeface* face = SkTypeface::CreateFromName(name,
|
| (SkTypeface::Style)style);
|
| // SkDebugf("---- name <%s> style=%d, face=%p ref=%d\n", name, style, face, face->getRefCnt());
|
| - if (NULL == face) {
|
| + if (nullptr == face) {
|
| face = SkTypeface::RefDefault();
|
| }
|
| push_ref(L, face)->unref();
|
| @@ -1992,7 +1992,7 @@ static int lsk_newRasterSurface(lua_State* L) {
|
| SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
|
| SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
|
| SkSurface* surface = SkSurface::NewRaster(info, &props);
|
| - if (NULL == surface) {
|
| + if (nullptr == surface) {
|
| lua_pushnil(L);
|
| } else {
|
| push_ref(L, surface)->unref();
|
| @@ -2002,7 +2002,7 @@ static int lsk_newRasterSurface(lua_State* L) {
|
|
|
| static int lsk_loadImage(lua_State* L) {
|
| if (lua_gettop(L) > 0 && lua_isstring(L, 1)) {
|
| - const char* name = lua_tolstring(L, 1, NULL);
|
| + const char* name = lua_tolstring(L, 1, nullptr);
|
| SkAutoDataUnref data(SkData::NewFromFileName(name));
|
| if (data.get()) {
|
| SkImage* image = SkImage::NewFromEncoded(data);
|
|
|