aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/CachedDecodingPixelRefTest.cpp
diff options
context:
space:
mode:
authorGravatar tfarina@chromium.org <tfarina@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-21 23:39:22 +0000
committerGravatar tfarina@chromium.org <tfarina@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-21 23:39:22 +0000
commit58674817a7a5003556a1d0b5b8fa522782a729fa (patch)
tree939ba9acc70963fcd1db2065d37137cbde0b7b49 /tests/CachedDecodingPixelRefTest.cpp
parent34f47f9e7c0dec305a73e044cdf893315c489ff7 (diff)
Remove unnamed namespace usage from tests/
Skia preference is to use 'static' keyword rather than use unnamed namespace. BUG=None TEST=tests R=robertphillips@google.com, bsalomon@google.com Review URL: https://codereview.chromium.org/132403008 git-svn-id: http://skia.googlecode.com/svn/trunk@13138 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/CachedDecodingPixelRefTest.cpp')
-rw-r--r--tests/CachedDecodingPixelRefTest.cpp72
1 files changed, 34 insertions, 38 deletions
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index 8a329d8838..9ac5f81392 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -166,8 +166,6 @@ DEF_TEST(DecodingImageGenerator, reporter) {
test_three_encodings(reporter, install_skDiscardablePixelRef);
}
-////////////////////////////////////////////////////////////////////////////////
-namespace {
class TestImageGenerator : public SkImageGenerator {
public:
enum TestType {
@@ -183,8 +181,8 @@ public:
: fType(type), fReporter(reporter) {
SkASSERT((fType <= kLast_TestType) && (fType >= 0));
}
- ~TestImageGenerator() { }
- bool getInfo(SkImageInfo* info) SK_OVERRIDE {
+ virtual ~TestImageGenerator() { }
+ virtual bool getInfo(SkImageInfo* info) SK_OVERRIDE {
REPORTER_ASSERT(fReporter, NULL != info);
if ((NULL == info) || (kFailGetInfo_TestType == fType)) {
return false;
@@ -195,9 +193,9 @@ public:
info->fAlphaType = kOpaque_SkAlphaType;
return true;
}
- bool getPixels(const SkImageInfo& info,
- void* pixels,
- size_t rowBytes) SK_OVERRIDE {
+ virtual bool getPixels(const SkImageInfo& info,
+ void* pixels,
+ size_t rowBytes) SK_OVERRIDE {
REPORTER_ASSERT(fReporter, pixels != NULL);
size_t minRowBytes
= static_cast<size_t>(info.fWidth * info.bytesPerPixel());
@@ -221,8 +219,8 @@ private:
skiatest::Reporter* const fReporter;
};
-void CheckTestImageGeneratorBitmap(skiatest::Reporter* reporter,
- const SkBitmap& bm) {
+static void check_test_image_generator_bitmap(skiatest::Reporter* reporter,
+ const SkBitmap& bm) {
REPORTER_ASSERT(reporter, TestImageGenerator::Width() == bm.width());
REPORTER_ASSERT(reporter, TestImageGenerator::Height() == bm.height());
SkAutoLockPixels autoLockPixels(bm);
@@ -246,10 +244,11 @@ enum PixelRefType {
kSkDiscardable_PixelRefType,
kLast_PixelRefType = kSkDiscardable_PixelRefType
};
-void CheckPixelRef(TestImageGenerator::TestType type,
- skiatest::Reporter* reporter,
- PixelRefType pixelRefType,
- SkDiscardableMemory::Factory* factory) {
+
+static void check_pixelref(TestImageGenerator::TestType type,
+ skiatest::Reporter* reporter,
+ PixelRefType pixelRefType,
+ SkDiscardableMemory::Factory* factory) {
SkASSERT((pixelRefType >= 0) && (pixelRefType <= kLast_PixelRefType));
SkAutoTDelete<SkImageGenerator> gen(SkNEW_ARGS(TestImageGenerator,
(type, reporter)));
@@ -265,20 +264,18 @@ void CheckPixelRef(TestImageGenerator::TestType type,
REPORTER_ASSERT(reporter, success
== (TestImageGenerator::kFailGetInfo_TestType != type));
if (TestImageGenerator::kSucceedGetPixels_TestType == type) {
- CheckTestImageGeneratorBitmap(reporter, lazy);
+ check_test_image_generator_bitmap(reporter, lazy);
} else if (TestImageGenerator::kFailGetPixels_TestType == type) {
SkAutoLockPixels autoLockPixels(lazy);
REPORTER_ASSERT(reporter, NULL == lazy.getPixels());
}
}
-} // namespace
// new/lock/delete is an odd pattern for a pixelref, but it needs to not assert
static void test_newlockdelete(skiatest::Reporter* reporter) {
SkBitmap bm;
SkImageGenerator* ig = new TestImageGenerator(
- TestImageGenerator::kSucceedGetPixels_TestType,
- reporter);
+ TestImageGenerator::kSucceedGetPixels_TestType, reporter);
SkInstallDiscardablePixelRef(ig, &bm, NULL);
bm.pixelRef()->lockPixels();
}
@@ -291,37 +288,36 @@ static void test_newlockdelete(skiatest::Reporter* reporter) {
DEF_TEST(DiscardableAndCachingPixelRef, reporter) {
test_newlockdelete(reporter);
- CheckPixelRef(TestImageGenerator::kFailGetInfo_TestType,
- reporter, kSkCaching_PixelRefType, NULL);
- CheckPixelRef(TestImageGenerator::kFailGetPixels_TestType,
- reporter, kSkCaching_PixelRefType, NULL);
- CheckPixelRef(TestImageGenerator::kSucceedGetPixels_TestType,
- reporter, kSkCaching_PixelRefType, NULL);
+ check_pixelref(TestImageGenerator::kFailGetInfo_TestType,
+ reporter, kSkCaching_PixelRefType, NULL);
+ check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
+ reporter, kSkCaching_PixelRefType, NULL);
+ check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType,
+ reporter, kSkCaching_PixelRefType, NULL);
- CheckPixelRef(TestImageGenerator::kFailGetInfo_TestType,
- reporter, kSkDiscardable_PixelRefType, NULL);
- CheckPixelRef(TestImageGenerator::kFailGetPixels_TestType,
- reporter, kSkDiscardable_PixelRefType, NULL);
- CheckPixelRef(TestImageGenerator::kSucceedGetPixels_TestType,
- reporter, kSkDiscardable_PixelRefType, NULL);
+ check_pixelref(TestImageGenerator::kFailGetInfo_TestType,
+ reporter, kSkDiscardable_PixelRefType, NULL);
+ check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
+ reporter, kSkDiscardable_PixelRefType, NULL);
+ check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType,
+ reporter, kSkDiscardable_PixelRefType, NULL);
SkAutoTUnref<SkDiscardableMemoryPool> pool(
SkNEW_ARGS(SkDiscardableMemoryPool, (1, NULL)));
REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
- CheckPixelRef(TestImageGenerator::kFailGetPixels_TestType,
- reporter, kSkDiscardable_PixelRefType, pool);
+ check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
+ reporter, kSkDiscardable_PixelRefType, pool);
REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
- CheckPixelRef(TestImageGenerator::kSucceedGetPixels_TestType,
- reporter, kSkDiscardable_PixelRefType, pool);
+ check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType,
+ reporter, kSkDiscardable_PixelRefType, pool);
REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
SkDiscardableMemoryPool* globalPool = SkGetGlobalDiscardableMemoryPool();
// Only acts differently from NULL on a platform that has a
// default discardable memory implementation that differs from the
// global DM pool.
- CheckPixelRef(TestImageGenerator::kFailGetPixels_TestType,
- reporter, kSkDiscardable_PixelRefType, globalPool);
- CheckPixelRef(TestImageGenerator::kSucceedGetPixels_TestType,
- reporter, kSkDiscardable_PixelRefType, globalPool);
+ check_pixelref(TestImageGenerator::kFailGetPixels_TestType,
+ reporter, kSkDiscardable_PixelRefType, globalPool);
+ check_pixelref(TestImageGenerator::kSucceedGetPixels_TestType,
+ reporter, kSkDiscardable_PixelRefType, globalPool);
}
-////////////////////////////////////////////////////////////////////////////////