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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "mojo/public/cpp/application/application.h" | 7 #include "mojo/public/cpp/application/application.h" |
8 #include "mojo/public/cpp/environment/environment.h" | 8 #include "mojo/public/cpp/environment/environment.h" |
9 #include "mojo/public/cpp/system/core.h" | 9 #include "mojo/public/cpp/system/core.h" |
10 #include "mojo/public/cpp/system/macros.h" | 10 #include "mojo/public/cpp/system/macros.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 view_manager::ViewTreeNode* node11 = | 29 view_manager::ViewTreeNode* node11 = |
30 view_manager::ViewTreeNode::Create(view_manager_.get()); | 30 view_manager::ViewTreeNode::Create(view_manager_.get()); |
31 node11->SetBounds(gfx::Rect(800, 600)); | 31 node11->SetBounds(gfx::Rect(800, 600)); |
32 | 32 |
33 view_manager::View* view11 = | 33 view_manager::View* view11 = |
34 view_manager::View::Create(view_manager_.get()); | 34 view_manager::View::Create(view_manager_.get()); |
35 node11->SetActiveView(view11); | 35 node11->SetActiveView(view11); |
36 view_manager_->tree()->AddChild(node1); | 36 view_manager_->tree()->AddChild(node1); |
37 node1->AddChild(node11); | 37 node1->AddChild(node11); |
38 | 38 |
39 gfx::Canvas canvas(gfx::Size(800, 600), 1.0f, true); | 39 view11->SetColor(SK_ColorRED); |
40 canvas.DrawColor(SK_ColorRED); | |
41 view11->SetContents( | |
42 skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(true)); | |
43 } | 40 } |
44 | 41 |
45 private: | 42 private: |
46 // SampleApp creates a ViewManager and a trivial node hierarchy. | 43 // SampleApp creates a ViewManager and a trivial node hierarchy. |
47 scoped_ptr<view_manager::ViewManager> view_manager_; | 44 scoped_ptr<view_manager::ViewManager> view_manager_; |
48 | 45 |
49 DISALLOW_COPY_AND_ASSIGN(SampleApp); | 46 DISALLOW_COPY_AND_ASSIGN(SampleApp); |
50 }; | 47 }; |
51 | 48 |
52 } // namespace examples | 49 } // namespace examples |
53 | 50 |
54 // static | 51 // static |
55 Application* Application::Create() { | 52 Application* Application::Create() { |
56 return new examples::SampleApp(); | 53 return new examples::SampleApp(); |
57 } | 54 } |
58 | 55 |
59 } // namespace mojo | 56 } // namespace mojo |
OLD | NEW |