OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/android/compositor/layer/thumbnail_layer.h" | 5 #include "chrome/browser/android/compositor/layer/thumbnail_layer.h" |
6 | 6 |
7 #include "cc/layers/layer_settings.h" | |
8 #include "cc/layers/ui_resource_layer.h" | 7 #include "cc/layers/ui_resource_layer.h" |
9 #include "chrome/browser/android/thumbnail/thumbnail.h" | 8 #include "chrome/browser/android/thumbnail/thumbnail.h" |
10 #include "content/public/browser/android/compositor.h" | 9 #include "content/public/browser/android/compositor.h" |
11 #include "ui/gfx/geometry/size_conversions.h" | 10 #include "ui/gfx/geometry/size_conversions.h" |
12 | 11 |
13 namespace chrome { | 12 namespace chrome { |
14 namespace android { | 13 namespace android { |
15 | 14 |
16 // static | 15 // static |
17 scoped_refptr<ThumbnailLayer> ThumbnailLayer::Create() { | 16 scoped_refptr<ThumbnailLayer> ThumbnailLayer::Create() { |
(...skipping 25 matching lines...) Expand all Loading... |
43 if (index >= parent->children().size()) | 42 if (index >= parent->children().size()) |
44 parent->AddChild(layer_); | 43 parent->AddChild(layer_); |
45 else if (parent->child_at(index)->id() != layer_->id()) | 44 else if (parent->child_at(index)->id() != layer_->id()) |
46 parent->ReplaceChild(parent->child_at(index), layer_); | 45 parent->ReplaceChild(parent->child_at(index), layer_); |
47 } | 46 } |
48 | 47 |
49 scoped_refptr<cc::Layer> ThumbnailLayer::layer() { | 48 scoped_refptr<cc::Layer> ThumbnailLayer::layer() { |
50 return layer_; | 49 return layer_; |
51 } | 50 } |
52 | 51 |
53 ThumbnailLayer::ThumbnailLayer() | 52 ThumbnailLayer::ThumbnailLayer() : layer_(cc::UIResourceLayer::Create()) { |
54 : layer_( | |
55 cc::UIResourceLayer::Create(cc::LayerSettings())) { | |
56 layer_->SetIsDrawable(true); | 53 layer_->SetIsDrawable(true); |
57 } | 54 } |
58 | 55 |
59 ThumbnailLayer::~ThumbnailLayer() { | 56 ThumbnailLayer::~ThumbnailLayer() { |
60 } | 57 } |
61 | 58 |
62 void ThumbnailLayer::UpdateSizes(const gfx::SizeF& content_size, | 59 void ThumbnailLayer::UpdateSizes(const gfx::SizeF& content_size, |
63 const gfx::SizeF& resource_size) { | 60 const gfx::SizeF& resource_size) { |
64 if (content_size != content_size_ || resource_size != resource_size_) { | 61 if (content_size != content_size_ || resource_size != resource_size_) { |
65 content_size_ = content_size; | 62 content_size_ = content_size; |
66 resource_size_ = resource_size; | 63 resource_size_ = resource_size; |
67 Clip(last_clipping_); | 64 Clip(last_clipping_); |
68 } | 65 } |
69 } | 66 } |
70 | 67 |
71 } // namespace android | 68 } // namespace android |
72 } // namespace chrome | 69 } // namespace chrome |
OLD | NEW |