| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
| 6 | 6 |
| 7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 } | 1334 } |
| 1335 | 1335 |
| 1336 // Accelerated Painting -------------------------------------------------------- | 1336 // Accelerated Painting -------------------------------------------------------- |
| 1337 | 1337 |
| 1338 void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { | 1338 void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { |
| 1339 // This method should not have the side-effect of creating the layer. | 1339 // This method should not have the side-effect of creating the layer. |
| 1340 if (layer()) | 1340 if (layer()) |
| 1341 layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely); | 1341 layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely); |
| 1342 } | 1342 } |
| 1343 | 1343 |
| 1344 bool View::SetExternalTexture(ui::Texture* texture) { | |
| 1345 DCHECK(texture); | |
| 1346 SetPaintToLayer(true); | |
| 1347 | |
| 1348 layer()->SetExternalTexture(texture); | |
| 1349 | |
| 1350 // Child views must not paint into the external texture. So make sure each | |
| 1351 // child view has its own layer to paint into. | |
| 1352 for (Views::iterator i = children_.begin(); i != children_.end(); ++i) | |
| 1353 (*i)->SetPaintToLayer(true); | |
| 1354 | |
| 1355 SchedulePaintInRect(GetLocalBounds()); | |
| 1356 return true; | |
| 1357 } | |
| 1358 | |
| 1359 gfx::Vector2d View::CalculateOffsetToAncestorWithLayer( | 1344 gfx::Vector2d View::CalculateOffsetToAncestorWithLayer( |
| 1360 ui::Layer** layer_parent) { | 1345 ui::Layer** layer_parent) { |
| 1361 if (layer()) { | 1346 if (layer()) { |
| 1362 if (layer_parent) | 1347 if (layer_parent) |
| 1363 *layer_parent = layer(); | 1348 *layer_parent = layer(); |
| 1364 return gfx::Vector2d(); | 1349 return gfx::Vector2d(); |
| 1365 } | 1350 } |
| 1366 if (!parent_) | 1351 if (!parent_) |
| 1367 return gfx::Vector2d(); | 1352 return gfx::Vector2d(); |
| 1368 | 1353 |
| (...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2297 // Message the RootView to do the drag and drop. That way if we're removed | 2282 // Message the RootView to do the drag and drop. That way if we're removed |
| 2298 // the RootView can detect it and avoid calling us back. | 2283 // the RootView can detect it and avoid calling us back. |
| 2299 gfx::Point widget_location(event.location()); | 2284 gfx::Point widget_location(event.location()); |
| 2300 ConvertPointToWidget(this, &widget_location); | 2285 ConvertPointToWidget(this, &widget_location); |
| 2301 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2286 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2302 // WARNING: we may have been deleted. | 2287 // WARNING: we may have been deleted. |
| 2303 return true; | 2288 return true; |
| 2304 } | 2289 } |
| 2305 | 2290 |
| 2306 } // namespace views | 2291 } // namespace views |
| OLD | NEW |