skia2/experimental/skpdiff/SkImageDiffer.cpp
commit-bot@chromium.org be19b9ef9a add skpdiff tool to compare bitmaps
- start framework for pluggable algorithms
- implement simple number of pixels different OpenCL algo

R=djsollen@google.com, bsalomon@google.com, jvanverth@google.com

Author: zachr@google.com

Review URL: https://chromiumcodereview.appspot.com/16284007

git-svn-id: http://skia.googlecode.com/svn/trunk@9616 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-06-14 17:26:54 +00:00

40 lines
854 B
C++

/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <cstring>
#include "SkBitmap.h"
#include "SkImageDecoder.h"
#include "SkImageDiffer.h"
#include "skpdiff_util.h"
SkImageDiffer::SkImageDiffer()
: fIsGood(true) {
}
SkImageDiffer::~SkImageDiffer() {
}
int SkImageDiffer::queueDiffOfFile(const char baseline[], const char test[]) {
SkBitmap baselineBitmap;
SkBitmap testBitmap;
if (!SkImageDecoder::DecodeFile(baseline, &baselineBitmap)) {
SkDebugf("Failed to load bitmap \"%s\"\n", baseline);
return -1;
}
if (!SkImageDecoder::DecodeFile(test, &testBitmap)) {
SkDebugf("Failed to load bitmap \"%s\"\n", test);
return -1;
}
return this->queueDiff(&baselineBitmap, &testBitmap);
}