OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/surface.h" | 5 #include "components/exo/surface.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 layer->SetTextureFlipped(false); | 874 layer->SetTextureFlipped(false); |
875 layer->SetTextureCrop(crop_); | 875 layer->SetTextureCrop(crop_); |
876 layer->SetTextureScale(static_cast<float>(texture_size_in_dip_.width()) / | 876 layer->SetTextureScale(static_cast<float>(texture_size_in_dip_.width()) / |
877 layer->bounds().width(), | 877 layer->bounds().width(), |
878 static_cast<float>(texture_size_in_dip_.height()) / | 878 static_cast<float>(texture_size_in_dip_.height()) / |
879 layer->bounds().height()); | 879 layer->bounds().height()); |
880 layer->SetTextureAlpha(alpha_); | 880 layer->SetTextureAlpha(alpha_); |
881 } | 881 } |
882 | 882 |
883 void Surface::SetSurfaceLayerContents(ui::Layer* layer) { | 883 void Surface::SetSurfaceLayerContents(ui::Layer* layer) { |
884 // TODO(jbauman): Implement this. | 884 if (surface_id_.is_null()) |
885 NOTIMPLEMENTED(); | 885 return; |
| 886 |
| 887 gfx::Size layer_size = layer->bounds().size(); |
| 888 float contents_surface_to_layer_scale = 1.0f; |
| 889 |
| 890 layer->SetShowSurface( |
| 891 surface_id_, |
| 892 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)), |
| 893 base::Bind(&RequireCallback, base::Unretained(surface_manager_)), |
| 894 layer_size, contents_surface_to_layer_scale, layer_size); |
886 } | 895 } |
887 | 896 |
888 bool Surface::use_surface_layer_ = false; | 897 bool Surface::use_surface_layer_ = false; |
889 | 898 |
890 } // namespace exo | 899 } // namespace exo |
OLD | NEW |