| Flutter Impeller |

metal_screenshot.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_GOLDEN_TESTS_METAL_SCREENSHOT_H_
6 #define FLUTTER_IMPELLER_GOLDEN_TESTS_METAL_SCREENSHOT_H_
7
8 #include "flutter/impeller/golden_tests/screenshot.h"
9
10 #include <CoreFoundation/CoreFoundation.h>
11 #include <CoreImage/CoreImage.h>
12 #include <string>
13
14 #include "flutter/fml/macros.h"
15
16 namespace impeller {
17 namespace testing {
18
19 /// A screenshot that was produced from `MetalScreenshotter`.
20 class MetalScreenshot : public Screenshot {
21 public:
22 explicit MetalScreenshot(CGImageRef cgImage);
23
24 ~MetalScreenshot();
25
26 const uint8_t* GetBytes() const override;
27
28 size_t GetHeight() const override;
29
30 size_t GetWidth() const override;
31
32 size_t GetBytesPerRow() const override;
33
34 bool WriteToPNG(const std::string& path) const override;
35
36 private:
37 MetalScreenshot(const MetalScreenshot&) = delete;
38
39 MetalScreenshot& operator=(const MetalScreenshot&) = delete;
40 CGImageRef cg_image_;
41 CFDataRef pixel_data_;
42 };
43 } // namespace testing
44 } // namespace impeller
45
46 #endif // FLUTTER_IMPELLER_GOLDEN_TESTS_METAL_SCREENSHOT_H_
impeller::testing::MetalScreenshot::GetBytesPerRow
size_t GetBytesPerRow() const override
Returns number of bytes required to represent one row of the raw image.
Definition: metal_screenshot.mm:32
impeller::testing::MetalScreenshot
A screenshot that was produced from MetalScreenshotter.
Definition: metal_screenshot.h:20
impeller::testing::Screenshot
Definition: screenshot.h:16
screenshot.h
impeller::testing::MetalScreenshot::GetBytes
const uint8_t * GetBytes() const override
Access raw data of the screenshot.
Definition: metal_screenshot.mm:20
impeller::testing::MetalScreenshot::MetalScreenshot
MetalScreenshot(CGImageRef cgImage)
Definition: metal_screenshot.mm:10
impeller::testing::MetalScreenshot::WriteToPNG
bool WriteToPNG(const std::string &path) const override
Definition: metal_screenshot.mm:36
impeller::testing::MetalScreenshot::GetHeight
size_t GetHeight() const override
Returns the height of the image in pixels.
Definition: metal_screenshot.mm:24
impeller::testing::MetalScreenshot::~MetalScreenshot
~MetalScreenshot()
Definition: metal_screenshot.mm:15
impeller::testing::MetalScreenshot::GetWidth
size_t GetWidth() const override
Returns the width of the image in pixels.
Definition: metal_screenshot.mm:28
impeller
Definition: aiks_blur_unittests.cc:20