| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#pragma once |
| 18 |
|
| 19 |
#include "Matrix.h" |
| 20 |
#include "Rect.h" |
| 21 |
#include "renderthread/RenderThread.h" |
| 22 |
|
| 23 |
#include <SkBitmap.h> |
| 24 |
|
| 25 |
namespace android { |
| 26 |
class Bitmap; |
| 27 |
class GraphicBuffer; |
| 28 |
class Surface; |
| 29 |
namespace uirenderer { |
| 30 |
|
| 31 |
class DeferredLayerUpdater; |
| 32 |
class Layer; |
| 33 |
|
| 34 |
|
| 35 |
enum class CopyResult { |
| 36 |
Success = 0, |
| 37 |
UnknownError = 1, |
| 38 |
Timeout = 2, |
| 39 |
SourceEmpty = 3, |
| 40 |
SourceInvalid = 4, |
| 41 |
DestinationInvalid = 5, |
| 42 |
}; |
| 43 |
|
| 44 |
class Readback { |
| 45 |
public: |
| 46 |
explicit Readback(renderthread::RenderThread& thread) : mRenderThread(thread) {} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
CopyResult copySurfaceInto(ANativeWindow* window, const Rect& srcRect, SkBitmap* bitmap); |
| 51 |
|
| 52 |
CopyResult copyHWBitmapInto(Bitmap* hwBitmap, SkBitmap* bitmap); |
| 53 |
CopyResult copyImageInto(const sk_sp<SkImage>& image, SkBitmap* bitmap); |
| 54 |
|
| 55 |
CopyResult copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap); |
| 56 |
|
| 57 |
private: |
| 58 |
CopyResult copySurfaceIntoLegacy(ANativeWindow* window, const Rect& srcRect, SkBitmap* bitmap); |
| 59 |
CopyResult copyImageInto(const sk_sp<SkImage>& image, const Rect& srcRect, SkBitmap* bitmap); |
| 60 |
|
| 61 |
bool copyLayerInto(Layer* layer, const SkRect* srcRect, const SkRect* dstRect, |
| 62 |
SkBitmap* bitmap); |
| 63 |
|
| 64 |
renderthread::RenderThread& mRenderThread; |
| 65 |
}; |
| 66 |
|
| 67 |
} |
| 68 |
} |