Remove unnamed namespace usage from tests.
Skia code prefers static over unnamed namespace. BUG=None TEST=None R=bsalomon@google.com, robertphillips@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/26962002 git-svn-id: http://skia.googlecode.com/svn/trunk@11747 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
b202adec60
commit
ddf94cf108
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "Test.h"
|
||||
#include "SkTDynamicHash.h"
|
||||
|
||||
@ -7,11 +14,11 @@ struct Entry {
|
||||
int key;
|
||||
double value;
|
||||
};
|
||||
|
||||
const int& GetKey(const Entry& entry) { return entry.key; }
|
||||
uint32_t GetHash(const int& key) { return key; }
|
||||
bool AreEqual(const Entry& entry, const int& key) { return entry.key == key; }
|
||||
|
||||
|
||||
class Hash : public SkTDynamicHash<Entry, int, GetKey, GetHash, AreEqual> {
|
||||
public:
|
||||
Hash() : INHERITED() {}
|
||||
|
@ -11,8 +11,6 @@
|
||||
#include "SkScan.h"
|
||||
#include "SkBlitter.h"
|
||||
|
||||
namespace {
|
||||
|
||||
struct FakeBlitter : public SkBlitter {
|
||||
FakeBlitter()
|
||||
: m_blitCount(0)
|
||||
@ -25,8 +23,6 @@ struct FakeBlitter : public SkBlitter {
|
||||
int m_blitCount;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// http://code.google.com/p/skia/issues/detail?id=87
|
||||
// Lines which is not clipped by boundary based clipping,
|
||||
// but skipped after tessellation, should be cleared by the blitter.
|
||||
|
@ -11,8 +11,6 @@
|
||||
#include "SkTFitsIn.h"
|
||||
#include <limits>
|
||||
|
||||
namespace {
|
||||
|
||||
#define TEST(S, s, D, expected) REPORTER_ASSERT(reporter, (SkTFitsIn<D>((S)(s)) == (expected)))
|
||||
|
||||
static void FitsInTest(skiatest::Reporter* reporter) {
|
||||
@ -70,7 +68,5 @@ static void FitsInTest(skiatest::Reporter* reporter) {
|
||||
//TEST(float, 1, uint64_t, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "TestClassDef.h"
|
||||
DEFINE_TESTCLASS("FitsIn", FitsInTestClass, FitsInTest)
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "SkTemplates.h"
|
||||
#include "SkInstCnt.h"
|
||||
|
||||
namespace {
|
||||
// A is the top of an inheritance tree of classes that overload op new and
|
||||
// and delete to use a GrMemoryPool. The objects have values of different types
|
||||
// that can be set and checked.
|
||||
@ -177,7 +176,7 @@ A* A::Create(SkRandom* r) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Rec {
|
||||
A* fInstance;
|
||||
int fValue;
|
||||
|
@ -17,9 +17,7 @@ __SK_FORCE_IMAGE_DECODER_LINKING;
|
||||
|
||||
#define JPEG_TEST_WRITE_TO_FILE_FOR_DEBUGGING 0 // do not do this for
|
||||
// normal unit testing.
|
||||
|
||||
namespace {
|
||||
unsigned char goodJpegImage[] = {
|
||||
static unsigned char goodJpegImage[] = {
|
||||
0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46,
|
||||
0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x8F,
|
||||
0x00, 0x8F, 0x00, 0x00, 0xFF, 0xDB, 0x00, 0x43,
|
||||
@ -407,9 +405,8 @@ namespace {
|
||||
0xCC, 0xC9, 0x70, 0xC4, 0xC8, 0xF1, 0xB9, 0xD4,
|
||||
0xE1, 0x98, 0x0C, 0xCC, 0x97, 0x0C, 0x4C, 0x8F,
|
||||
0x1B, 0x9D, 0x4E, 0x03, 0xFF, 0xD9};
|
||||
const int goodJpegImageWidth = 128;
|
||||
const int goodJpegImageHeight = 128;
|
||||
}; // namespace
|
||||
static const int goodJpegImageWidth = 128;
|
||||
static const int goodJpegImageHeight = 128;
|
||||
|
||||
// https://code.google.com/p/android/issues/detail?id=42382
|
||||
// https://code.google.com/p/android/issues/detail?id=9064
|
||||
|
@ -4,6 +4,7 @@
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "Test.h"
|
||||
#include "SkBitmap.h"
|
||||
#include "SkBitmapDevice.h"
|
||||
@ -17,8 +18,6 @@
|
||||
#include "SkScalar.h"
|
||||
#include "SkXfermode.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class FakeDevice : public SkBitmapDevice {
|
||||
public:
|
||||
FakeDevice() : SkBitmapDevice(SkBitmap::kARGB_8888_Config, 100, 100, false) { }
|
||||
@ -35,8 +34,6 @@ private:
|
||||
typedef SkBitmapDevice INHERITED;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static void test_frontToBack(skiatest::Reporter* reporter) {
|
||||
SkAutoTUnref<SkLayerDrawLooper> looper(SkNEW(SkLayerDrawLooper));
|
||||
SkLayerDrawLooper::LayerInfo layerInfo;
|
||||
|
@ -27,13 +27,10 @@ DEF_TEST(SkOnce_Singlethreaded, r) {
|
||||
REPORTER_ASSERT(r, 5 == x);
|
||||
}
|
||||
|
||||
|
||||
DEF_SK_ONCE(add_six, int* x) {
|
||||
*x += 6;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class Racer : public SkRunnable {
|
||||
public:
|
||||
int* ptr;
|
||||
@ -42,8 +39,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
DEF_TEST(SkOnce_Multithreaded, r) {
|
||||
const int kTasks = 16, kThreads = 4;
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
@ -16,10 +15,7 @@
|
||||
#include "SkGpuDevice.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
void fillCanvas(SkCanvas* canvas, SkCanvas::Config8888 unpremulConfig) {
|
||||
static void fillCanvas(SkCanvas* canvas, SkCanvas::Config8888 unpremulConfig) {
|
||||
SkBitmap bmp;
|
||||
bmp.setConfig(SkBitmap::kARGB_8888_Config, 256, 256);
|
||||
bmp.allocPixels();
|
||||
@ -40,7 +36,7 @@ static const SkCanvas::Config8888 gUnpremulConfigs[] = {
|
||||
SkCanvas::kRGBA_Unpremul_Config8888,
|
||||
};
|
||||
|
||||
void PremulAlphaRoundTripTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
||||
static void PremulAlphaRoundTripTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
||||
SkAutoTUnref<SkBaseDevice> device;
|
||||
for (int dtype = 0; dtype < 2; ++dtype) {
|
||||
|
||||
@ -114,7 +110,6 @@ void PremulAlphaRoundTripTest(skiatest::Reporter* reporter, GrContextFactory* fa
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "TestClassDef.h"
|
||||
DEFINE_GPUTESTCLASS("PremulAlphaRoundTripTest", PremulAlphaRoundTripTestClass, PremulAlphaRoundTripTest)
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
@ -17,14 +16,12 @@
|
||||
#include "GrContextFactory.h"
|
||||
#endif
|
||||
|
||||
|
||||
static const int DEV_W = 100, DEV_H = 100;
|
||||
static const SkIRect DEV_RECT = SkIRect::MakeWH(DEV_W, DEV_H);
|
||||
static const SkRect DEV_RECT_S = SkRect::MakeWH(DEV_W * SK_Scalar1,
|
||||
DEV_H * SK_Scalar1);
|
||||
|
||||
namespace {
|
||||
SkPMColor getCanvasColor(int x, int y) {
|
||||
static SkPMColor getCanvasColor(int x, int y) {
|
||||
SkASSERT(x >= 0 && x < DEV_W);
|
||||
SkASSERT(y >= 0 && y < DEV_H);
|
||||
|
||||
@ -53,7 +50,7 @@ SkPMColor getCanvasColor(int x, int y) {
|
||||
return SkPremultiplyARGBInline(a, r, g, b);
|
||||
}
|
||||
|
||||
SkPMColor getBitmapColor(int x, int y, int w) {
|
||||
static SkPMColor getBitmapColor(int x, int y, int w) {
|
||||
int n = y * w + x;
|
||||
|
||||
U8CPU b = n & 0xff;
|
||||
@ -62,7 +59,7 @@ SkPMColor getBitmapColor(int x, int y, int w) {
|
||||
return SkPackARGB32(0xff, r, g , b);
|
||||
}
|
||||
|
||||
SkPMColor convertConfig8888ToPMColor(SkCanvas::Config8888 config8888,
|
||||
static SkPMColor convertConfig8888ToPMColor(SkCanvas::Config8888 config8888,
|
||||
uint32_t color,
|
||||
bool* premul) {
|
||||
const uint8_t* c = reinterpret_cast<uint8_t*>(&color);
|
||||
@ -106,7 +103,7 @@ SkPMColor convertConfig8888ToPMColor(SkCanvas::Config8888 config8888,
|
||||
return SkPackARGB32(a, r, g, b);
|
||||
}
|
||||
|
||||
void fillCanvas(SkCanvas* canvas) {
|
||||
static void fillCanvas(SkCanvas* canvas) {
|
||||
static SkBitmap bmp;
|
||||
if (bmp.isNull()) {
|
||||
bmp.setConfig(SkBitmap::kARGB_8888_Config, DEV_W, DEV_H);
|
||||
@ -130,7 +127,7 @@ void fillCanvas(SkCanvas* canvas) {
|
||||
canvas->restore();
|
||||
}
|
||||
|
||||
void fillBitmap(SkBitmap* bitmap) {
|
||||
static void fillBitmap(SkBitmap* bitmap) {
|
||||
SkASSERT(bitmap->lockPixelsAreWritable());
|
||||
SkAutoLockPixels alp(*bitmap);
|
||||
int w = bitmap->width();
|
||||
@ -144,7 +141,7 @@ void fillBitmap(SkBitmap* bitmap) {
|
||||
}
|
||||
}
|
||||
|
||||
bool checkPixel(SkPMColor a, SkPMColor b, bool didPremulConversion) {
|
||||
static bool checkPixel(SkPMColor a, SkPMColor b, bool didPremulConversion) {
|
||||
if (!didPremulConversion) {
|
||||
return a == b;
|
||||
}
|
||||
@ -167,7 +164,7 @@ bool checkPixel(SkPMColor a, SkPMColor b, bool didPremulConversion) {
|
||||
// checks the bitmap contains correct pixels after the readPixels
|
||||
// if the bitmap was prefilled with pixels it checks that these weren't
|
||||
// overwritten in the area outside the readPixels.
|
||||
bool checkRead(skiatest::Reporter* reporter,
|
||||
static bool checkRead(skiatest::Reporter* reporter,
|
||||
const SkBitmap& bitmap,
|
||||
int x, int y,
|
||||
bool checkCanvasPixels,
|
||||
@ -226,13 +223,12 @@ enum BitmapInit {
|
||||
kBitmapInitCnt
|
||||
};
|
||||
|
||||
BitmapInit nextBMI(BitmapInit bmi) {
|
||||
static BitmapInit nextBMI(BitmapInit bmi) {
|
||||
int x = bmi;
|
||||
return static_cast<BitmapInit>(++x);
|
||||
}
|
||||
|
||||
|
||||
void init_bitmap(SkBitmap* bitmap, const SkIRect& rect, BitmapInit init) {
|
||||
static void init_bitmap(SkBitmap* bitmap, const SkIRect& rect, BitmapInit init) {
|
||||
int w = rect.width();
|
||||
int h = rect.height();
|
||||
int rowBytes = 0;
|
||||
@ -255,7 +251,7 @@ void init_bitmap(SkBitmap* bitmap, const SkIRect& rect, BitmapInit init) {
|
||||
}
|
||||
}
|
||||
|
||||
void ReadPixelsTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
||||
static void ReadPixelsTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
||||
const SkIRect testRects[] = {
|
||||
// entire thing
|
||||
DEV_RECT,
|
||||
@ -410,7 +406,6 @@ void ReadPixelsTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "TestClassDef.h"
|
||||
DEFINE_GPUTESTCLASS("ReadPixels", ReadPixelsTestClass, ReadPixelsTest)
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
@ -21,7 +20,6 @@ enum Tile {
|
||||
kAll_Tile = kTopLeft_Tile | kTopRight_Tile | kBottomLeft_Tile | kBottomRight_Tile,
|
||||
};
|
||||
|
||||
namespace {
|
||||
class MockCanvas : public SkCanvas {
|
||||
public:
|
||||
MockCanvas(SkBaseDevice* device) : SkCanvas(device)
|
||||
@ -35,7 +33,6 @@ public:
|
||||
|
||||
SkTDArray<SkRect> fRects;
|
||||
};
|
||||
}
|
||||
|
||||
class TileGridTest {
|
||||
public:
|
||||
@ -278,6 +275,5 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#include "TestClassDef.h"
|
||||
DEFINE_TESTCLASS("TileGrid", TileGridTestClass, TileGridTest::Test)
|
||||
|
@ -12,95 +12,91 @@
|
||||
|
||||
using namespace skia_advanced_typeface_metrics_utils;
|
||||
|
||||
namespace {
|
||||
|
||||
// Negative values and zeros in a range plus trailing zeros.
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
||||
const int16_t data1[] = {-1, 0, -3, 4, 5, 6, 7, 0, 0, 0, 8, 0, 0, 0, 0};
|
||||
const char* expected1 = "0[-1 0 -3 4 5 6 7 0 0 0 8]";
|
||||
static const int16_t data1[] = {-1, 0, -3, 4, 5, 6, 7, 0, 0, 0, 8, 0, 0, 0, 0};
|
||||
static const char* expected1 = "0[-1 0 -3 4 5 6 7 0 0 0 8]";
|
||||
|
||||
// Run with leading and trailing zeros.
|
||||
// Test rules: d 0 1 2 3 4 5 6 7 8 9 10 11
|
||||
const int16_t data2[] = {0, 0, 0, 100, 100, 100, 100, 100, 100, 100, 0, 0};
|
||||
const char* expected2 = "3 9 100";
|
||||
static const int16_t data2[] = {0, 0, 0, 100, 100, 100, 100, 100, 100, 100, 0, 0};
|
||||
static const char* expected2 = "3 9 100";
|
||||
|
||||
// Removing 0's from a range.
|
||||
// Test rules: a 0 1 2 3 4 5 6 7 8 9 10 11
|
||||
const int16_t data3[] = {1, 2, 0, 0, 0, 3, 4, 0, 0, 0, 0, 5};
|
||||
const char* expected3 = "0[1 2 0 0 0 3 4] 11[5]";
|
||||
static const int16_t data3[] = {1, 2, 0, 0, 0, 3, 4, 0, 0, 0, 0, 5};
|
||||
static const char* expected3 = "0[1 2 0 0 0 3 4] 11[5]";
|
||||
|
||||
// Removing 0's from a run/range and between runs.
|
||||
// Test rules: a, b 0 1 2 3 4 5 6 7 8 9 10 11 12 14 15
|
||||
const int16_t data4[] = {1, 0, 0, 0, 1, 2, 2, 2, 3, 0, 0, 0, 0, 3, 4};
|
||||
const char* expected4 = "0[1 0 0 0 1] 5 7 2 8[3] 13[3 4]";
|
||||
static const int16_t data4[] = {1, 0, 0, 0, 1, 2, 2, 2, 3, 0, 0, 0, 0, 3, 4};
|
||||
static const char* expected4 = "0[1 0 0 0 1] 5 7 2 8[3] 13[3 4]";
|
||||
|
||||
// Runs that starts outside a range.
|
||||
// Test rules: a, e 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
const int16_t data5[] = {1, 1, 2, 3, 0, 0, 0, 0, 5, 5, 6, 7, 0, 0, 0, 0, 8, 0};
|
||||
const char* expected5 = "0 1 1 2[2 3] 8 9 5 10[6 7] 16[8]";
|
||||
static const int16_t data5[] = {1, 1, 2, 3, 0, 0, 0, 0, 5, 5, 6, 7, 0, 0, 0, 0, 8, 0};
|
||||
static const char* expected5 = "0 1 1 2[2 3] 8 9 5 10[6 7] 16[8]";
|
||||
|
||||
// Zeros and runs that should be broken out.
|
||||
// Test rules: a, b, e 0 1 2 3 4 5 6 7 8 9 10 11 12 13
|
||||
const int16_t data6[] = {1, 0, 0, 0, 0, 1, 2, 3, 3, 4, 5, 5, 5, 6};
|
||||
const char* expected6 = "0[1] 5[1 2 3 3 4] 10 12 5 13[6]";
|
||||
static const int16_t data6[] = {1, 0, 0, 0, 0, 1, 2, 3, 3, 4, 5, 5, 5, 6};
|
||||
static const char* expected6 = "0[1] 5[1 2 3 3 4] 10 12 5 13[6]";
|
||||
|
||||
// Don't cares that aren't enough to break out a run.
|
||||
// Test rules: c 0 1 2 3 4 5
|
||||
const int16_t data7[] = {1, 2, 10, 11, 2, 3};
|
||||
const char* expected7 = "0[1 2 10 11 2 3]";
|
||||
const uint32_t subset7[] = {0, 1, 4, 5};
|
||||
const char* expectedSubset7 = "0[1 2 0 0 2 3]";
|
||||
static const int16_t data7[] = {1, 2, 10, 11, 2, 3};
|
||||
static const char* expected7 = "0[1 2 10 11 2 3]";
|
||||
static const uint32_t subset7[] = {0, 1, 4, 5};
|
||||
static const char* expectedSubset7 = "0[1 2 0 0 2 3]";
|
||||
|
||||
// Don't cares that are enough to break out a run.
|
||||
// Test rules: c 0 1 2 3 4 5 6
|
||||
const int16_t data8[] = {1, 2, 10, 11, 12, 2, 3};
|
||||
const char* expected8 = "0[1 2 10 11 12 2 3]";
|
||||
const uint32_t subset8[] = {0, 1, 5, 6};
|
||||
const char* expectedSubset8 = "0[1] 1 5 2 6[3]";
|
||||
static const int16_t data8[] = {1, 2, 10, 11, 12, 2, 3};
|
||||
static const char* expected8 = "0[1 2 10 11 12 2 3]";
|
||||
static const uint32_t subset8[] = {0, 1, 5, 6};
|
||||
static const char* expectedSubset8 = "0[1] 1 5 2 6[3]";
|
||||
|
||||
// Leading don't cares.
|
||||
// Test rules: d 0 1 2 3 4
|
||||
const int16_t data9[] = {1, 1, 10, 2, 3};
|
||||
const char* expected9 = "0 1 1 2[10 2 3]";
|
||||
const uint32_t subset9[] = {0, 1, 3, 4};
|
||||
const char* expectedSubset9 = "0 1 1 3[2 3]";
|
||||
static const int16_t data9[] = {1, 1, 10, 2, 3};
|
||||
static const char* expected9 = "0 1 1 2[10 2 3]";
|
||||
static const uint32_t subset9[] = {0, 1, 3, 4};
|
||||
static const char* expectedSubset9 = "0 1 1 3[2 3]";
|
||||
|
||||
// Almost run of don't cares inside a range.
|
||||
// Test rules: c 0 1 2 3 4 5
|
||||
const int16_t data10[] = {1, 2, 10, 11, 12, 3};
|
||||
const char* expected10 = "0[1 2 10 11 12 3]";
|
||||
const uint32_t subset10[] = {0, 1, 5};
|
||||
const char* expectedSubset10 = "0[1 2 0 0 0 3]";
|
||||
static const int16_t data10[] = {1, 2, 10, 11, 12, 3};
|
||||
static const char* expected10 = "0[1 2 10 11 12 3]";
|
||||
static const uint32_t subset10[] = {0, 1, 5};
|
||||
static const char* expectedSubset10 = "0[1 2 0 0 0 3]";
|
||||
|
||||
// Run of don't cares inside a range.
|
||||
// Test rules: c 0 1 2 3 4 5 6
|
||||
const int16_t data11[] = {1, 2, 10, 11, 12, 13, 3};
|
||||
const char* expected11 = "0[1 2 10 11 12 13 3]";
|
||||
const uint32_t subset11[] = {0, 1, 6};
|
||||
const char* expectedSubset11 = "0[1 2] 6[3]";
|
||||
static const int16_t data11[] = {1, 2, 10, 11, 12, 13, 3};
|
||||
static const char* expected11 = "0[1 2 10 11 12 13 3]";
|
||||
static const uint32_t subset11[] = {0, 1, 6};
|
||||
static const char* expectedSubset11 = "0[1 2] 6[3]";
|
||||
|
||||
// Almost run within a range with leading don't cares.
|
||||
// Test rules: c 0 1 2 3 4 5 6
|
||||
const int16_t data12[] = {1, 10, 11, 2, 12, 13, 3};
|
||||
const char* expected12 = "0[1 10 11 2 12 13 3]";
|
||||
const uint32_t subset12[] = {0, 3, 6};
|
||||
const char* expectedSubset12 = "0[1 0 0 2 0 0 3]";
|
||||
static const int16_t data12[] = {1, 10, 11, 2, 12, 13, 3};
|
||||
static const char* expected12 = "0[1 10 11 2 12 13 3]";
|
||||
static const uint32_t subset12[] = {0, 3, 6};
|
||||
static const char* expectedSubset12 = "0[1 0 0 2 0 0 3]";
|
||||
|
||||
// Run within a range with leading don't cares.
|
||||
// Test rules: c 0 1 2 3 4 5 6 7
|
||||
const int16_t data13[] = {1, 10, 11, 2, 2, 12, 13, 3};
|
||||
const char* expected13 = "0[1 10 11 2 2 12 13 3]";
|
||||
const uint32_t subset13[] = {0, 3, 4, 7};
|
||||
const char* expectedSubset13 = "0[1] 1 6 2 7[3]";
|
||||
static const int16_t data13[] = {1, 10, 11, 2, 2, 12, 13, 3};
|
||||
static const char* expected13 = "0[1 10 11 2 2 12 13 3]";
|
||||
static const uint32_t subset13[] = {0, 3, 4, 7};
|
||||
static const char* expectedSubset13 = "0[1] 1 6 2 7[3]";
|
||||
|
||||
// Enough don't cares to breakup something.
|
||||
// Test rules: a 0 1 2 3 4 5
|
||||
const int16_t data14[] = {1, 0, 0, 0, 0, 2};
|
||||
const char* expected14 = "0[1] 5[2]";
|
||||
const uint32_t subset14[] = {0, 5};
|
||||
const char* expectedSubset14 = "0[1] 5[2]";
|
||||
|
||||
}
|
||||
static const int16_t data14[] = {1, 0, 0, 0, 0, 2};
|
||||
static const char* expected14 = "0[1] 5[2]";
|
||||
static const uint32_t subset14[] = {0, 5};
|
||||
static const char* expectedSubset14 = "0[1] 5[2]";
|
||||
|
||||
static SkString stringify_advance_data(SkAdvancedTypefaceMetrics::AdvanceMetric<int16_t>* data) {
|
||||
SkString result;
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
@ -26,8 +25,7 @@ static const SkRect DEV_RECT_S = SkRect::MakeWH(DEV_W * SK_Scalar1,
|
||||
DEV_H * SK_Scalar1);
|
||||
static const U8CPU DEV_PAD = 0xee;
|
||||
|
||||
namespace {
|
||||
SkPMColor getCanvasColor(int x, int y) {
|
||||
static SkPMColor getCanvasColor(int x, int y) {
|
||||
SkASSERT(x >= 0 && x < DEV_W);
|
||||
SkASSERT(y >= 0 && y < DEV_H);
|
||||
|
||||
@ -56,7 +54,7 @@ SkPMColor getCanvasColor(int x, int y) {
|
||||
return SkPremultiplyARGBInline(a, r, g, b);
|
||||
}
|
||||
|
||||
bool config8888IsPremul(SkCanvas::Config8888 config8888) {
|
||||
static bool config8888IsPremul(SkCanvas::Config8888 config8888) {
|
||||
switch (config8888) {
|
||||
case SkCanvas::kNative_Premul_Config8888:
|
||||
case SkCanvas::kBGRA_Premul_Config8888:
|
||||
@ -73,7 +71,7 @@ bool config8888IsPremul(SkCanvas::Config8888 config8888) {
|
||||
}
|
||||
|
||||
// assumes any premu/.unpremul has been applied
|
||||
uint32_t packConfig8888(SkCanvas::Config8888 config8888,
|
||||
static uint32_t packConfig8888(SkCanvas::Config8888 config8888,
|
||||
U8CPU a, U8CPU r, U8CPU g, U8CPU b) {
|
||||
uint32_t r32;
|
||||
uint8_t* result = reinterpret_cast<uint8_t*>(&r32);
|
||||
@ -103,7 +101,7 @@ uint32_t packConfig8888(SkCanvas::Config8888 config8888,
|
||||
return r32;
|
||||
}
|
||||
|
||||
uint32_t getBitmapColor(int x, int y, int w, SkCanvas::Config8888 config8888) {
|
||||
static uint32_t getBitmapColor(int x, int y, int w, SkCanvas::Config8888 config8888) {
|
||||
int n = y * w + x;
|
||||
U8CPU b = n & 0xff;
|
||||
U8CPU g = (n >> 8) & 0xff;
|
||||
@ -134,7 +132,7 @@ uint32_t getBitmapColor(int x, int y, int w, SkCanvas::Config8888 config8888) {
|
||||
return packConfig8888(config8888, a, r, g , b);
|
||||
}
|
||||
|
||||
void fillCanvas(SkCanvas* canvas) {
|
||||
static void fillCanvas(SkCanvas* canvas) {
|
||||
static SkBitmap bmp;
|
||||
if (bmp.isNull()) {
|
||||
bmp.setConfig(SkBitmap::kARGB_8888_Config, DEV_W, DEV_H);
|
||||
@ -158,7 +156,7 @@ void fillCanvas(SkCanvas* canvas) {
|
||||
canvas->restore();
|
||||
}
|
||||
|
||||
SkPMColor convertConfig8888ToPMColor(SkCanvas::Config8888 config8888,
|
||||
static SkPMColor convertConfig8888ToPMColor(SkCanvas::Config8888 config8888,
|
||||
uint32_t color,
|
||||
bool* premul) {
|
||||
const uint8_t* c = reinterpret_cast<uint8_t*>(&color);
|
||||
@ -202,7 +200,7 @@ SkPMColor convertConfig8888ToPMColor(SkCanvas::Config8888 config8888,
|
||||
return SkPackARGB32(a, r, g, b);
|
||||
}
|
||||
|
||||
bool checkPixel(SkPMColor a, SkPMColor b, bool didPremulConversion) {
|
||||
static bool checkPixel(SkPMColor a, SkPMColor b, bool didPremulConversion) {
|
||||
if (!didPremulConversion) {
|
||||
return a == b;
|
||||
}
|
||||
@ -222,7 +220,7 @@ bool checkPixel(SkPMColor a, SkPMColor b, bool didPremulConversion) {
|
||||
SkAbs32(aB - bB) <= 1;
|
||||
}
|
||||
|
||||
bool checkWrite(skiatest::Reporter* reporter,
|
||||
static bool checkWrite(skiatest::Reporter* reporter,
|
||||
SkCanvas* canvas,
|
||||
const SkBitmap& bitmap,
|
||||
int writeX, int writeY,
|
||||
@ -305,7 +303,7 @@ static const CanvasConfig gCanvasConfigs[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
SkBaseDevice* createDevice(const CanvasConfig& c, GrContext* grCtx) {
|
||||
static SkBaseDevice* createDevice(const CanvasConfig& c, GrContext* grCtx) {
|
||||
switch (c.fDevType) {
|
||||
case kRaster_DevType: {
|
||||
SkBitmap bmp;
|
||||
@ -340,7 +338,7 @@ SkBaseDevice* createDevice(const CanvasConfig& c, GrContext* grCtx) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool setupBitmap(SkBitmap* bitmap,
|
||||
static bool setupBitmap(SkBitmap* bitmap,
|
||||
SkCanvas::Config8888 config8888,
|
||||
int w, int h,
|
||||
bool tightRowBytes) {
|
||||
@ -360,7 +358,7 @@ bool setupBitmap(SkBitmap* bitmap,
|
||||
return true;
|
||||
}
|
||||
|
||||
void WritePixelsTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
||||
static void WritePixelsTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
||||
SkCanvas canvas;
|
||||
|
||||
const SkIRect testRects[] = {
|
||||
@ -471,7 +469,6 @@ void WritePixelsTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "TestClassDef.h"
|
||||
DEFINE_GPUTESTCLASS("WritePixels", WritePixelsTestClass, WritePixelsTest)
|
||||
|
Loading…
Reference in New Issue
Block a user