| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 3362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3373 switch (bitmap.GetFormat()) { | 3373 switch (bitmap.GetFormat()) { |
| 3374 case UIResourceBitmap::RGBA8: | 3374 case UIResourceBitmap::RGBA8: |
| 3375 break; | 3375 break; |
| 3376 case UIResourceBitmap::ALPHA_8: | 3376 case UIResourceBitmap::ALPHA_8: |
| 3377 format = ALPHA_8; | 3377 format = ALPHA_8; |
| 3378 break; | 3378 break; |
| 3379 case UIResourceBitmap::ETC1: | 3379 case UIResourceBitmap::ETC1: |
| 3380 format = ETC1; | 3380 format = ETC1; |
| 3381 break; | 3381 break; |
| 3382 } | 3382 } |
| 3383 id = | 3383 id = resource_provider_->CreateResource( |
| 3384 resource_provider_->CreateResource(bitmap.GetSize(), | 3384 bitmap.GetSize(), wrap_mode, ResourceProvider::TextureHintImmutable, |
| 3385 wrap_mode, | 3385 format); |
| 3386 ResourceProvider::TextureHintImmutable, | |
| 3387 format); | |
| 3388 | 3386 |
| 3389 UIResourceData data; | 3387 UIResourceData data; |
| 3390 data.resource_id = id; | 3388 data.resource_id = id; |
| 3391 data.size = bitmap.GetSize(); | 3389 data.size = bitmap.GetSize(); |
| 3392 data.opaque = bitmap.GetOpaque(); | 3390 data.opaque = bitmap.GetOpaque(); |
| 3393 | 3391 |
| 3394 ui_resource_map_[uid] = data; | 3392 ui_resource_map_[uid] = data; |
| 3395 | 3393 |
| 3396 AutoLockUIResourceBitmap bitmap_lock(bitmap); | 3394 AutoLockUIResourceBitmap bitmap_lock(bitmap); |
| 3397 resource_provider_->SetPixels(id, | 3395 resource_provider_->CopyToResource(id, bitmap_lock.GetPixels(), |
| 3398 bitmap_lock.GetPixels(), | 3396 bitmap.GetSize()); |
| 3399 gfx::Rect(bitmap.GetSize()), | |
| 3400 gfx::Rect(bitmap.GetSize()), | |
| 3401 gfx::Vector2d(0, 0)); | |
| 3402 MarkUIResourceNotEvicted(uid); | 3397 MarkUIResourceNotEvicted(uid); |
| 3403 } | 3398 } |
| 3404 | 3399 |
| 3405 void LayerTreeHostImpl::DeleteUIResource(UIResourceId uid) { | 3400 void LayerTreeHostImpl::DeleteUIResource(UIResourceId uid) { |
| 3406 ResourceProvider::ResourceId id = ResourceIdForUIResource(uid); | 3401 ResourceProvider::ResourceId id = ResourceIdForUIResource(uid); |
| 3407 if (id) { | 3402 if (id) { |
| 3408 resource_provider_->DeleteResource(id); | 3403 resource_provider_->DeleteResource(id); |
| 3409 ui_resource_map_.erase(uid); | 3404 ui_resource_map_.erase(uid); |
| 3410 } | 3405 } |
| 3411 MarkUIResourceNotEvicted(uid); | 3406 MarkUIResourceNotEvicted(uid); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3475 (*it)->OnSetNeedsRedrawOnImpl(); | 3470 (*it)->OnSetNeedsRedrawOnImpl(); |
| 3476 } | 3471 } |
| 3477 | 3472 |
| 3478 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { | 3473 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { |
| 3479 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3474 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
| 3480 for (; it != swap_promise_monitor_.end(); it++) | 3475 for (; it != swap_promise_monitor_.end(); it++) |
| 3481 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); | 3476 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); |
| 3482 } | 3477 } |
| 3483 | 3478 |
| 3484 } // namespace cc | 3479 } // namespace cc |
| OLD | NEW |