Example #1
0
void outputProgress(const State4& state, const char* pathStr, SkPath::FillType pathFillType) {
    if (gRunTestsInOneThread && gShowOutputProgress) {
        if (pathFillType == SkPath::kEvenOdd_FillType) {
            SkDebugf("    path.setFillType(SkPath::kEvenOdd_FillType);\n", pathStr);
        }
        SkDebugf("%s\n", pathStr);
    }
    const char testFunction[] = "testSimplifyx(path);";
    const char* pathPrefix = NULL;
    const char* nameSuffix = NULL;
    if (pathFillType == SkPath::kEvenOdd_FillType) {
        pathPrefix = "    path.setFillType(SkPath::kEvenOdd_FillType);\n";
        nameSuffix = "x";
    }
    if (gUsePhysicalFiles) {
        SkFILEWStream outFile(state.filename);
        if (!outFile.isValid()) {
            SkASSERT(0);
            return;
        }
        outputToStream(state, pathStr, pathPrefix, nameSuffix, testFunction, outFile);
        return;
    }
    SkFILEWStream outRam(state.filename);
    outputToStream(state, pathStr, pathPrefix, nameSuffix, testFunction, outRam);
}
Example #2
0
void outputProgress(char* ramStr, const char* pathStr, SkPathOp op) {
    const char testFunction[] = "testOp(path);";
    SkASSERT((size_t) op < SK_ARRAY_COUNT(opSuffixes));
    const char* nameSuffix = opSuffixes[op];
    SkMemoryWStream rRamStream(ramStr, PATH_STR_SIZE);
    outputToStream(pathStr, nullptr, nameSuffix, testFunction, true, rRamStream);
}
Example #3
0
bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state,
                  const char* pathStr) {
    SkPath::FillType fillType = useXor ? SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType;
    path.setFillType(fillType);
    state.fReporter->bumpTestCount();
    if (!Simplify(path, &out)) {
        SkDebugf("%s did not expect failure\n", __FUNCTION__);
        REPORTER_ASSERT(state.fReporter, 0);
        return false;
    }
    if (!state.fReporter->verbose()) {
        return true;
    }
    int result = comparePaths(state.fReporter, nullptr, path, out, *state.fBitmap);
    if (result) {
        SkAutoMutexAcquire autoM(simplifyDebugOut);
        char temp[8192];
        sk_bzero(temp, sizeof(temp));
        SkMemoryWStream stream(temp, sizeof(temp));
        const char* pathPrefix = nullptr;
        const char* nameSuffix = nullptr;
        if (fillType == SkPath::kEvenOdd_FillType) {
            pathPrefix = "    path.setFillType(SkPath::kEvenOdd_FillType);\n";
            nameSuffix = "x";
        }
        const char testFunction[] = "testSimplify(reporter, path);";
        outputToStream(pathStr, pathPrefix, nameSuffix, testFunction, false, stream);
        SkDebugf("%s", temp);
        REPORTER_ASSERT(state.fReporter, 0);
    }
    state.fReporter->bumpTestCount();
    return result == 0;
}
Example #4
0
bool testSimplifyx(SkPath& path, bool useXor, SkPath& out, State4& state,
        const char* pathStr) {
    SkPath::FillType fillType = useXor ? SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType;
    path.setFillType(fillType);
    if (gShowPath) {
        showPath(path);
    }
    simplifyx(path, out);
    if (!gComparePaths) {
        return true;
    }
    int result = comparePaths(path, out, state.bitmap);
    if (result && gPathStrAssert) {
        SkDebugf("addTest %s\n", state.filename);
        char temp[8192];
        bzero(temp, sizeof(temp));
        SkMemoryWStream stream(temp, sizeof(temp));
        const char* pathPrefix = NULL;
        const char* nameSuffix = NULL;
        if (fillType == SkPath::kEvenOdd_FillType) {
            pathPrefix = "    path.setFillType(SkPath::kEvenOdd_FillType);\n";
            nameSuffix = "x";
        }
        const char testFunction[] = "testSimplifyx(path);";
        outputToStream(state, pathStr, pathPrefix, nameSuffix, testFunction, stream);
        SkDebugf(temp);
        SkASSERT(0);
    }
    return result == 0;
}
Example #5
0
static void defaultMessageHandler(module_t module, message_t msgType, const char * message)
{
    if(Logger::config().isRuntimeConfigEnabled(module)) {
        if(!runtimeMessageEnabled(module, msgType))
            return;
    }

    outputToStream(std::cerr, module, msgType, message);
}
Example #6
0
void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType pathFillType) {
    const char testFunction[] = "testSimplify(path);";
    const char* pathPrefix = nullptr;
    const char* nameSuffix = nullptr;
    if (pathFillType == SkPath::kEvenOdd_FillType) {
        pathPrefix = "    path.setFillType(SkPath::kEvenOdd_FillType);\n";
        nameSuffix = "x";
    }
    SkMemoryWStream rRamStream(ramStr, PATH_STR_SIZE);
    outputToStream(pathStr, pathPrefix, nameSuffix, testFunction, false, rRamStream);
}
Example #7
0
void outputProgress(const State4& state, const char* pathStr, ShapeOp op) {
    SkString testFunc("testShapeOp(path, pathB, ");
    testFunc += opStrs[op];
    testFunc += ");";
    const char* testFunction = testFunc.c_str();
    if (gRunTestsInOneThread && gShowOutputProgress) {
        SkDebugf("%s\n", pathStr);
        SkDebugf("    %s\n", testFunction);
    }
    const char* nameSuffix = opSuffixes[op];
    if (gUsePhysicalFiles) {
        SkFILEWStream outFile(state.filename);
        if (!outFile.isValid()) {
            SkASSERT(0);
            return;
        }
        outputToStream(state, pathStr, NULL, nameSuffix, testFunction, outFile);
        return;
    }
    SkFILEWStream outRam(state.filename);
    outputToStream(state, pathStr, NULL, nameSuffix, testFunction, outRam);
}
Example #8
0
void FileLog::messageHandler(module_t module, message_t msgType, const char * message)
{
    // logging all messages os all modules to file
    if(file_) {
        std::string prefix = modulePrefix(module, msgType);
        file_ << prefix <<  message << std::flush;
    }

    // if runtime config enabled
    if(Logger::config().isRuntimeConfigEnabled(module)) {
        // so we can filter messages to std::cerr below
        if(!runtimeMessageEnabled(module, msgType))
            return;
    }

    // duplicate output to std::cerr
    if(Logger::config().isSplitEnabled(module))
        outputToStream(std::cerr, module, msgType, message);
}