blob: 5fbd5f900716f22c5f108304908488e01078ad2e [file] [log] [blame]
John Reck4d73cb12022-07-27 10:32:52 -04001/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include "Rect.h"
20#include "hwui/Bitmap.h"
21
22namespace android::uirenderer {
23
24// Keep in sync with PixelCopy.java codes
25enum class CopyResult {
26 Success = 0,
27 UnknownError = 1,
28 Timeout = 2,
29 SourceEmpty = 3,
30 SourceInvalid = 4,
31 DestinationInvalid = 5,
32};
33
34struct CopyRequest {
35 Rect srcRect;
36 CopyRequest(Rect srcRect) : srcRect(srcRect) {}
37 virtual ~CopyRequest() {}
38 virtual SkBitmap getDestinationBitmap(int srcWidth, int srcHeight) = 0;
39 virtual void onCopyFinished(CopyResult result) = 0;
40};
41
42} // namespace android::uirenderer