ee21a3e395
- rename ComparisonTask to ChecksumTask - have ChecksumTask handle all the checksum-checking - turn on all extra modes by default - simplify progress output to a countdown BUG= R=bsalomon@google.com Review URL: https://codereview.chromium.org/88543002 git-svn-id: http://skia.googlecode.com/svn/trunk@12398 2bbb7eff-a529-9590-31e7-b0007b416f81
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#include "DMUtil.h"
|
|
|
|
#include "SkPicture.h"
|
|
|
|
namespace DM {
|
|
|
|
SkString UnderJoin(const char* a, const char* b) {
|
|
SkString s;
|
|
s.appendf("%s_%s", a, b);
|
|
return s;
|
|
}
|
|
|
|
SkString Png(SkString s) {
|
|
s.appendf(".png");
|
|
return s;
|
|
}
|
|
|
|
void RecordPicture(skiagm::GM* gm, SkPicture* picture, uint32_t recordFlags) {
|
|
const SkISize size = gm->getISize();
|
|
SkCanvas* canvas = picture->beginRecording(size.width(), size.height(), recordFlags);
|
|
canvas->concat(gm->getInitialTransform());
|
|
gm->draw(canvas);
|
|
canvas->flush();
|
|
picture->endRecording();
|
|
}
|
|
|
|
void SetupBitmap(const SkBitmap::Config config, skiagm::GM* gm, SkBitmap* bitmap) {
|
|
const SkISize size = gm->getISize();
|
|
bitmap->setConfig(config, size.width(), size.height());
|
|
bitmap->allocPixels();
|
|
bitmap->eraseColor(0x00000000);
|
|
}
|
|
|
|
void DrawPicture(SkPicture* picture, SkBitmap* bitmap) {
|
|
SkASSERT(picture != NULL);
|
|
SkASSERT(bitmap != NULL);
|
|
SkCanvas canvas(*bitmap);
|
|
canvas.drawPicture(*picture);
|
|
canvas.flush();
|
|
}
|
|
|
|
bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) {
|
|
const SkAutoLockPixels lockA(a), lockB(b);
|
|
return a.getSize() == b.getSize() && 0 == memcmp(a.getPixels(), b.getPixels(), b.getSize());
|
|
}
|
|
|
|
} // namespace DM
|