예제 #1
0
void CpuGMTask::draw() {
    SkBitmap bitmap;
    AllocatePixels(fColorType, fGM->getISize().width(), fGM->getISize().height(), &bitmap);

    SkCanvas canvas(bitmap);
    canvas.concat(fGM->getInitialTransform());
    fGM->draw(&canvas);
    canvas.flush();

#define SPAWN(ChildTask, ...) this->spawnChild(SkNEW_ARGS(ChildTask, (*this, __VA_ARGS__)))
    SPAWN(ExpectationsTask, fExpectations, bitmap);

    SPAWN(PipeTask, fGMFactory(NULL), bitmap, PipeTask::kInProcess_Mode);
    SPAWN(PipeTask, fGMFactory(NULL), bitmap, PipeTask::kCrossProcess_Mode);
    SPAWN(PipeTask, fGMFactory(NULL), bitmap, PipeTask::kSharedAddress_Mode);
    SPAWN(QuiltTask, fGMFactory(NULL), bitmap);
    SPAWN(RecordTask, fGMFactory(NULL), bitmap, RecordTask::kOptimize_Mode);
    SPAWN(RecordTask, fGMFactory(NULL), bitmap, RecordTask::kNoOptimize_Mode);
    SPAWN(ReplayTask, fGMFactory(NULL), bitmap, ReplayTask::kNormal_Mode);
    SPAWN(ReplayTask, fGMFactory(NULL), bitmap, ReplayTask::kRTree_Mode);
    SPAWN(SerializeTask, fGMFactory(NULL), bitmap);

    SPAWN(WriteTask, bitmap);
#undef SPAWN
}
예제 #2
0
void QuiltTask::draw() {
    SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get()));

    SkBitmap full;
    AllocatePixels(fReference, &full);
    SkCanvas fullCanvas(full);

    SkBitmap tile;
    tile.allocPixels(SkImageInfo::Make(FLAGS_quiltTile, FLAGS_quiltTile,
                                       fReference.colorType(), kPremul_SkAlphaType));
    SkCanvas tileCanvas(tile);

    for (int y = 0; y < tiles_needed(full.height(), tile.height()); y++) {
        for (int x = 0; x < tiles_needed(full.width(), tile.width()); x++) {
            SkAutoCanvasRestore ar(&tileCanvas, true/*also save now*/);

            const SkScalar xOffset = SkIntToScalar(x * tile.width()),
                           yOffset = SkIntToScalar(y * tile.height());
            SkMatrix matrix = tileCanvas.getTotalMatrix();
            matrix.postTranslate(-xOffset, -yOffset);
            tileCanvas.setMatrix(matrix);

            recorded->draw(&tileCanvas);
            tileCanvas.flush();
            fullCanvas.drawBitmap(tile, xOffset, yOffset, NULL);
        }
    }

    if (!BitmapsEqual(full, fReference)) {
        this->fail();
        this->spawnChild(SkNEW_ARGS(WriteTask, (*this, full)));
    }
}
예제 #3
0
static void draw_raster(Benchmark* bench, SkColorType colorType) {
    SkBitmap bitmap;
    AllocatePixels(colorType, bench->getSize().x(), bench->getSize().y(), &bitmap);
    SkCanvas canvas(bitmap);

    bench->preDraw();
    bench->draw(1, &canvas);
}
예제 #4
0
void SKPTask::draw() {
    SkBitmap bitmap;
    AllocatePixels(kN32_SkColorType, fPicture->width(), fPicture->height(), &bitmap);
    DrawPicture(fPicture, &bitmap);

    this->spawnChild(SkNEW_ARGS(RecordTask,
                                (*this, fPicture, bitmap, RecordTask::kNoOptimize_Mode)));
    this->spawnChild(SkNEW_ARGS(RecordTask,
                                (*this, fPicture, bitmap, RecordTask::kOptimize_Mode)));
    this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
}
예제 #5
0
void AllocatePixels(const SkBitmap& reference, SkBitmap* bitmap) {
    AllocatePixels(reference.colorType(), reference.width(), reference.height(), bitmap);
}