| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gfx/canvas_skia.h" | 9 #include "ui/gfx/canvas_skia.h" |
| 10 #include "ui/gfx/compositor/compositor_observer.h" | 10 #include "ui/gfx/compositor/compositor_observer.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 return layer; | 79 return layer; |
| 80 } | 80 } |
| 81 | 81 |
| 82 Layer* CreateNoTextureLayer(const gfx::Rect& bounds) { | 82 Layer* CreateNoTextureLayer(const gfx::Rect& bounds) { |
| 83 Layer* layer = CreateLayer(Layer::LAYER_HAS_NO_TEXTURE); | 83 Layer* layer = CreateLayer(Layer::LAYER_HAS_NO_TEXTURE); |
| 84 layer->SetBounds(bounds); | 84 layer->SetBounds(bounds); |
| 85 return layer; | 85 return layer; |
| 86 } | 86 } |
| 87 | 87 |
| 88 gfx::Canvas* CreateCanvasForLayer(const Layer* layer) { | 88 gfx::Canvas* CreateCanvasForLayer(const Layer* layer) { |
| 89 return gfx::Canvas::CreateCanvas(layer->bounds().width(), | 89 return gfx::Canvas::CreateCanvas(layer->bounds().size(), false); |
| 90 layer->bounds().height(), | |
| 91 false); | |
| 92 } | 90 } |
| 93 | 91 |
| 94 void DrawTree(Layer* root) { | 92 void DrawTree(Layer* root) { |
| 95 GetCompositor()->SetRootLayer(root); | 93 GetCompositor()->SetRootLayer(root); |
| 96 GetCompositor()->Draw(false); | 94 GetCompositor()->Draw(false); |
| 97 } | 95 } |
| 98 | 96 |
| 99 void RunPendingMessages() { | 97 void RunPendingMessages() { |
| 100 MessageLoopForUI::current()->RunAllPending(); | 98 MessageLoopForUI::current()->RunAllPending(); |
| 101 } | 99 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 return layer; | 258 return layer; |
| 261 } | 259 } |
| 262 | 260 |
| 263 virtual Layer* CreateNoTextureLayer(const gfx::Rect& bounds) { | 261 virtual Layer* CreateNoTextureLayer(const gfx::Rect& bounds) { |
| 264 Layer* layer = CreateLayer(Layer::LAYER_HAS_NO_TEXTURE); | 262 Layer* layer = CreateLayer(Layer::LAYER_HAS_NO_TEXTURE); |
| 265 layer->SetBounds(bounds); | 263 layer->SetBounds(bounds); |
| 266 return layer; | 264 return layer; |
| 267 } | 265 } |
| 268 | 266 |
| 269 gfx::Canvas* CreateCanvasForLayer(const Layer* layer) { | 267 gfx::Canvas* CreateCanvasForLayer(const Layer* layer) { |
| 270 return gfx::Canvas::CreateCanvas(layer->bounds().width(), | 268 return gfx::Canvas::CreateCanvas(layer->bounds().size(), false); |
| 271 layer->bounds().height(), | |
| 272 false); | |
| 273 } | 269 } |
| 274 | 270 |
| 275 void DrawTree(Layer* root) { | 271 void DrawTree(Layer* root) { |
| 276 compositor()->SetRootLayer(root); | 272 compositor()->SetRootLayer(root); |
| 277 compositor()->Draw(false); | 273 compositor()->Draw(false); |
| 278 } | 274 } |
| 279 | 275 |
| 280 // Invalidates the entire contents of the layer. | 276 // Invalidates the entire contents of the layer. |
| 281 void SchedulePaintForLayer(Layer* layer) { | 277 void SchedulePaintForLayer(Layer* layer) { |
| 282 layer->SchedulePaint( | 278 layer->SchedulePaint( |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 l1->SetVisible(true); | 896 l1->SetVisible(true); |
| 901 EXPECT_TRUE(l1->IsDrawn()); | 897 EXPECT_TRUE(l1->IsDrawn()); |
| 902 EXPECT_TRUE(l2->IsDrawn()); | 898 EXPECT_TRUE(l2->IsDrawn()); |
| 903 EXPECT_FALSE(l3->IsDrawn()); | 899 EXPECT_FALSE(l3->IsDrawn()); |
| 904 #if defined(USE_WEBKIT_COMPOSITOR) | 900 #if defined(USE_WEBKIT_COMPOSITOR) |
| 905 EXPECT_EQ(1.f, l1->web_layer().opacity()); | 901 EXPECT_EQ(1.f, l1->web_layer().opacity()); |
| 906 #endif | 902 #endif |
| 907 } | 903 } |
| 908 | 904 |
| 909 } // namespace ui | 905 } // namespace ui |
| OLD | NEW |