Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@9856 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
d3976a1bc0
commit
0d55dd7d2c
@ -16,14 +16,14 @@
|
|||||||
#define STRIDE 2
|
#define STRIDE 2
|
||||||
|
|
||||||
//this function is redefined for sample, test, and bench. is there anywhere
|
//this function is redefined for sample, test, and bench. is there anywhere
|
||||||
// I can put it to avoid code duplcation?
|
// I can put it to avoid code duplcation?
|
||||||
static void fillRandomBits( int chars, char* bits ){
|
static void fillRandomBits( int chars, char* bits ){
|
||||||
SkMWCRandom rand(SkTime::GetMSecs());
|
SkMWCRandom rand(SkTime::GetMSecs());
|
||||||
|
|
||||||
for (int i = 0; i < chars; ++i){
|
for (int i = 0; i < chars; ++i){
|
||||||
bits[i] = rand.nextU();
|
bits[i] = rand.nextU();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void path_proc(char* bits, SkPath* path) {
|
static void path_proc(char* bits, SkPath* path) {
|
||||||
SkPathUtils::BitsToPath_Path(path, bits, H, W, STRIDE);
|
SkPathUtils::BitsToPath_Path(path, bits, H, W, STRIDE);
|
||||||
@ -41,14 +41,14 @@ class PathUtilsBench : public SkBenchmark {
|
|||||||
int fH, fW, fStride;
|
int fH, fW, fStride;
|
||||||
SkString fName;
|
SkString fName;
|
||||||
char* bits[H * STRIDE];
|
char* bits[H * STRIDE];
|
||||||
|
|
||||||
enum { N = SkBENCHLOOP(20) };
|
enum { N = SkBENCHLOOP(20) };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PathUtilsBench(void* param, Proc proc, const char name[]) : INHERITED(param) {
|
PathUtilsBench(void* param, Proc proc, const char name[]) : INHERITED(param) {
|
||||||
fProc = proc;
|
fProc = proc;
|
||||||
fName.printf("pathUtils_%s", name);
|
fName.printf("pathUtils_%s", name);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ protected:
|
|||||||
for (int i = 0; i < N; ++i){
|
for (int i = 0; i < N; ++i){
|
||||||
//create a random 16x16 bitmap
|
//create a random 16x16 bitmap
|
||||||
fillRandomBits(H * STRIDE, (char*) &bits);
|
fillRandomBits(H * STRIDE, (char*) &bits);
|
||||||
|
|
||||||
//use passed function pointer to handle it
|
//use passed function pointer to handle it
|
||||||
SkPath path;
|
SkPath path;
|
||||||
fProc( (char*) &bits, &path);
|
fProc( (char*) &bits, &path);
|
||||||
@ -71,8 +71,8 @@ private:
|
|||||||
typedef SkBenchmark INHERITED;
|
typedef SkBenchmark INHERITED;
|
||||||
};
|
};
|
||||||
|
|
||||||
static SkBenchmark* PU_path(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, path_proc, "path")); }
|
static SkBenchmark* PU_path(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, path_proc, "path")); }
|
||||||
static SkBenchmark* PU_region(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, region_proc, "region")); }
|
static SkBenchmark* PU_region(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, region_proc, "region")); }
|
||||||
|
|
||||||
static BenchRegistry PU_Path(PU_path);
|
static BenchRegistry PU_Path(PU_path);
|
||||||
static BenchRegistry PU_Region(PU_region);
|
static BenchRegistry PU_Region(PU_region);
|
||||||
|
@ -713,7 +713,7 @@ void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) {
|
|||||||
fActionSettings.setShortcut(QKeySequence(tr("Ctrl+G")));
|
fActionSettings.setShortcut(QKeySequence(tr("Ctrl+G")));
|
||||||
fActionSettings.setIcon(settings);
|
fActionSettings.setIcon(settings);
|
||||||
fActionSettings.setText("Settings");
|
fActionSettings.setText("Settings");
|
||||||
|
|
||||||
QIcon play;
|
QIcon play;
|
||||||
play.addFile(QString::fromUtf8(":/play.png"), QSize(),
|
play.addFile(QString::fromUtf8(":/play.png"), QSize(),
|
||||||
QIcon::Normal, QIcon::Off);
|
QIcon::Normal, QIcon::Off);
|
||||||
|
@ -11,13 +11,13 @@
|
|||||||
#include "SkView.h"
|
#include "SkView.h"
|
||||||
//#include "SkPathOps.h" // loads fine here, won't in PathUtils src files
|
//#include "SkPathOps.h" // loads fine here, won't in PathUtils src files
|
||||||
#include "SkRandom.h"
|
#include "SkRandom.h"
|
||||||
//#include "SkTime.h"
|
//#include "SkTime.h"
|
||||||
|
|
||||||
class samplePathUtils : public SampleView {
|
class samplePathUtils : public SampleView {
|
||||||
public:
|
public:
|
||||||
samplePathUtils() {
|
samplePathUtils() {
|
||||||
bmp_paint.setAntiAlias(true); // Black paint for bitmap
|
bmp_paint.setAntiAlias(true); // Black paint for bitmap
|
||||||
bmp_paint.setStyle(SkPaint::kFill_Style);
|
bmp_paint.setStyle(SkPaint::kFill_Style);
|
||||||
bmp_paint.setColor(SK_ColorBLACK);
|
bmp_paint.setColor(SK_ColorBLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ protected:
|
|||||||
static const int numChars = h * stride; // number of chars in entire array
|
static const int numChars = h * stride; // number of chars in entire array
|
||||||
|
|
||||||
SkPaint bmp_paint;
|
SkPaint bmp_paint;
|
||||||
|
|
||||||
// overrides from SkEventSink
|
// overrides from SkEventSink
|
||||||
virtual bool onQuery(SkEvent* evt) {
|
virtual bool onQuery(SkEvent* evt) {
|
||||||
if (SampleCode::TitleQ(*evt)) {
|
if (SampleCode::TitleQ(*evt)) {
|
||||||
@ -38,13 +38,13 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
virtual void onDrawContent(SkCanvas* canvas) {
|
virtual void onDrawContent(SkCanvas* canvas) {
|
||||||
// bitmap definitions
|
// bitmap definitions
|
||||||
const uint8_t bits[numModes][numChars] = {
|
const uint8_t bits[numModes][numChars] = {
|
||||||
{ 0x18, 0x00, 0x3c, 0x00, 0x7e, 0x00, 0xdb, 0x00,
|
{ 0x18, 0x00, 0x3c, 0x00, 0x7e, 0x00, 0xdb, 0x00,
|
||||||
0xff, 0x00, 0x24, 0x00, 0x5a, 0x00, 0xa5, 0x00 },
|
0xff, 0x00, 0x24, 0x00, 0x5a, 0x00, 0xa5, 0x00 },
|
||||||
|
|
||||||
{ 0x20, 0x80, 0x91, 0x20, 0xbf, 0xa0, 0xee, 0xe0,
|
{ 0x20, 0x80, 0x91, 0x20, 0xbf, 0xa0, 0xee, 0xe0,
|
||||||
0xff, 0xe0, 0x7f, 0xc0, 0x20, 0x80, 0x40, 0x40 },
|
0xff, 0xe0, 0x7f, 0xc0, 0x20, 0x80, 0x40, 0x40 },
|
||||||
|
|
||||||
@ -57,17 +57,17 @@ protected:
|
|||||||
for (int i = 0; i < numModes; ++i) {
|
for (int i = 0; i < numModes; ++i) {
|
||||||
SkPath path; // generate and simplify each path
|
SkPath path; // generate and simplify each path
|
||||||
SkPathUtils::BitsToPath_Path(&path, (char*) &bits[i], h, w, stride);
|
SkPathUtils::BitsToPath_Path(&path, (char*) &bits[i], h, w, stride);
|
||||||
|
|
||||||
canvas->save(); // DRAWING
|
canvas->save(); // DRAWING
|
||||||
canvas->scale(kScale, kScale); // scales up each bitmap
|
canvas->scale(kScale, kScale); // scales up each bitmap
|
||||||
canvas->translate(0, 1.5f * h * i);
|
canvas->translate(0, 1.5f * h * i);
|
||||||
canvas->drawPath(path, bmp_paint); // draw bitmap
|
canvas->drawPath(path, bmp_paint); // draw bitmap
|
||||||
canvas->restore();
|
canvas->restore();
|
||||||
|
|
||||||
// use the SkRegion method
|
// use the SkRegion method
|
||||||
SkPath pathR;
|
SkPath pathR;
|
||||||
SkPathUtils::BitsToPath_Region(&pathR, (char*) &bits[i], h, w, stride);
|
SkPathUtils::BitsToPath_Region(&pathR, (char*) &bits[i], h, w, stride);
|
||||||
|
|
||||||
canvas->save();
|
canvas->save();
|
||||||
|
|
||||||
canvas->scale(kScale, kScale); // scales up each bitmap
|
canvas->scale(kScale, kScale); // scales up each bitmap
|
||||||
@ -76,7 +76,7 @@ protected:
|
|||||||
canvas->restore();
|
canvas->restore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef SkView INHERITED;
|
typedef SkView INHERITED;
|
||||||
};
|
};
|
||||||
|
@ -473,10 +473,10 @@ void GrAARectRenderer::geometryFillAARect(GrGpu* gpu,
|
|||||||
innerColor = GrColorPackRGBA(scale, scale, scale, scale);
|
innerColor = GrColorPackRGBA(scale, scale, scale, scale);
|
||||||
} else {
|
} else {
|
||||||
if (0xff == scale) {
|
if (0xff == scale) {
|
||||||
innerColor = target->getDrawState().getColor();
|
innerColor = target->getDrawState().getColor();
|
||||||
} else {
|
} else {
|
||||||
innerColor = SkAlphaMulQ(target->getDrawState().getColor(), scale);
|
innerColor = SkAlphaMulQ(target->getDrawState().getColor(), scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
verts += 4 * vsize;
|
verts += 4 * vsize;
|
||||||
@ -768,8 +768,8 @@ void GrAARectRenderer::geometryStrokeAARect(GrGpu* gpu,
|
|||||||
innerColor = GrColorPackRGBA(scale, scale, scale, scale);
|
innerColor = GrColorPackRGBA(scale, scale, scale, scale);
|
||||||
} else {
|
} else {
|
||||||
if (0xff == scale) {
|
if (0xff == scale) {
|
||||||
innerColor = target->getDrawState().getColor();
|
innerColor = target->getDrawState().getColor();
|
||||||
} else {
|
} else {
|
||||||
innerColor = SkAlphaMulQ(target->getDrawState().getColor(), scale);
|
innerColor = SkAlphaMulQ(target->getDrawState().getColor(), scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ static void FillRandomBits( int chars, char* bits ){
|
|||||||
bits[i] = rand.nextU();
|
bits[i] = rand.nextU();
|
||||||
}
|
}
|
||||||
}OA
|
}OA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int GetBit( const char* buffer, int x ) {
|
static int GetBit( const char* buffer, int x ) {
|
||||||
int byte = x >> 3;
|
int byte = x >> 3;
|
||||||
@ -117,11 +117,11 @@ void SkPathUtils::BitsToPath_Region(SkPath* path,
|
|||||||
bool inRun = 0;
|
bool inRun = 0;
|
||||||
int start = 1;
|
int start = 1;
|
||||||
const char* line = &bitmap[y * stride];
|
const char* line = &bitmap[y * stride];
|
||||||
|
|
||||||
// loop for each pixel
|
// loop for each pixel
|
||||||
for (int i = 0; i < w; ++i) {
|
for (int i = 0; i < w; ++i) {
|
||||||
int curPixel = GetBit(line,i);
|
int curPixel = GetBit(line,i);
|
||||||
|
|
||||||
if ( (curPixel!=0) != inRun ) { // if transition
|
if ( (curPixel!=0) != inRun ) { // if transition
|
||||||
if (curPixel) { // if transition on
|
if (curPixel) { // if transition on
|
||||||
inRun = 1;
|
inRun = 1;
|
||||||
@ -140,7 +140,7 @@ void SkPathUtils::BitsToPath_Region(SkPath* path,
|
|||||||
// add the thing here
|
// add the thing here
|
||||||
region.op(SkIRect::MakeXYWH(start, y, w-1-start+end, 1),
|
region.op(SkIRect::MakeXYWH(start, y, w-1-start+end, 1),
|
||||||
SkRegion::kUnion_Op );
|
SkRegion::kUnion_Op );
|
||||||
|
|
||||||
} else if ( GetBit(line,w-1) ) { // if last pixel on add rect
|
} else if ( GetBit(line,w-1) ) { // if last pixel on add rect
|
||||||
// add the thing here
|
// add the thing here
|
||||||
region.op(SkIRect::MakeXYWH(w-1, y, 1, 1),
|
region.op(SkIRect::MakeXYWH(w-1, y, 1, 1),
|
||||||
|
@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
#define NUM_IT 1000
|
#define NUM_IT 1000
|
||||||
#define ON 0xFF000000 // black pixel
|
#define ON 0xFF000000 // black pixel
|
||||||
#define OFF 0x00000000 // transparent pixel
|
#define OFF 0x00000000 // transparent pixel
|
||||||
|
|
||||||
class SkBitmap;
|
class SkBitmap;
|
||||||
|
|
||||||
//this function is redefined for sample, test, and bench. is there anywhere
|
//this function is redefined for sample, test, and bench. is there anywhere
|
||||||
// I can put it to avoid code duplcation?
|
// I can put it to avoid code duplcation?
|
||||||
static void fillRandomBits( int chars, char* bits ){
|
static void fillRandomBits( int chars, char* bits ){
|
||||||
SkMWCRandom rand(SkTime::GetMSecs());
|
SkMWCRandom rand(SkTime::GetMSecs());
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ static void test_path_eq(skiatest::Reporter* reporter, const SkPath* path,
|
|||||||
bmpPaint.setAntiAlias(true); // Black paint for bitmap
|
bmpPaint.setAntiAlias(true); // Black paint for bitmap
|
||||||
bmpPaint.setStyle(SkPaint::kFill_Style);
|
bmpPaint.setStyle(SkPaint::kFill_Style);
|
||||||
bmpPaint.setColor(SK_ColorBLACK);
|
bmpPaint.setColor(SK_ColorBLACK);
|
||||||
|
|
||||||
// make bmp
|
// make bmp
|
||||||
SkBitmap bmp;
|
SkBitmap bmp;
|
||||||
bmp.setConfig(SkBitmap::kARGB_8888_Config, w, h);
|
bmp.setConfig(SkBitmap::kARGB_8888_Config, w, h);
|
||||||
@ -93,7 +93,7 @@ static void test_path(skiatest::Reporter* reporter, const SkBitmap* truth,
|
|||||||
// make path
|
// make path
|
||||||
SkPath path;
|
SkPath path;
|
||||||
SkPathUtils::BitsToPath_Path(&path, bin_bmp, h, w, stride);
|
SkPathUtils::BitsToPath_Path(&path, bin_bmp, h, w, stride);
|
||||||
|
|
||||||
//test for correctness
|
//test for correctness
|
||||||
test_path_eq(reporter, &path, truth, h, w);
|
test_path_eq(reporter, &path, truth, h, w);
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ static void test_region(skiatest::Reporter* reporter, const SkBitmap* truth,
|
|||||||
//generate bitmap
|
//generate bitmap
|
||||||
SkPath path;
|
SkPath path;
|
||||||
SkPathUtils::BitsToPath_Region(&path, bin_bmp, h, w, stride);
|
SkPathUtils::BitsToPath_Region(&path, bin_bmp, h, w, stride);
|
||||||
|
|
||||||
//test for correctness
|
//test for correctness
|
||||||
test_path_eq(reporter, &path, truth, h, w);
|
test_path_eq(reporter, &path, truth, h, w);
|
||||||
}
|
}
|
||||||
@ -121,8 +121,8 @@ static void TestPathUtils(skiatest::Reporter* reporter) {
|
|||||||
for (int it = 0; it < NUM_IT; ++it)
|
for (int it = 0; it < NUM_IT; ++it)
|
||||||
{
|
{
|
||||||
// generate a random binary bitmap
|
// generate a random binary bitmap
|
||||||
fillRandomBits( h * stride, bin_bmp); // generate random bitmap
|
fillRandomBits( h * stride, bin_bmp); // generate random bitmap
|
||||||
|
|
||||||
// for each bitmap width, use subset of binary bitmap
|
// for each bitmap width, use subset of binary bitmap
|
||||||
for (int i = 0; i < W_tests; ++i) {
|
for (int i = 0; i < W_tests; ++i) {
|
||||||
// generate truth bitmap
|
// generate truth bitmap
|
||||||
|
Loading…
Reference in New Issue
Block a user