Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: gpu/demos/framework/pepper.cc

Issue 3531008: Integrated Pepper3D v2 with the accelerated compositor.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/scoped_ptr.h" 6 #include "base/scoped_ptr.h"
7 #include "gpu/demos/framework/demo.h" 7 #include "gpu/demos/framework/demo.h"
8 #include "gpu/demos/framework/demo_factory.h" 8 #include "gpu/demos/framework/demo_factory.h"
9 #include "ppapi/cpp/completion_callback.h" 9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/instance.h" 10 #include "ppapi/cpp/instance.h"
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 ~PluginInstance() { 30 ~PluginInstance() {
31 if (!graphics_.is_null()) { 31 if (!graphics_.is_null()) {
32 graphics_.MakeCurrent(); 32 graphics_.MakeCurrent();
33 demo_.reset(); 33 demo_.reset();
34 pp::Graphics3D_Dev::ResetCurrent(); 34 pp::Graphics3D_Dev::ResetCurrent();
35 } 35 }
36 } 36 }
37 37
38 virtual void ViewChanged(const pp::Rect& position, const pp::Rect& /*clip*/) { 38 virtual void DidChangeView(const pp::Rect& position,
39 if (size_.IsEmpty() && !position.IsEmpty()) { 39 const pp::Rect& /*clip*/) {
40 size_ = position.size(); 40 if (size_ == position.size())
41 demo_->InitWindowSize(size_.width(), size_.height()); 41 return;
42
43 size_ = position.size();
44 demo_->InitWindowSize(size_.width(), size_.height());
45
46 if (graphics_.is_null()) {
42 graphics_ = pp::Graphics3D_Dev(*this, 0, NULL, NULL); 47 graphics_ = pp::Graphics3D_Dev(*this, 0, NULL, NULL);
43 if (!graphics_.is_null()) { 48 if (graphics_.is_null())
44 graphics_.MakeCurrent(); 49 return;
45 demo_->InitGL();
46 pp::Graphics3D_Dev::ResetCurrent();
47 50
48 // TODO(neb): Remove this once the startup order bug (51842) is fixed. 51 if (!pp::Instance::BindGraphics(graphics_))
49 if (true) 52 return;
50 // if (demo_->IsAnimated()) 53
51 Animate(0); 54 graphics_.MakeCurrent();
52 else 55 demo_->InitGL();
53 Paint(); 56 pp::Graphics3D_Dev::ResetCurrent();
54 }
55 } 57 }
56 }
57 58
58 virtual void Graphics3DContextLost() { 59 if (demo_->IsAnimated())
59 // TODO(neb): Replace this with the correct code once 53889 is fixed. 60 Animate(0);
60 Paint(); 61 else
61 // pp::Rect fake_position(size_); 62 Paint();
62 // size_ = pp::Size();
63 // ViewChanged(fake_position, fake_position);
64 } 63 }
65 64
66 void Paint() { 65 void Paint() {
67 graphics_.MakeCurrent(); 66 graphics_.MakeCurrent();
68 demo_->Draw(); 67 demo_->Draw();
69 graphics_.SwapBuffers(); 68 graphics_.SwapBuffers();
70 pp::Graphics3D_Dev::ResetCurrent(); 69 pp::Graphics3D_Dev::ResetCurrent();
71 } 70 }
72 71
73 private: 72 private:
(...skipping 26 matching lines...) Expand all
100 } // namespace gpu 99 } // namespace gpu
101 100
102 namespace pp { 101 namespace pp {
103 102
104 Module* CreateModule() { 103 Module* CreateModule() {
105 return new gpu::demos::PluginModule(); 104 return new gpu::demos::PluginModule();
106 } 105 }
107 106
108 } // namespace pp 107 } // namespace pp
109 108
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698