| Index: tests/SurfaceTest.cpp
|
| diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
|
| index 771fc9ea722fee04cfd3cc1ca488e68cdd6f0734..4efe98592612c8d5e1725a63c05261ee1cd6ce23 100644
|
| --- a/tests/SurfaceTest.cpp
|
| +++ b/tests/SurfaceTest.cpp
|
| @@ -41,7 +41,7 @@ static void release_storage(void* pixels, void* context) {
|
|
|
| static SkSurface* create_surface(SurfaceType surfaceType, GrContext* context,
|
| SkAlphaType at = kPremul_SkAlphaType,
|
| - SkImageInfo* requestedInfo = NULL) {
|
| + SkImageInfo* requestedInfo = nullptr) {
|
| const SkImageInfo info = SkImageInfo::MakeN32(10, 10, at);
|
|
|
| if (requestedInfo) {
|
| @@ -58,11 +58,11 @@ static SkSurface* create_surface(SurfaceType surfaceType, GrContext* context,
|
| release_storage, storage);
|
| }
|
| case kGpu_SurfaceType:
|
| - return SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info, 0, NULL);
|
| + return SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info, 0, nullptr);
|
| case kGpuScratch_SurfaceType:
|
| - return SkSurface::NewRenderTarget(context, SkSurface::kYes_Budgeted, info, 0, NULL);
|
| + return SkSurface::NewRenderTarget(context, SkSurface::kYes_Budgeted, info, 0, nullptr);
|
| }
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| enum ImageType {
|
| @@ -83,26 +83,26 @@ public:
|
| static void test_empty_image(skiatest::Reporter* reporter) {
|
| const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType);
|
|
|
| - REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterCopy(info, NULL, 0));
|
| - REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterData(info, NULL, 0));
|
| - REPORTER_ASSERT(reporter, NULL == SkImage::NewFromRaster(info, NULL, 0, NULL, NULL));
|
| - REPORTER_ASSERT(reporter, NULL == SkImage::NewFromGenerator(new EmptyGenerator));
|
| + REPORTER_ASSERT(reporter, nullptr == SkImage::NewRasterCopy(info, nullptr, 0));
|
| + REPORTER_ASSERT(reporter, nullptr == SkImage::NewRasterData(info, nullptr, 0));
|
| + REPORTER_ASSERT(reporter, nullptr == SkImage::NewFromRaster(info, nullptr, 0, nullptr, nullptr));
|
| + REPORTER_ASSERT(reporter, nullptr == SkImage::NewFromGenerator(new EmptyGenerator));
|
| }
|
|
|
| static void test_empty_surface(skiatest::Reporter* reporter, GrContext* ctx) {
|
| const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType);
|
|
|
| - REPORTER_ASSERT(reporter, NULL == SkSurface::NewRaster(info));
|
| - REPORTER_ASSERT(reporter, NULL == SkSurface::NewRasterDirect(info, NULL, 0));
|
| + REPORTER_ASSERT(reporter, nullptr == SkSurface::NewRaster(info));
|
| + REPORTER_ASSERT(reporter, nullptr == SkSurface::NewRasterDirect(info, nullptr, 0));
|
| if (ctx) {
|
| - REPORTER_ASSERT(reporter, NULL ==
|
| - SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted, info, 0, NULL));
|
| + REPORTER_ASSERT(reporter, nullptr ==
|
| + SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted, info, 0, nullptr));
|
| }
|
| }
|
|
|
| #if SK_SUPPORT_GPU
|
| static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext* ctx) {
|
| - if (NULL == ctx) {
|
| + if (nullptr == ctx) {
|
| return;
|
| }
|
|
|
| @@ -130,7 +130,7 @@ static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext
|
| wrappedDesc.fFlags = kRenderTarget_GrBackendTextureFlag;
|
| wrappedDesc.fTextureHandle = texID;
|
|
|
| - SkAutoTUnref<SkSurface> surface(SkSurface::NewWrappedRenderTarget(ctx, wrappedDesc, NULL));
|
| + SkAutoTUnref<SkSurface> surface(SkSurface::NewWrappedRenderTarget(ctx, wrappedDesc, nullptr));
|
| REPORTER_ASSERT(reporter, surface);
|
| if (surface) {
|
| // Validate that we can draw to the canvas and that the original texture color is preserved
|
| @@ -196,7 +196,7 @@ struct ReleaseDataContext {
|
| ReleaseDataContext* state = (ReleaseDataContext*)context;
|
| REPORTER_ASSERT(state->fReporter, state->fData);
|
| state->fData->unref();
|
| - state->fData = NULL;
|
| + state->fData = nullptr;
|
| }
|
| };
|
|
|
| @@ -307,7 +307,7 @@ static SkImage* create_image(skiatest::Reporter* reporter,
|
| }
|
| }
|
| SkASSERT(false);
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| static void set_pixels(SkPMColor pixels[], int count, SkPMColor color) {
|
| @@ -425,10 +425,10 @@ static void test_imagepeek(skiatest::Reporter* reporter, GrContextFactory* facto
|
| const SkColor color = SK_ColorRED;
|
| const SkPMColor pmcolor = SkPreMultiplyColor(color);
|
|
|
| - GrContext* ctx = NULL;
|
| + GrContext* ctx = nullptr;
|
| #if SK_SUPPORT_GPU
|
| ctx = factory->get(GrContextFactory::kNative_GLContextType);
|
| - if (NULL == ctx) {
|
| + if (nullptr == ctx) {
|
| return;
|
| }
|
| #endif
|
| @@ -440,16 +440,16 @@ static void test_imagepeek(skiatest::Reporter* reporter, GrContextFactory* facto
|
| SkImageInfo info;
|
| size_t rowBytes;
|
|
|
| - releaseCtx.fData = NULL;
|
| + releaseCtx.fData = nullptr;
|
| SkAutoTUnref<SkImage> image(create_image(reporter, gRec[i].fType, ctx, color, &releaseCtx));
|
| if (!image.get()) {
|
| SkDebugf("failed to createImage[%d] %s\n", i, gRec[i].fName);
|
| continue; // gpu may not be enabled
|
| }
|
| if (kRasterProc_ImageType == gRec[i].fType) {
|
| - REPORTER_ASSERT(reporter, NULL != releaseCtx.fData); // we are tracking the data
|
| + REPORTER_ASSERT(reporter, nullptr != releaseCtx.fData); // we are tracking the data
|
| } else {
|
| - REPORTER_ASSERT(reporter, NULL == releaseCtx.fData); // we ignored the context
|
| + REPORTER_ASSERT(reporter, nullptr == releaseCtx.fData); // we ignored the context
|
| }
|
|
|
| test_legacy_bitmap(reporter, image);
|
| @@ -469,7 +469,7 @@ static void test_imagepeek(skiatest::Reporter* reporter, GrContextFactory* facto
|
|
|
| test_image_readpixels(reporter, image, pmcolor);
|
| }
|
| - REPORTER_ASSERT(reporter, NULL == releaseCtx.fData); // we released the data
|
| + REPORTER_ASSERT(reporter, nullptr == releaseCtx.fData); // we released the data
|
| }
|
|
|
| static void test_canvaspeek(skiatest::Reporter* reporter,
|
| @@ -497,7 +497,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter,
|
| #endif
|
|
|
| for (int i= 0; i < cnt; ++i) {
|
| - GrContext* context = NULL;
|
| + GrContext* context = nullptr;
|
| #if SK_SUPPORT_GPU
|
| GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
|
| if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
|
| @@ -505,7 +505,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter,
|
| }
|
| context = factory->get(glCtxType);
|
|
|
| - if (NULL == context) {
|
| + if (nullptr == context) {
|
| continue;
|
| }
|
| #endif
|
| @@ -534,7 +534,7 @@ static void test_canvaspeek(skiatest::Reporter* reporter,
|
| REPORTER_ASSERT(reporter, info2 == info);
|
| REPORTER_ASSERT(reporter, rb2 == rowBytes);
|
| } else {
|
| - REPORTER_ASSERT(reporter, NULL == addr2);
|
| + REPORTER_ASSERT(reporter, nullptr == addr2);
|
| }
|
| }
|
| }
|
| @@ -565,7 +565,7 @@ static void test_accessPixels(skiatest::Reporter* reporter, GrContextFactory* fa
|
| #endif
|
|
|
| for (int i= 0; i < cnt; ++i) {
|
| - GrContext* context = NULL;
|
| + GrContext* context = nullptr;
|
| #if SK_SUPPORT_GPU
|
| GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
|
| if (!GrContextFactory::IsRenderingGLContext(glCtxType)) {
|
| @@ -573,7 +573,7 @@ static void test_accessPixels(skiatest::Reporter* reporter, GrContextFactory* fa
|
| }
|
| context = factory->get(glCtxType);
|
|
|
| - if (NULL == context) {
|
| + if (nullptr == context) {
|
| continue;
|
| }
|
| #endif
|
| @@ -598,10 +598,10 @@ static void test_accessPixels(skiatest::Reporter* reporter, GrContextFactory* fa
|
| }
|
|
|
| static void test_snap_alphatype(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
| - GrContext* context = NULL;
|
| + GrContext* context = nullptr;
|
| #if SK_SUPPORT_GPU
|
| context = factory->get(GrContextFactory::kNative_GLContextType);
|
| - if (NULL == context) {
|
| + if (nullptr == context) {
|
| return;
|
| }
|
| #endif
|
| @@ -706,12 +706,12 @@ static void TestSurfaceCopyOnWrite(skiatest::Reporter* reporter, SurfaceType sur
|
| EXPECT_COPY_ON_WRITE(drawPath(testPath, testPaint))
|
| EXPECT_COPY_ON_WRITE(drawBitmap(testBitmap, 0, 0))
|
| EXPECT_COPY_ON_WRITE(drawBitmapRect(testBitmap, testRect, nullptr))
|
| - EXPECT_COPY_ON_WRITE(drawBitmapNine(testBitmap, testIRect, testRect, NULL))
|
| - EXPECT_COPY_ON_WRITE(drawSprite(testBitmap, 0, 0, NULL))
|
| + EXPECT_COPY_ON_WRITE(drawBitmapNine(testBitmap, testIRect, testRect, nullptr))
|
| + EXPECT_COPY_ON_WRITE(drawSprite(testBitmap, 0, 0, nullptr))
|
| EXPECT_COPY_ON_WRITE(drawText(testText.c_str(), testText.size(), 0, 1, testPaint))
|
| EXPECT_COPY_ON_WRITE(drawPosText(testText.c_str(), testText.size(), testPoints2, \
|
| testPaint))
|
| - EXPECT_COPY_ON_WRITE(drawTextOnPath(testText.c_str(), testText.size(), testPath, NULL, \
|
| + EXPECT_COPY_ON_WRITE(drawTextOnPath(testText.c_str(), testText.size(), testPath, nullptr, \
|
| testPaint))
|
|
|
| const SkSurface::BackendHandleAccess accessModes[] = {
|
| @@ -796,7 +796,7 @@ static void TestGetTexture(skiatest::Reporter* reporter,
|
| REPORTER_ASSERT(reporter, texture);
|
| REPORTER_ASSERT(reporter, 0 != texture->getTextureHandle());
|
| } else {
|
| - REPORTER_ASSERT(reporter, NULL == texture);
|
| + REPORTER_ASSERT(reporter, nullptr == texture);
|
| }
|
| surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);
|
| REPORTER_ASSERT(reporter, as_IB(image)->getTexture() == texture);
|
| @@ -883,13 +883,13 @@ static void TestSurfaceNoCanvas(skiatest::Reporter* reporter,
|
| DEF_GPUTEST(Surface, reporter, factory) {
|
| test_image(reporter);
|
|
|
| - TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, NULL);
|
| - TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, NULL);
|
| - TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kDiscard_ContentChangeMode);
|
| - TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kRetain_ContentChangeMode);
|
| + TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, nullptr);
|
| + TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, nullptr);
|
| + TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, nullptr, SkSurface::kDiscard_ContentChangeMode);
|
| + TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, nullptr, SkSurface::kRetain_ContentChangeMode);
|
|
|
| test_empty_image(reporter);
|
| - test_empty_surface(reporter, NULL);
|
| + test_empty_surface(reporter, nullptr);
|
|
|
| test_imagepeek(reporter, factory);
|
| test_canvaspeek(reporter, factory);
|
| @@ -899,7 +899,7 @@ DEF_GPUTEST(Surface, reporter, factory) {
|
| test_snap_alphatype(reporter, factory);
|
|
|
| #if SK_SUPPORT_GPU
|
| - TestGetTexture(reporter, kRaster_SurfaceType, NULL);
|
| + TestGetTexture(reporter, kRaster_SurfaceType, nullptr);
|
| if (factory) {
|
| for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
|
| GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
|
| @@ -1005,7 +1005,7 @@ DEF_GPUTEST(SkImage_NewFromTexture, reporter, factory) {
|
| ReleaseTextureContext releaseCtx(reporter);
|
|
|
| SkAutoTUnref<SkImage> refImg(make_desc_image(ctx, w, h, srcTex, &releaseCtx));
|
| - SkAutoTUnref<SkImage> cpyImg(make_desc_image(ctx, w, h, srcTex, NULL));
|
| + SkAutoTUnref<SkImage> cpyImg(make_desc_image(ctx, w, h, srcTex, nullptr));
|
|
|
| test_image_color(reporter, refImg, expected0);
|
| test_image_color(reporter, cpyImg, expected0);
|
| @@ -1025,7 +1025,7 @@ DEF_GPUTEST(SkImage_NewFromTexture, reporter, factory) {
|
|
|
| // Now exercise the release proc
|
| REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased);
|
| - refImg.reset(NULL); // force a release of the image
|
| + refImg.reset(nullptr); // force a release of the image
|
| REPORTER_ASSERT(reporter, releaseCtx.fIsReleased);
|
| }
|
| #endif
|
|
|