blob: e723169ad795ec97c05514522699a6a4b1ce90ac [file] [log] [blame]
Derek Sollenbergerc4fbada2016-11-07 16:05:41 -05001/*
2 * Copyright (C) 2016 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 "Readback.h"
20
John Reck44627c22018-04-12 13:55:38 -070021#include "Matrix.h"
22
Mathias Agopian3d7d5f92017-05-01 15:13:20 -070023#include <EGL/egl.h>
24#include <EGL/eglext.h>
25
Derek Sollenbergerc4fbada2016-11-07 16:05:41 -050026namespace android {
27namespace uirenderer {
28
John Reck44627c22018-04-12 13:55:38 -070029class EglReadback : public Readback {
Derek Sollenbergerc4fbada2016-11-07 16:05:41 -050030public:
31 virtual CopyResult copySurfaceInto(Surface& surface, const Rect& srcRect,
John Reck1bcacfd2017-11-03 10:12:19 -070032 SkBitmap* bitmap) override;
sergeyv59eecb522016-11-17 17:54:57 -080033 virtual CopyResult copyGraphicBufferInto(GraphicBuffer* graphicBuffer,
John Reck1bcacfd2017-11-03 10:12:19 -070034 SkBitmap* bitmap) override;
Derek Sollenbergerc4fbada2016-11-07 16:05:41 -050035
36protected:
John Reck44627c22018-04-12 13:55:38 -070037 explicit EglReadback(renderthread::RenderThread& thread) : Readback(thread) {}
38 virtual ~EglReadback() {}
Derek Sollenbergerc4fbada2016-11-07 16:05:41 -050039
40 virtual CopyResult copyImageInto(EGLImageKHR eglImage, const Matrix4& imgTransform,
John Reck1bcacfd2017-11-03 10:12:19 -070041 int imgWidth, int imgHeight, const Rect& srcRect,
42 SkBitmap* bitmap) = 0;
43
sergeyv59eecb522016-11-17 17:54:57 -080044private:
45 CopyResult copyGraphicBufferInto(GraphicBuffer* graphicBuffer, Matrix4& texTransform,
John Reck1bcacfd2017-11-03 10:12:19 -070046 const Rect& srcRect, SkBitmap* bitmap);
Derek Sollenbergerc4fbada2016-11-07 16:05:41 -050047};
48
John Reck1bcacfd2017-11-03 10:12:19 -070049} // namespace uirenderer
50} // namespace android