blob: 0105734bfe9c62df11b9998c22b352738e84ac6f [file] [log] [blame]
reed@google.com1bdf7fe2012-06-14 18:58:40 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
9#include "SkBitmap.h"
10#include "SkCanvas.h"
11#include "SkOSFile.h"
12#include "SkPicture.h"
13#include "SkStream.h"
14#include "SkString.h"
15
16static void inspect(const char path[]) {
17 SkFILEStream stream(path);
18 if (!stream.isValid()) {
19 printf("-- Can't open '%s'\n", path);
20 return;
21 }
22
23 printf("Opening '%s'...\n", path);
24
25 {
26 int32_t header[3];
27 if (stream.read(header, sizeof(header)) != sizeof(header)) {
28 printf("-- Failed to read header (12 bytes)\n");
29 return;
30 }
31 printf("version:%d width:%d height:%d\n", header[0], header[1], header[2]);
32 }
33
34 stream.rewind();
35 SkPicture pic(&stream);
36 printf("picture size:[%d %d]\n", pic.width(), pic.height());
37}
38
39int main(int argc, char* const argv[]) {
40 if (argc < 2) {
41 printf("Usage: pinspect filename [filename ...]\n");
42 }
43 for (int i = 1; i < argc; ++i) {
44 inspect(argv[i]);
45 if (i < argc - 1) {
46 printf("\n");
47 }
48 }
49 return 0;
50}