28d5bdd97e
Reason for revert: still blocking DEPS roll Original issue's description: > Repurpose Release_Developer BUILDTYPE and remove SK_DEVELOPER. > > The Release_Developer build type is now used to build Skia with > release level optimizations but still enable SK_DEBUG. This in turn > means that SkASSERTS and SkRTConf are available in this mode. > > Further we can then remove SK_DEVELOPER as a define as it is true > iff SK_DEBUG is true. > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1927583002 > DOCS_PREVIEW= https://skia.org/?cl=1927583002 > > Committed: https://skia.googlesource.com/skia/+/48d6f88479e72efaf9b9d8f9c0769acb1ba773db TBR=bungeman@gmail.com,bungeman@google.com,benjaminwagner@google.com,djsollen@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/1918253006
90 lines
2.1 KiB
C++
90 lines
2.1 KiB
C++
/*
|
|
* Copyright 2012 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 "SkCanvas.h"
|
|
#include "SkGraphics.h"
|
|
#include "SkOSFile.h"
|
|
#include "SkPicture.h"
|
|
#include "SkStream.h"
|
|
#include "SkString.h"
|
|
#include "SkDumpCanvas.h"
|
|
|
|
static sk_sp<SkPicture> inspect(const char path[]) {
|
|
SkFILEStream stream(path);
|
|
if (!stream.isValid()) {
|
|
printf("-- Can't open '%s'\n", path);
|
|
return nullptr;
|
|
}
|
|
|
|
printf("Opening '%s'...\n", path);
|
|
|
|
{
|
|
int32_t header[3];
|
|
if (stream.read(header, sizeof(header)) != sizeof(header)) {
|
|
printf("-- Failed to read header (12 bytes)\n");
|
|
return nullptr;
|
|
}
|
|
printf("version:%d width:%d height:%d\n", header[0], header[1], header[2]);
|
|
}
|
|
|
|
stream.rewind();
|
|
auto pic = SkPicture::MakeFromStream(&stream);
|
|
if (nullptr == pic) {
|
|
SkDebugf("Could not create SkPicture: %s\n", path);
|
|
return nullptr;
|
|
}
|
|
printf("picture cullRect: [%f %f %f %f]\n",
|
|
pic->cullRect().fLeft, pic->cullRect().fTop,
|
|
pic->cullRect().fRight, pic->cullRect().fBottom);
|
|
return pic;
|
|
}
|
|
|
|
static void dumpOps(SkPicture* pic) {
|
|
#ifdef SK_DEVELOPER
|
|
SkDebugfDumper dumper;
|
|
SkDumpCanvas canvas(&dumper);
|
|
canvas.drawPicture(pic);
|
|
#else
|
|
printf("SK_DEVELOPER mode not enabled\n");
|
|
#endif
|
|
}
|
|
|
|
int tool_main(int argc, char** argv);
|
|
int tool_main(int argc, char** argv) {
|
|
SkAutoGraphics ag;
|
|
if (argc < 2) {
|
|
printf("Usage: pinspect [--dump-ops] filename [filename ...]\n");
|
|
return 1;
|
|
}
|
|
|
|
bool doDumpOps = false;
|
|
|
|
int index = 1;
|
|
if (!strcmp(argv[index], "--dump-ops")) {
|
|
index += 1;
|
|
doDumpOps = true;
|
|
}
|
|
|
|
for (; index < argc; ++index) {
|
|
auto pic(inspect(argv[index]));
|
|
if (doDumpOps) {
|
|
dumpOps(pic.get());
|
|
}
|
|
if (index < argc - 1) {
|
|
printf("\n");
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
#if !defined SK_BUILD_FOR_IOS
|
|
int main(int argc, char * const argv[]) {
|
|
return tool_main(argc, (char**) argv);
|
|
}
|
|
#endif
|