summaryrefslogtreecommitdiffstats
path: root/o3d/core
diff options
context:
space:
mode:
authormilligan@google.com <milligan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-24 17:20:52 +0000
committermilligan@google.com <milligan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-24 17:20:52 +0000
commit06d226e82b3b1f54c22339bdc39ffe97294a3c6a (patch)
tree5638c823aa16a3488671376e2227bd5c11de5bb0 /o3d/core
parent1fac8c3b0aa869bee4a04b293f0585210b7ff682 (diff)
downloadchromium_src-06d226e82b3b1f54c22339bdc39ffe97294a3c6a.zip
chromium_src-06d226e82b3b1f54c22339bdc39ffe97294a3c6a.tar.gz
chromium_src-06d226e82b3b1f54c22339bdc39ffe97294a3c6a.tar.bz2
Remove FORCE_CAIRO flag and replace with a new feature.
The possible feature values are: RenderMode=Auto RenderMode=2D RenderMode=3D The default if no feature is specified is 3D for backwards compatibility. Review URL: http://codereview.chromium.org/6576007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75895 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r--o3d/core/cross/features.cc12
-rw-r--r--o3d/core/cross/features.h5
-rw-r--r--o3d/core/cross/renderer.h6
-rw-r--r--o3d/core/cross/renderer_test.cc4
4 files changed, 22 insertions, 5 deletions
diff --git a/o3d/core/cross/features.cc b/o3d/core/cross/features.cc
index 7feb248..308c331 100644
--- a/o3d/core/cross/features.cc
+++ b/o3d/core/cross/features.cc
@@ -49,7 +49,8 @@ Features::Features(ServiceLocator* service_locator)
windowless_(false),
not_anti_aliased_(false),
flip_textures_(true),
- init_status_(Renderer::SUCCESS) {
+ init_status_(Renderer::SUCCESS),
+ render_mode_(Renderer::RENDER_MODE_3D) {
// NOTE: For backward compatibility floating_point_textures and
// large_geometry default to true. o3djs.util.makeClients before 0.1.35.0
// does not set the o3d_features plugin parameters and therefore
@@ -98,6 +99,15 @@ void Features::ParseFeatures(const std::vector<std::string>& features,
int value;
StringToInt(arguments[0], &value);
init_status_ = static_cast<Renderer::InitStatus>(value);
+ } else if (feature.compare("RenderMode") == 0 &&
+ arguments.size() == 1) {
+ if (arguments[0].compare("Auto") == 0) {
+ render_mode_ = Renderer::RENDER_MODE_AUTO;
+ } else if (arguments[0].compare("3D") == 0) {
+ render_mode_ = Renderer::RENDER_MODE_3D;
+ } else if (arguments[0].compare("2D") == 0) {
+ render_mode_ = Renderer::RENDER_MODE_2D;
+ }
}
}
}
diff --git a/o3d/core/cross/features.h b/o3d/core/cross/features.h
index efd3266..7aed90b 100644
--- a/o3d/core/cross/features.h
+++ b/o3d/core/cross/features.h
@@ -82,6 +82,10 @@ class Features {
return init_status_;
}
+ Renderer::RenderModes render_modes() const {
+ return render_mode_;
+ }
+
private:
// Parses the features strings.
// Parameters:
@@ -99,6 +103,7 @@ class Features {
bool not_anti_aliased_;
bool flip_textures_;
Renderer::InitStatus init_status_;
+ Renderer::RenderModes render_mode_;
DISALLOW_COPY_AND_ASSIGN(Features);
};
diff --git a/o3d/core/cross/renderer.h b/o3d/core/cross/renderer.h
index f006fb5..311fb6d 100644
--- a/o3d/core/cross/renderer.h
+++ b/o3d/core/cross/renderer.h
@@ -112,6 +112,12 @@ class Renderer {
DISPLAY_MODE_DEFAULT = 0
};
+ enum RenderModes {
+ RENDER_MODE_AUTO,
+ RENDER_MODE_3D,
+ RENDER_MODE_2D,
+ };
+
// A StateHandler takes a param and sets or resets a render state.
class StateHandler {
public:
diff --git a/o3d/core/cross/renderer_test.cc b/o3d/core/cross/renderer_test.cc
index 6fa1efb..9eb0942 100644
--- a/o3d/core/cross/renderer_test.cc
+++ b/o3d/core/cross/renderer_test.cc
@@ -89,11 +89,9 @@ TEST_F(RendererTest, InitAndDestroyRenderer) {
RendererD3D9* d3d_renderer = down_cast<RendererD3D9*>(renderer.get());
EXPECT_TRUE(d3d_renderer->d3d_device() != NULL);
#elif defined(RENDERER_GL)
-#if !defined(FORCE_CAIRO)
// test that the Cg Context was correctly created
RendererGL* gl_renderer = down_cast<RendererGL*>(renderer.get());
EXPECT_TRUE(gl_renderer->cg_context() != NULL);
-#endif
#elif defined(RENDERER_GLES2)
RendererGLES2* gles2_renderer = down_cast<RendererGLES2*>(renderer.get());
#endif
@@ -104,10 +102,8 @@ TEST_F(RendererTest, InitAndDestroyRenderer) {
// check that the renderer no longer had the D3D device.
EXPECT_FALSE(d3d_renderer->d3d_device() != NULL);
#elif defined(RENDERER_GL)
-#if !defined(FORCE_CAIRO)
// check that the renderer no longer has a Cg Context.
EXPECT_FALSE(gl_renderer->cg_context() != NULL);
-#endif
#elif defined(RENDERER_GLES2)
#if defined(GLES2_BACKEND_DESKTOP_GL)
#if defined(OS_LINUX)