Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
HashAndEncode.h
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3
4#pragma once
5
9
10// HashAndEncode transforms any SkBitmap into a standard format, currently
11// 16-bit unpremul RGBA in the Rec. 2020 color space. This lets us compare
12// images from different backends or configurations, using feedHash() for
13// direct content-based hashing, or encodePNG() for visual comparison.
15public:
16 explicit HashAndEncode(const SkBitmap&);
17
18 // Feed uncompressed pixel data into a hash function like MD5.
19 void feedHash(SkWStream*) const;
20
21 // Encode pixels as a PNG in our standard format, with md5 and key/properties as metadata.
22 bool encodePNG(SkWStream*,
23 const char* md5,
25 CommandLineFlags::StringArray properties) const;
26
27private:
28 const SkISize fSize;
29 std::unique_ptr<uint64_t[]> fPixels; // In our standard format mentioned above.
30};
31
static SkMD5::Digest md5(const SkBitmap &bm)
Definition CodecTest.cpp:77
bool encodePNG(SkWStream *, const char *md5, CommandLineFlags::StringArray key, CommandLineFlags::StringArray properties) const
void feedHash(SkWStream *) const