Index: remoting/client/jni/jni_frame_consumer.h |
diff --git a/remoting/client/jni/jni_frame_consumer.h b/remoting/client/jni/jni_frame_consumer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c91e3657426548caa3bb34bbff1dd6e5c199cf69 |
--- /dev/null |
+++ b/remoting/client/jni/jni_frame_consumer.h |
@@ -0,0 +1,52 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef REMOTING_CLIENT_JNI_JNI_FRAME_CONSUMER_H_ |
+#define REMOTING_CLIENT_JNI_JNI_FRAME_CONSUMER_H_ |
+ |
+#include "remoting/client/frame_consumer.h" |
+ |
+#include "base/compiler_specific.h" |
+ |
+namespace webrtc { |
+class DesktopFrame; |
+} // namespace webrtc |
+ |
+namespace remoting { |
+class ChromotingJni; |
+class FrameProducer; |
+ |
+// FrameConsumer implementation that draws onto a JNI direct byte buffer. |
+class JniFrameConsumer : public FrameConsumer { |
+ public: |
+ JniFrameConsumer(); |
+ virtual ~JniFrameConsumer(); |
+ |
+ // This must be called once before the producer's source size is set. |
+ void set_frame_producer(FrameProducer* producer); |
+ |
+ // FrameConsumer implementation. |
+ virtual void ApplyBuffer(const SkISize& view_size, |
+ const SkIRect& clip_area, |
+ webrtc::DesktopFrame* buffer, |
+ const SkRegion& region) OVERRIDE; |
+ virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; |
+ virtual void SetSourceSize(const SkISize& source_size, |
+ const SkIPoint& dpi) OVERRIDE; |
+ |
+ private: |
+ // These variables are to be used from the display thread. |
+ FrameProducer* frame_producer_; |
+ SkISize view_size_; |
+ SkIRect clip_area_; |
+ |
+ // Helper to allocate a new buffer of |view_size_| and inform Java about it. |
+ webrtc::DesktopFrame* AllocateBuffer(); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(JniFrameConsumer); |
+}; |
+ |
+} // namespace remoting |
+ |
+#endif |