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

Unified Diff: tests/CachedDecodingPixelRefTest.cpp

Issue 132403008: Remove unnamed namespace usage from tests/ (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: SK_OVERRIDE Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/DrawBitmapRectTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CachedDecodingPixelRefTest.cpp
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index 8a329d88380ed055f79e53c1e57031c3dcc8e36e..9ac5f8139259f2261e5fb98a5d6be76ada9b6dab 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);
}
-////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « no previous file | tests/DrawBitmapRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698