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 3286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3297 switch (bitmap.GetFormat()) { | 3297 switch (bitmap.GetFormat()) { |
3298 case UIResourceBitmap::RGBA8: | 3298 case UIResourceBitmap::RGBA8: |
3299 break; | 3299 break; |
3300 case UIResourceBitmap::ALPHA_8: | 3300 case UIResourceBitmap::ALPHA_8: |
3301 format = ALPHA_8; | 3301 format = ALPHA_8; |
3302 break; | 3302 break; |
3303 case UIResourceBitmap::ETC1: | 3303 case UIResourceBitmap::ETC1: |
3304 format = ETC1; | 3304 format = ETC1; |
3305 break; | 3305 break; |
3306 } | 3306 } |
3307 id = resource_provider_->CreateResource( | 3307 id = |
3308 bitmap.GetSize(), | 3308 resource_provider_->CreateResource(bitmap.GetSize(), |
3309 wrap_mode, | 3309 wrap_mode, |
3310 ResourceProvider::TextureUsageAny, | 3310 ResourceProvider::TextureHintImmutable, |
3311 format); | 3311 format); |
3312 | 3312 |
3313 UIResourceData data; | 3313 UIResourceData data; |
3314 data.resource_id = id; | 3314 data.resource_id = id; |
3315 data.size = bitmap.GetSize(); | 3315 data.size = bitmap.GetSize(); |
3316 data.opaque = bitmap.GetOpaque(); | 3316 data.opaque = bitmap.GetOpaque(); |
3317 | 3317 |
3318 ui_resource_map_[uid] = data; | 3318 ui_resource_map_[uid] = data; |
3319 | 3319 |
3320 AutoLockUIResourceBitmap bitmap_lock(bitmap); | 3320 AutoLockUIResourceBitmap bitmap_lock(bitmap); |
3321 resource_provider_->SetPixels(id, | 3321 resource_provider_->SetPixels(id, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3412 } | 3412 } |
3413 | 3413 |
3414 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3414 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3415 std::vector<PictureLayerImpl*>::iterator it = | 3415 std::vector<PictureLayerImpl*>::iterator it = |
3416 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3416 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3417 DCHECK(it != picture_layers_.end()); | 3417 DCHECK(it != picture_layers_.end()); |
3418 picture_layers_.erase(it); | 3418 picture_layers_.erase(it); |
3419 } | 3419 } |
3420 | 3420 |
3421 } // namespace cc | 3421 } // namespace cc |
OLD | NEW |