Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 41903003: cc: Fix incomplete changes to add ETC1 support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased and moved pixel ref class to public cc Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 paint_time_counter_->ClearHistory(); 2727 paint_time_counter_->ClearHistory();
2728 2728
2729 debug_state_ = new_debug_state; 2729 debug_state_ = new_debug_state;
2730 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); 2730 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
2731 SetFullRootLayerDamage(); 2731 SetFullRootLayerDamage();
2732 } 2732 }
2733 2733
2734 void LayerTreeHostImpl::CreateUIResource(UIResourceId uid, 2734 void LayerTreeHostImpl::CreateUIResource(UIResourceId uid,
2735 const UIResourceBitmap& bitmap) { 2735 const UIResourceBitmap& bitmap) {
2736 DCHECK_GT(uid, 0); 2736 DCHECK_GT(uid, 0);
2737 DCHECK_EQ(bitmap.GetFormat(), UIResourceBitmap::RGBA8);
2738 2737
2739 GLint wrap_mode = 0; 2738 GLint wrap_mode = 0;
2740 switch (bitmap.GetWrapMode()) { 2739 switch (bitmap.GetWrapMode()) {
2741 case UIResourceBitmap::CLAMP_TO_EDGE: 2740 case UIResourceBitmap::CLAMP_TO_EDGE:
2742 wrap_mode = GL_CLAMP_TO_EDGE; 2741 wrap_mode = GL_CLAMP_TO_EDGE;
2743 break; 2742 break;
2744 case UIResourceBitmap::REPEAT: 2743 case UIResourceBitmap::REPEAT:
2745 wrap_mode = GL_REPEAT; 2744 wrap_mode = GL_REPEAT;
2746 break; 2745 break;
2747 } 2746 }
2748 2747
2749 // Allow for multiple creation requests with the same UIResourceId. The 2748 // Allow for multiple creation requests with the same UIResourceId. The
2750 // previous resource is simply deleted. 2749 // previous resource is simply deleted.
2751 ResourceProvider::ResourceId id = ResourceIdForUIResource(uid); 2750 ResourceProvider::ResourceId id = ResourceIdForUIResource(uid);
2752 if (id) 2751 if (id)
2753 DeleteUIResource(uid); 2752 DeleteUIResource(uid);
2753
2754 ResourceFormat format = resource_provider_->best_texture_format();
2755 if (bitmap.GetFormat() == UIResourceBitmap::ETC1)
2756 format = ETC1;
2754 id = resource_provider_->CreateResource( 2757 id = resource_provider_->CreateResource(
2755 bitmap.GetSize(), 2758 bitmap.GetSize(),
2756 wrap_mode, 2759 wrap_mode,
2757 ResourceProvider::TextureUsageAny, 2760 ResourceProvider::TextureUsageAny,
2758 resource_provider_->best_texture_format()); 2761 format);
2759 2762
2760 UIResourceData data; 2763 UIResourceData data;
2761 data.resource_id = id; 2764 data.resource_id = id;
2762 data.size = bitmap.GetSize(); 2765 data.size = bitmap.GetSize();
2763 data.opaque = bitmap.GetOpaque(); 2766 data.opaque = bitmap.GetOpaque();
2764 2767
2765 ui_resource_map_[uid] = data; 2768 ui_resource_map_[uid] = data;
2766 2769
2767 AutoLockUIResourceBitmap bitmap_lock(bitmap); 2770 AutoLockUIResourceBitmap bitmap_lock(bitmap);
2768 resource_provider_->SetPixels(id, 2771 resource_provider_->SetPixels(id,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2821 std::set<UIResourceId>::iterator found_in_evicted = 2824 std::set<UIResourceId>::iterator found_in_evicted =
2822 evicted_ui_resources_.find(uid); 2825 evicted_ui_resources_.find(uid);
2823 if (found_in_evicted == evicted_ui_resources_.end()) 2826 if (found_in_evicted == evicted_ui_resources_.end())
2824 return; 2827 return;
2825 evicted_ui_resources_.erase(found_in_evicted); 2828 evicted_ui_resources_.erase(found_in_evicted);
2826 if (evicted_ui_resources_.empty()) 2829 if (evicted_ui_resources_.empty())
2827 client_->OnCanDrawStateChanged(CanDraw()); 2830 client_->OnCanDrawStateChanged(CanDraw());
2828 } 2831 }
2829 2832
2830 } // namespace cc 2833 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698