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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 public: | 79 public: |
80 EmptyGenerator() : SkImageGenerator(SkImageInfo::MakeN32Premul(0, 0)) {} | 80 EmptyGenerator() : SkImageGenerator(SkImageInfo::MakeN32Premul(0, 0)) {} |
81 }; | 81 }; |
82 | 82 |
83 static void test_empty_image(skiatest::Reporter* reporter) { | 83 static void test_empty_image(skiatest::Reporter* reporter) { |
84 const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_S
kAlphaType); | 84 const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_S
kAlphaType); |
85 | 85 |
86 REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterCopy(info, NULL, 0)); | 86 REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterCopy(info, NULL, 0)); |
87 REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterData(info, NULL, 0)); | 87 REPORTER_ASSERT(reporter, NULL == SkImage::NewRasterData(info, NULL, 0)); |
88 REPORTER_ASSERT(reporter, NULL == SkImage::NewFromRaster(info, NULL, 0, NULL
, NULL)); | 88 REPORTER_ASSERT(reporter, NULL == SkImage::NewFromRaster(info, NULL, 0, NULL
, NULL)); |
89 REPORTER_ASSERT(reporter, NULL == SkImage::NewFromGenerator(SkNEW(EmptyGener
ator))); | 89 REPORTER_ASSERT(reporter, NULL == SkImage::NewFromGenerator(new EmptyGenerat
or)); |
90 } | 90 } |
91 | 91 |
92 static void test_empty_surface(skiatest::Reporter* reporter, GrContext* ctx) { | 92 static void test_empty_surface(skiatest::Reporter* reporter, GrContext* ctx) { |
93 const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_S
kAlphaType); | 93 const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_S
kAlphaType); |
94 | 94 |
95 REPORTER_ASSERT(reporter, NULL == SkSurface::NewRaster(info)); | 95 REPORTER_ASSERT(reporter, NULL == SkSurface::NewRaster(info)); |
96 REPORTER_ASSERT(reporter, NULL == SkSurface::NewRasterDirect(info, NULL, 0))
; | 96 REPORTER_ASSERT(reporter, NULL == SkSurface::NewRasterDirect(info, NULL, 0))
; |
97 if (ctx) { | 97 if (ctx) { |
98 REPORTER_ASSERT(reporter, NULL == | 98 REPORTER_ASSERT(reporter, NULL == |
99 SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted,
info, 0, NULL)); | 99 SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgeted,
info, 0, NULL)); |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 test_image_color(reporter, refImg, expected1); | 1022 test_image_color(reporter, refImg, expected1); |
1023 #endif | 1023 #endif |
1024 test_image_color(reporter, cpyImg, expected0); | 1024 test_image_color(reporter, cpyImg, expected0); |
1025 | 1025 |
1026 // Now exercise the release proc | 1026 // Now exercise the release proc |
1027 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); | 1027 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); |
1028 refImg.reset(NULL); // force a release of the image | 1028 refImg.reset(NULL); // force a release of the image |
1029 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); | 1029 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); |
1030 } | 1030 } |
1031 #endif | 1031 #endif |
OLD | NEW |