| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/compositor_impl_android.h" | 5 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 scoped_ptr<cc::Thread> impl_thread; | 200 scoped_ptr<cc::Thread> impl_thread; |
| 201 if (g_impl_thread) | 201 if (g_impl_thread) |
| 202 impl_thread = cc::ThreadImpl::CreateForDifferentThread( | 202 impl_thread = cc::ThreadImpl::CreateForDifferentThread( |
| 203 g_impl_thread->message_loop()->message_loop_proxy()); | 203 g_impl_thread->message_loop()->message_loop_proxy()); |
| 204 | 204 |
| 205 host_ = cc::LayerTreeHost::Create(this, settings, impl_thread.Pass()); | 205 host_ = cc::LayerTreeHost::Create(this, settings, impl_thread.Pass()); |
| 206 host_->SetRootLayer(root_layer_); | 206 host_->SetRootLayer(root_layer_); |
| 207 | 207 |
| 208 host_->SetVisible(true); | 208 host_->SetVisible(true); |
| 209 host_->SetSurfaceReady(); | 209 host_->SetSurfaceReady(); |
| 210 host_->SetViewportSize(size_, size_); | 210 host_->SetViewportSize(size_); |
| 211 host_->set_has_transparent_background(has_transparent_background_); | 211 host_->set_has_transparent_background(has_transparent_background_); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 void CompositorImpl::setDeviceScaleFactor(float factor) { | 215 void CompositorImpl::setDeviceScaleFactor(float factor) { |
| 216 if (host_) | 216 if (host_) |
| 217 host_->SetDeviceScaleFactor(factor); | 217 host_->SetDeviceScaleFactor(factor); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void CompositorImpl::SetWindowBounds(const gfx::Size& size) { | 220 void CompositorImpl::SetWindowBounds(const gfx::Size& size) { |
| 221 if (size_ == size) | 221 if (size_ == size) |
| 222 return; | 222 return; |
| 223 | 223 |
| 224 size_ = size; | 224 size_ = size; |
| 225 if (host_) | 225 if (host_) |
| 226 host_->SetViewportSize(size, size); | 226 host_->SetViewportSize(size); |
| 227 root_layer_->SetBounds(size); | 227 root_layer_->SetBounds(size); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void CompositorImpl::SetHasTransparentBackground(bool flag) { | 230 void CompositorImpl::SetHasTransparentBackground(bool flag) { |
| 231 has_transparent_background_ = flag; | 231 has_transparent_background_ = flag; |
| 232 if (host_.get()) | 232 if (host_.get()) |
| 233 host_->set_has_transparent_background(flag); | 233 host_->set_has_transparent_background(flag); |
| 234 } | 234 } |
| 235 | 235 |
| 236 bool CompositorImpl::CompositeAndReadback(void *pixels, const gfx::Rect& rect) { | 236 bool CompositorImpl::CompositeAndReadback(void *pixels, const gfx::Rect& rect) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 case ANDROID_BITMAP_FORMAT_RGBA_8888: | 446 case ANDROID_BITMAP_FORMAT_RGBA_8888: |
| 447 return GL_UNSIGNED_BYTE; | 447 return GL_UNSIGNED_BYTE; |
| 448 break; | 448 break; |
| 449 case ANDROID_BITMAP_FORMAT_RGB_565: | 449 case ANDROID_BITMAP_FORMAT_RGB_565: |
| 450 default: | 450 default: |
| 451 return GL_UNSIGNED_SHORT_5_6_5; | 451 return GL_UNSIGNED_SHORT_5_6_5; |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 | 454 |
| 455 } // namespace content | 455 } // namespace content |
| OLD | NEW |