diff options
author | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-19 03:20:53 +0000 |
---|---|---|
committer | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-19 03:20:53 +0000 |
commit | abd8040ff923b6b2b737737e7fcfd4df930e1001 (patch) | |
tree | 85919d905c64b78dbe0f224952b0c8d7e573fc9f | |
parent | a03685be9ee4a351fe710c89ade6bf05663cedf0 (diff) | |
download | chromium_src-abd8040ff923b6b2b737737e7fcfd4df930e1001.zip chromium_src-abd8040ff923b6b2b737737e7fcfd4df930e1001.tar.gz chromium_src-abd8040ff923b6b2b737737e7fcfd4df930e1001.tar.bz2 |
Remove |view_size_| from JniFrameConsumer
It isn't needed, since it always matches the size of the allocated Java
bitmap.
Review URL: https://codereview.chromium.org/93873016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241777 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/client/jni/jni_frame_consumer.cc | 14 | ||||
-rw-r--r-- | remoting/client/jni/jni_frame_consumer.h | 5 |
2 files changed, 9 insertions, 10 deletions
diff --git a/remoting/client/jni/jni_frame_consumer.cc b/remoting/client/jni/jni_frame_consumer.cc index 9fb8f2f..3362daf 100644 --- a/remoting/client/jni/jni_frame_consumer.cc +++ b/remoting/client/jni/jni_frame_consumer.cc @@ -48,7 +48,8 @@ void JniFrameConsumer::ApplyBuffer(const webrtc::DesktopSize& view_size, const webrtc::DesktopRegion& region) { DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread()); - if (!view_size_.equals(buffer->size())) { + if (bitmap_->size().width() != buffer->size().width() || + bitmap_->size().height() != buffer->size().height()) { // Drop the frame, since the data belongs to the previous generation, // before SetSourceSize() called SetOutputSizeAndClip(). FreeBuffer(buffer); @@ -92,22 +93,21 @@ void JniFrameConsumer::SetSourceSize(const webrtc::DesktopSize& source_size, // We currently render the desktop 1:1 and perform pan/zoom scaling // and cropping on the managed canvas. - view_size_ = source_size; - clip_area_ = webrtc::DesktopRect::MakeSize(view_size_); - frame_producer_->SetOutputSizeAndClip(view_size_, clip_area_); + clip_area_ = webrtc::DesktopRect::MakeSize(source_size); + frame_producer_->SetOutputSizeAndClip(source_size, clip_area_); // Allocate buffer and start drawing frames onto it. - AllocateBuffer(); + AllocateBuffer(source_size); } FrameConsumer::PixelFormat JniFrameConsumer::GetPixelFormat() { return FORMAT_RGBA; } -void JniFrameConsumer::AllocateBuffer() { +void JniFrameConsumer::AllocateBuffer(const webrtc::DesktopSize& source_size) { DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread()); - webrtc::DesktopSize size(view_size_.width(), view_size_.height()); + webrtc::DesktopSize size(source_size.width(), source_size.height()); // Allocate a new Bitmap, store references here, and pass it to Java. JNIEnv* env = base::android::AttachCurrentThread(); diff --git a/remoting/client/jni/jni_frame_consumer.h b/remoting/client/jni/jni_frame_consumer.h index 87261db..ceeac09 100644 --- a/remoting/client/jni/jni_frame_consumer.h +++ b/remoting/client/jni/jni_frame_consumer.h @@ -50,9 +50,9 @@ class JniFrameConsumer : public FrameConsumer { virtual PixelFormat GetPixelFormat() OVERRIDE; private: - // Allocates a new buffer of |view_size_|, informs Java about it, and tells + // Allocates a new buffer of |source_size|, informs Java about it, and tells // the producer to draw onto it. - void AllocateBuffer(); + void AllocateBuffer(const webrtc::DesktopSize& source_size); // Frees a frame buffer previously allocated by AllocateBuffer. void FreeBuffer(webrtc::DesktopFrame* buffer); @@ -66,7 +66,6 @@ class JniFrameConsumer : public FrameConsumer { scoped_refptr<ChromotingJniInstance> jni_instance_; FrameProducer* frame_producer_; - webrtc::DesktopSize view_size_; webrtc::DesktopRect clip_area_; // List of allocated image buffers. |