Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkKeyedImage.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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#ifndef SkKeyedImage_DEFINED
8#define SkKeyedImage_DEFINED
9
12#include "src/pdf/SkBitmapKey.h"
13
14/**
15 This class has all the advantages of SkBitmaps and SkImages.
16
17 The SkImage holds on to encoded data. The SkBitmapKey properly de-dups subsets.
18 */
20public:
23 SkKeyedImage(const SkBitmap&);
25 SkKeyedImage(const SkKeyedImage&) = default;
26
29
30 explicit operator bool() const { return fImage != nullptr; }
31 const SkBitmapKey& key() const { return fKey; }
32 const sk_sp<SkImage>& image() const { return fImage; }
35
36private:
37 sk_sp<SkImage> fImage;
38 SkBitmapKey fKey = {{0, 0, 0, 0}, 0};
39};
40
41/**
42 * Given an Image, return the Bitmap Key that corresponds to it. If the Image
43 * wraps a Bitmap, use that Bitmap's key.
44 */
46#endif // SkKeyedImage_DEFINED
SkBitmapKey SkBitmapKeyFromImage(const SkImage *)
SkKeyedImage & operator=(const SkKeyedImage &)=default
const sk_sp< SkImage > & image() const
SkKeyedImage(const SkKeyedImage &)=default
SkKeyedImage subset(SkIRect subset) const
SkKeyedImage & operator=(SkKeyedImage &&)=default
const SkBitmapKey & key() const
SkKeyedImage(SkKeyedImage &&)=default
sk_sp< SkImage > release()