Add API to copy a window
Change-Id: I9bb5209010db6665be4b6f8db81a6fc1b7debc45
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 3edd423..dcbc980 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -617,17 +617,19 @@
post(task);
}
-CREATE_BRIDGE3(copySurfaceInto, RenderThread* thread,
- Surface* surface, SkBitmap* bitmap) {
+CREATE_BRIDGE4(copySurfaceInto, RenderThread* thread,
+ Surface* surface, Rect srcRect, SkBitmap* bitmap) {
return (void*) Readback::copySurfaceInto(*args->thread,
- *args->surface, args->bitmap);
+ *args->surface, args->srcRect, args->bitmap);
}
-int RenderProxy::copySurfaceInto(sp<Surface>& surface, SkBitmap* bitmap) {
+int RenderProxy::copySurfaceInto(sp<Surface>& surface, int left, int top,
+ int right, int bottom, SkBitmap* bitmap) {
SETUP_TASK(copySurfaceInto);
args->bitmap = bitmap;
args->surface = surface.get();
args->thread = &RenderThread::getInstance();
+ args->srcRect.set(left, top, right, bottom);
return static_cast<int>(
reinterpret_cast<intptr_t>( staticPostAndWait(task) ));
}
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index d812970..d4aaea6 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -127,7 +127,8 @@
ANDROID_API void removeFrameMetricsObserver(FrameMetricsObserver* observer);
ANDROID_API long getDroppedFrameReportCount();
- ANDROID_API static int copySurfaceInto(sp<Surface>& surface, SkBitmap* bitmap);
+ ANDROID_API static int copySurfaceInto(sp<Surface>& surface,
+ int left, int top, int right, int bottom, SkBitmap* bitmap);
ANDROID_API static void prepareToDraw(const SkBitmap& bitmap);
private: