0039874105
In this CL, I forked compile.sh and created a new gm_bindings.cpp. I also moved viewer.html into wasm_tools and created a gmtests.html for testing out the bindings locally. Right now there is only one gm file compiled in. I plan in a followup CL to have some way to generate the list of cpp files that need to be compiled in from gms.gni. I was unable to get it to work with simply linking the lib_gm.gni, probably due to the same issue with Registry that csmartdalton@ ran into when adding viewer.html and the associated bindings. Suggested reviewing order: - gmtests.html to get a sense of how the test flow works. - gm_bindings.cpp to make sure I setup the contexts/GMs correctly. - compile_gm.sh to see how the gms are compiled in. - The remaining files in any order. When I tested this locally, the bleed_downscale digest was exactly the same (pixel for pixel, byte for byte) as a known digest in Gold, so I'm fairly confident in how things work. Change-Id: I2babef848ca60f7db74e4adf27b8952a66bdeee1 Bug: skia:10812 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322956 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Kevin Lubick <kjlubick@google.com>
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
// Copyright 2019 Google LLC.
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
#pragma once
|
|
|
|
#include "include/core/SkBitmap.h"
|
|
#include "include/core/SkStream.h"
|
|
#include "tools/flags/CommandLineFlags.h"
|
|
|
|
// HashAndEncode transforms any SkBitmap into a standard format, currently
|
|
// 16-bit unpremul RGBA in the Rec. 2020 color space. This lets us compare
|
|
// images from different backends or configurations, using feedHash() for
|
|
// direct content-based hashing, or encodePNG() for visual comparison.
|
|
class HashAndEncode {
|
|
public:
|
|
explicit HashAndEncode(const SkBitmap&);
|
|
|
|
// Feed uncompressed pixel data into a hash function like MD5.
|
|
void feedHash(SkWStream*) const;
|
|
|
|
// Encode pixels as a PNG in our standard format, with md5 and key/properties as metadata.
|
|
bool encodePNG(SkWStream*,
|
|
const char* md5,
|
|
CommandLineFlags::StringArray key,
|
|
CommandLineFlags::StringArray properties) const;
|
|
|
|
private:
|
|
const SkISize fSize;
|
|
std::unique_ptr<uint64_t[]> fPixels; // In our standard format mentioned above.
|
|
};
|
|
|