static void writeTestName(const char* nameSuffix, SkMemoryWStream& outFile) {
    outFile.writeText(testName);
    outFile.writeDecAsText(testNumber);
    if (nameSuffix) {
        outFile.writeText(nameSuffix);
    }
}
예제 #2
0
/******************************************************************************
*   convert rgb565 to jpeg file 
*******************************************************************************/
bool rgb565toJpeg(uint8_t *pbufIn, uint8_t *pbufOut, uint32_t width, uint32_t height, uint32_t *psize)
{
    uint32_t size = 0;

    // It's sw encode, the buffer address must be virtual address
    CAM_LOGD("[rgb565toJpeg] pbufIn: 0x%x, pbufOut: 0x%x, width: %d, height: %d \n", (uint32_t) pbufIn, (uint32_t) pbufOut, width, height);

    SkImageEncoder::Type fm =  SkImageEncoder::kJPEG_Type;
    bool success = false;
    SkImageEncoder *pencoder = SkImageEncoder::Create(fm);
    if (NULL != pencoder) {
        SkMemoryWStream *pskMemStream = new SkMemoryWStream(pbufOut, width * height * 2);
        if (NULL != pskMemStream) {
            SkBitmap *pbitmap = new SkBitmap;
            if (NULL != pbitmap) {
                pbitmap->setConfig(SkBitmap::kRGB_565_Config, width, height);
                pbitmap->setPixels(pbufIn);
                success = pencoder->encodeStream(pskMemStream, *pbitmap, 85);
                if (success) {
                    size = pskMemStream->getBytesWritten();
                }
            }
            delete pbitmap;
        }
        delete pskMemStream;
        delete pencoder;
    }

    *psize = size;
    CAM_LOGD(" size: %d \n", size);
    return success;
}
예제 #3
0
static void outputToStream(const char* pathStr, const char* pathPrefix, const char* nameSuffix,
        const char* testFunction, bool twoPaths, SkMemoryWStream& outFile) {
#if 0
    outFile.writeText("\n<div id=\"");
    writeTestName(nameSuffix, outFile);
    outFile.writeText("\">\n");
    if (pathPrefix) {
        outFile.writeText(pathPrefix);
    }
    outFile.writeText(pathStr);
    outFile.writeText("</div>\n\n");

    outFile.writeText(marker);
    outFile.writeText("    ");
    writeTestName(nameSuffix, outFile);
    outFile.writeText(",\n\n\n");
#endif
    outFile.writeText("static void ");
    writeTestName(nameSuffix, outFile);
    outFile.writeText("(skiatest::Reporter* reporter) {\n    SkPath path");
    if (twoPaths) {
        outFile.writeText(", pathB");
    }
    outFile.writeText(";\n");
    if (pathPrefix) {
        outFile.writeText(pathPrefix);
    }
    outFile.writeText(pathStr);
    outFile.writeText("    ");
    outFile.writeText(testFunction);
    outFile.writeText("\n}\n\n");
#if 0
    outFile.writeText("static void (*firstTest)() = ");
    writeTestName(nameSuffix, outFile);
    outFile.writeText(";\n\n");

    outFile.writeText("static struct {\n");
    outFile.writeText("    void (*fun)();\n");
    outFile.writeText("    const char* str;\n");
    outFile.writeText("} tests[] = {\n");
    outFile.writeText("    TEST(");
    writeTestName(nameSuffix, outFile);
    outFile.writeText("),\n");
#endif
    outFile.flush();
}