Flutter Engine
The Flutter Engine
third_party
skia
tools
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
6
#include "
include/core/SkBitmap.h
"
7
#include "
include/core/SkStream.h
"
8
#include "
tools/flags/CommandLineFlags.h
"
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.
14
class
HashAndEncode
{
15
public
:
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
,
24
CommandLineFlags::StringArray
key
,
25
CommandLineFlags::StringArray
properties)
const
;
26
27
private
:
28
const
SkISize
fSize;
29
std::unique_ptr<uint64_t[]> fPixels;
// In our standard format mentioned above.
30
};
31
md5
static SkMD5::Digest md5(const SkBitmap &bm)
Definition:
CodecTest.cpp:77
CommandLineFlags.h
SkBitmap.h
SkStream.h
CommandLineFlags::StringArray
Definition:
CommandLineFlags.h:127
HashAndEncode
Definition:
HashAndEncode.h:14
HashAndEncode::encodePNG
bool encodePNG(SkWStream *, const char *md5, CommandLineFlags::StringArray key, CommandLineFlags::StringArray properties) const
Definition:
HashAndEncode.cpp:122
HashAndEncode::HashAndEncode
HashAndEncode(const SkBitmap &)
Definition:
HashAndEncode.cpp:18
HashAndEncode::feedHash
void feedHash(SkWStream *) const
Definition:
HashAndEncode.cpp:106
SkBitmap
Definition:
SkBitmap.h:59
SkWStream
Definition:
SkStream.h:218
key
int key
Definition:
keyboard_key_handler_unittests.cc:114
SkISize
Definition:
SkSize.h:16
Generated on Sun Jun 23 2024 21:56:50 for Flutter Engine by
1.9.4