aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/skpdiff/SkImageDiffer.cpp
blob: 8a5c3c71a2ea0c82fdf11b1bae685cbb399955a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * 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 "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);
}