OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/gfx/compositor/layer.h" | 5 #include "ui/gfx/compositor/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 texture_draw_params.transform.ConcatTranslate( | 87 texture_draw_params.transform.ConcatTranslate( |
88 static_cast<float>(layer->bounds_.x()), | 88 static_cast<float>(layer->bounds_.x()), |
89 static_cast<float>(layer->bounds_.y())); | 89 static_cast<float>(layer->bounds_.y())); |
90 } | 90 } |
91 | 91 |
92 // Only blend for transparent child layers. | 92 // Only blend for transparent child layers. |
93 // The root layer will clobber the cleared bg. | 93 // The root layer will clobber the cleared bg. |
94 texture_draw_params.blend = parent_ != NULL && !fills_bounds_opaquely_; | 94 texture_draw_params.blend = parent_ != NULL && !fills_bounds_opaquely_; |
95 | 95 |
96 #if defined(OS_WIN) | 96 #if defined(OS_WIN) |
97 texture_->Draw(texture_draw_params); | 97 texture_->Draw(texture_draw_params, compositor_->size()); |
98 #else | 98 #else |
99 hole_rect_ = hole_rect_.Intersect( | 99 hole_rect_ = hole_rect_.Intersect( |
100 gfx::Rect(0, 0, bounds_.width(), bounds_.height())); | 100 gfx::Rect(0, 0, bounds_.width(), bounds_.height())); |
101 | 101 |
102 // top | 102 // top |
103 DrawRegion(texture_draw_params, gfx::Rect(0, | 103 DrawRegion(texture_draw_params, gfx::Rect(0, |
104 0, | 104 0, |
105 bounds_.width(), | 105 bounds_.width(), |
106 hole_rect_.y())); | 106 hole_rect_.y())); |
107 // left | 107 // left |
(...skipping 13 matching lines...) Expand all Loading... |
121 0, | 121 0, |
122 hole_rect_.bottom(), | 122 hole_rect_.bottom(), |
123 bounds_.width(), | 123 bounds_.width(), |
124 bounds_.height() - hole_rect_.bottom())); | 124 bounds_.height() - hole_rect_.bottom())); |
125 #endif | 125 #endif |
126 } | 126 } |
127 | 127 |
128 void Layer::DrawRegion(const ui::TextureDrawParams& params, | 128 void Layer::DrawRegion(const ui::TextureDrawParams& params, |
129 const gfx::Rect& region_to_draw) { | 129 const gfx::Rect& region_to_draw) { |
130 if (!region_to_draw.IsEmpty()) | 130 if (!region_to_draw.IsEmpty()) |
131 texture_->Draw(params, region_to_draw); | 131 texture_->Draw(params, region_to_draw, compositor_->size()); |
132 } | 132 } |
133 | 133 |
134 void Layer::RecomputeHole() { | 134 void Layer::RecomputeHole() { |
135 for (size_t i = 0; i < children_.size(); ++i) { | 135 for (size_t i = 0; i < children_.size(); ++i) { |
136 if (children_[i]->fills_bounds_opaquely() && | 136 if (children_[i]->fills_bounds_opaquely() && |
137 !children_[i]->transform().HasChange()) { | 137 !children_[i]->transform().HasChange()) { |
138 hole_rect_ = children_[i]->bounds(); | 138 hole_rect_ = children_[i]->bounds(); |
139 return; | 139 return; |
140 } | 140 } |
141 } | 141 } |
142 // no opaque child layers, set hole_rect_ to empty | 142 // no opaque child layers, set hole_rect_ to empty |
143 hole_rect_ = gfx::Rect(); | 143 hole_rect_ = gfx::Rect(); |
144 } | 144 } |
145 | 145 |
146 } // namespace ui | 146 } // namespace ui |
OLD | NEW |