From 6c8577f2d7ee2c6aebdb3c3c689a7242ee0f167d Mon Sep 17 00:00:00 2001 From: "fransiskusx@google.com" Date: Fri, 17 Sep 2010 17:16:19 +0000 Subject: Further integration of 2D mode. This change supports calltype=v, transparancy, and image transformation. Currently only support Linux and compiled when renderer = cairo. TEST= I compiled with renderer = cairo and it worked. Also I compiled with renderer = gl and it worked. BUG=none Review URL: http://codereview.chromium.org/3315023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59811 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/converter/cross/converter.cc | 5 ++ o3d/converter/cross/renderer_stub.cc | 3 + o3d/core/core.gyp | 2 + o3d/core/cross/cairo/layer.cc | 69 +++++++++++++++++ o3d/core/cross/cairo/layer.h | 137 +++++++++++++++++++++++++++++++++ o3d/core/cross/cairo/renderer_cairo.cc | 125 ++++++++++++++++++++++-------- o3d/core/cross/cairo/renderer_cairo.h | 44 +++++++---- o3d/core/cross/cairo/texture_cairo.cc | 19 +++-- o3d/core/cross/cairo/texture_cairo.h | 44 ++++++++++- o3d/core/cross/class_manager.cc | 6 ++ o3d/core/cross/renderer.h | 4 +- o3d/plugin/idl/idl.gyp | 9 +++ o3d/plugin/idl/layer.idl | 74 ++++++++++++++++++ 13 files changed, 484 insertions(+), 57 deletions(-) create mode 100644 o3d/core/cross/cairo/layer.cc create mode 100644 o3d/core/cross/cairo/layer.h create mode 100644 o3d/plugin/idl/layer.idl diff --git a/o3d/converter/cross/converter.cc b/o3d/converter/cross/converter.cc index 4726392..63e52a1 100644 --- a/o3d/converter/cross/converter.cc +++ b/o3d/converter/cross/converter.cc @@ -37,6 +37,7 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/scoped_ptr.h" +#include "converter/cross/renderer_stub.h" #include "core/cross/class_manager.h" #include "core/cross/client.h" #include "core/cross/client_info.h" @@ -279,7 +280,11 @@ bool Convert(const FilePath& in_filename, ErrorCollector error_collector(&service_locator); scoped_ptr renderer( +#if !defined(RENDERER_CAIRO) Renderer::CreateDefaultRenderer(&service_locator)); +#else + RendererStub::CreateDefault(&service_locator)); +#endif renderer->InitCommon(); Pack::Ref pack(object_manager.CreatePack()); diff --git a/o3d/converter/cross/renderer_stub.cc b/o3d/converter/cross/renderer_stub.cc index ba0ffd8..c7c9f4c 100644 --- a/o3d/converter/cross/renderer_stub.cc +++ b/o3d/converter/cross/renderer_stub.cc @@ -211,10 +211,13 @@ const int* RendererStub::GetRGBAUByteNSwizzleTable() { return swizzle_table; } +// TODO(fransiskusx): This violates the One Definition Rule. +#if !defined(RENDERER_CAIRO) // This is a factory function for creating Renderer objects. Since // we're implementing a stub renderer, we only ever return a stub renderer. Renderer* Renderer::CreateDefaultRenderer(ServiceLocator* service_locator) { return RendererStub::CreateDefault(service_locator); } +#endif } // namespace o3d diff --git a/o3d/core/core.gyp b/o3d/core/core.gyp index c071611..ad64ada 100644 --- a/o3d/core/core.gyp +++ b/o3d/core/core.gyp @@ -474,6 +474,8 @@ { 'sources': [ 'cross/cairo/install_check.cc', + 'cross/cairo/layer.cc', + 'cross/cairo/layer.h', 'cross/cairo/renderer_cairo.cc', 'cross/cairo/renderer_cairo.h', 'cross/cairo/texture_cairo.cc', diff --git a/o3d/core/cross/cairo/layer.cc b/o3d/core/cross/cairo/layer.cc new file mode 100644 index 0000000..e64bd03 --- /dev/null +++ b/o3d/core/cross/cairo/layer.cc @@ -0,0 +1,69 @@ +/* + * Copyright 2010, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include "core/cross/cairo/layer.h" +#include "core/cross/error.h" +#include "core/cross/renderer.h" +#include "core/cross/cairo/renderer_cairo.h" +#include "core/cross/cairo/texture_cairo.h" + +namespace o3d { + +namespace o2d { + +O3D_DEFN_CLASS(Layer, ParamObject); + +Layer::Layer(ServiceLocator* service_locator) + : ParamObject(service_locator), texture_(NULL), + weak_pointer_manager_(this), alpha_(0), scale_x_(0), scale_y_(0), + translate_x_(0), translate_y_(0) { + DLOG(INFO) << "Create Layer"; +} + +ObjectBase::Ref Layer::Create(ServiceLocator* service_locator) { + Renderer* renderer = service_locator->GetService(); + if (NULL == renderer) { + O3D_ERROR(service_locator) << "No Render Device Available"; + return ObjectBase::Ref(); + } + + Layer* image = new Layer(service_locator); + + RendererCairo* renderer2d = down_cast(renderer); + renderer2d->AddLayer(image); + + return ObjectBase::Ref(image); +} + +} // namespace o2d + +} // namespace o3d diff --git a/o3d/core/cross/cairo/layer.h b/o3d/core/cross/cairo/layer.h new file mode 100644 index 0000000..dbe7738 --- /dev/null +++ b/o3d/core/cross/cairo/layer.h @@ -0,0 +1,137 @@ +/* + * Copyright 2010, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// An alternative class of Transform for 2d Image Rendering Mode. + +#ifndef O3D_CORE_CROSS_CAIRO_LAYER_H_ +#define O3D_CORE_CROSS_CAIRO_LAYER_H_ + +#include +#include "core/cross/bounding_box.h" +#include "core/cross/param.h" +#include "core/cross/param_cache.h" +#include "core/cross/param_object.h" +#include "core/cross/types.h" +#include "core/cross/cairo/texture_cairo.h" + +namespace o3d { + +namespace o2d { + +class Layer : public ParamObject { + friend class Client; + public: + typedef WeakPointer WeakPointerType; + + // Set the corresponding texture for this Layer instance. + void SetTexture(Texture* texture) { + texture_ = down_cast(texture); + } + + TextureCairo* GetTexture() { + return texture_; + } + + float GetAlpha() { + return alpha_; + } + + float GetScaleX() { + return scale_x_; + } + + float GetScaleY() { + return scale_y_; + } + + int GetTranslateX() { + return translate_x_; + } + + int GetTranslateY() { + return translate_y_; + } + + // Set the transparency of the Layer. + void SetAlpha(float alpha) { alpha_ = alpha; } + + // Translate the given x,y from its origin. + void Translate(float x, float y) { + translate_x_ = x; + translate_y_ = y; + } + + // Scale the image to the given x,y. + void Scale(float x, float y) { + scale_x_ = x; + scale_y_ = y; + } + + // Gets a weak pointer to us. + WeakPointerType GetWeakPointer() const { + return weak_pointer_manager_.GetWeakPointer(); + } + + private: + explicit Layer(ServiceLocator* service_locator); + + friend class o3d::IClassManager; + static ObjectBase::Ref Create(ServiceLocator* service_locator); + + // Texture Container. + TextureCairo* texture_; + + // Manager for weak pointers to us. + WeakPointerType::WeakPointerManager weak_pointer_manager_; + + // Transparancy of the scene. + float alpha_; + + // The end-x-size of which the current size needs to scale. + float scale_x_; + + // The end-y-size of which the current size needs to scale. + float scale_y_; + + // Size of x to translate. + float translate_x_; + + // Size of y to translate. + float translate_y_; + + O3D_DECL_CLASS(Layer, ParamObject) +}; // Layer + +} // namespace o2d + +} // namespace o3d + +#endif // O3D_CORE_CROSS_CAIRO_LAYER_H_ diff --git a/o3d/core/cross/cairo/renderer_cairo.cc b/o3d/core/cross/cairo/renderer_cairo.cc index 4221e0d..ef70d79 100644 --- a/o3d/core/cross/cairo/renderer_cairo.cc +++ b/o3d/core/cross/cairo/renderer_cairo.cc @@ -36,18 +36,19 @@ #include #include #include +#include "core/cross/cairo/layer.h" #include "core/cross/cairo/texture_cairo.h" namespace o3d { Renderer* Renderer::CreateDefaultRenderer(ServiceLocator* service_locator) { - return RendererCairo::CreateDefault(service_locator); + return o2d::RendererCairo::CreateDefault(service_locator); } +namespace o2d { + RendererCairo::RendererCairo(ServiceLocator* service_locator) - : Renderer(service_locator), display_(NULL), window_(0), - main_surface_(NULL), frame_src_data_(NULL), frame_src_width_(0), - frame_src_height_(0), frame_src_pitch_(0) { + : Renderer(service_locator), display_(NULL), main_surface_(NULL) { // Don't need to do anything. } @@ -69,19 +70,6 @@ void RendererCairo::Destroy() { } display_ = NULL; - frame_src_data_ = NULL; -} - -void RendererCairo::SetNewFrame(const void* src_data, unsigned src_width, - unsigned src_height, int src_pitch) { - DLOG(INFO) << "To Set New Frame"; - if (src_data == NULL) - return; - - frame_src_data_ = src_data; - frame_src_width_ = src_width; - frame_src_height_ = src_height; - frame_src_pitch_ = src_pitch; } // TODO(fransiskusx): Need to check if the shared memory data has been @@ -89,35 +77,93 @@ void RendererCairo::SetNewFrame(const void* src_data, unsigned src_width, // shared memory data to render the frame. void RendererCairo::Paint() { DLOG(INFO) << "To paint"; + cairo_t* current_drawing = cairo_create(main_surface_); + + // Paint the background. + PaintBackground(current_drawing); + + // Core process of painting. + for (LayerRefList::iterator i = layer_list_.begin(); + i != layer_list_.end(); i++) { + // Put the state with no mask to the stack. + cairo_save(current_drawing); + + // Preparing and updating the Layer. + Layer* cur = *i; + TextureCairo* cur_texture = cur->GetTexture(); + + // Check if the pointer to data is null. + if (cur_texture->GetData() == NULL) { + continue; + } - if (frame_src_data_ != NULL) { - DLOG(INFO) << "To paint new drawing"; + // Masking areas for other scene. + LayerRefList::iterator start_mask_it = i; + start_mask_it++; + MaskArea(current_drawing, start_mask_it); - // Preparing the image to render + // Preparing the image to render. cairo_surface_t* image = cairo_image_surface_create_for_data( const_cast( - static_cast(frame_src_data_)), - CAIRO_FORMAT_ARGB32, frame_src_width_, - frame_src_height_, frame_src_pitch_); - cairo_t* current_drawing = cairo_create(main_surface_); + static_cast(cur_texture->GetData())), + CAIRO_FORMAT_ARGB32, cur_texture->GetWidth(), + cur_texture->GetHeight(), cur_texture->GetPitch()); - // Scaling the image + // Scale the image. double width_scaling = - (static_cast(display_width())) / frame_src_width_; + (static_cast(cur->GetScaleX())) / cur_texture->GetWidth(); double height_scaling = - (static_cast(display_height())) / frame_src_height_; + (static_cast(cur->GetScaleY())) / cur_texture->GetHeight(); + cairo_scale(current_drawing, width_scaling, height_scaling); - // Painting the image to the surface - cairo_set_source_surface(current_drawing, image, 0, 0); - cairo_paint(current_drawing); + // Painting the image to the surface. + cairo_set_source_surface(current_drawing, image, + cur->GetTranslateX() / width_scaling, + cur->GetTranslateY() / height_scaling); + + cairo_paint_with_alpha(current_drawing, cur->GetAlpha()); - // Cleaning up the memory - cairo_destroy(current_drawing); + // Cleaning up the memory. cairo_surface_destroy(image); + + // Restore to the state with no mask. + cairo_restore(current_drawing); + } + cairo_destroy(current_drawing); +} + +void RendererCairo::PaintBackground(cairo_t* cr) { + cairo_save(cr); + MaskArea(cr, layer_list_.begin()); + + cairo_rectangle(cr, 0, 0, display_width(), display_height()); + cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); + cairo_fill(cr); + cairo_restore(cr); +} + +void RendererCairo::MaskArea(cairo_t* cr, LayerRefList::iterator it) { + cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD); + + for (LayerRefList::iterator i = it; i != layer_list_.end(); i++) { + // Preparing and updating the Layer. + Layer* cur_mask = *i; + + cairo_rectangle(cr, 0, 0, display_width(), display_height()); + cairo_rectangle(cr, + cur_mask->GetTranslateX(), + cur_mask->GetTranslateY(), + static_cast(cur_mask->GetScaleX()), + static_cast(cur_mask->GetScaleY())); + cairo_clip(cr); } } +void RendererCairo::AddLayer(Layer* image) { + layer_list_.push_front(image); +} + void RendererCairo::InitCommon() { main_surface_ = cairo_xlib_surface_create(display_, window_, XDefaultVisual(display_, 0), @@ -144,7 +190,7 @@ void RendererCairo::Resize(int width, int height) { DLOG(INFO) << "To Resize " << width << " x " << height; SetClientSize(width, height); - // Resize the mainSurface + // Resize the mainSurface and buffer cairo_xlib_surface_set_size(main_surface_, width, height); } @@ -189,6 +235,12 @@ void RendererCairo::PlatformSpecificPresent() { } // TODO(fransiskusx): DO need to implement before shipped. +// Removes the Layer from the array. +void RendererCairo::RemoveLayer(Layer* image) { + NOTIMPLEMENTED(); +} + +// TODO(fransiskusx): DO need to implement before shipped. // Get a single fullscreen display mode by id. // Returns true on success, false on error. bool RendererCairo::GetDisplayMode(int id, DisplayMode* mode) { @@ -381,5 +433,10 @@ void RendererCairo::SetState(Renderer* renderer, Param* param) { NOTIMPLEMENTED(); } -} // namespace o3d +void RendererCairo::PopRenderStates() { + NOTIMPLEMENTED(); +} + +} // namespace o2d +} // namespace o3d diff --git a/o3d/core/cross/cairo/renderer_cairo.h b/o3d/core/cross/cairo/renderer_cairo.h index 0ecdad0..4452bc4f 100644 --- a/o3d/core/cross/cairo/renderer_cairo.h +++ b/o3d/core/cross/cairo/renderer_cairo.h @@ -36,12 +36,17 @@ #include #include +#include #include #include "core/cross/renderer_platform.h" #include "core/cross/renderer.h" namespace o3d { +namespace o2d { + +class Layer; + class RendererCairo : public Renderer { public: static RendererCairo* CreateDefault(ServiceLocator* service_locator); @@ -60,13 +65,15 @@ class RendererCairo : public Renderer { // Released all hardware resources. virtual void Destroy(); - // set the image surface used to render images to the main surface. - void SetNewFrame(const void* src_data, unsigned src_width, - unsigned src_height, int src_pitch); - // Paint the frame to the main view void Paint(); + // Insert the given Layer to the back of the array. + void AddLayer(Layer* image); + + // Remove the given Layer from the array. + void RemoveLayer(Layer* image); + // Handles the plugin resize event. virtual void Resize(int width, int height); @@ -138,9 +145,15 @@ class RendererCairo : public Renderer { // current platform. virtual const int* GetRGBAUByteNSwizzleTable(); + // Overriden from Renderer void PushRenderStates(State* state); + // Overrider from Renderer + void PopRenderStates(); + protected: + typedef std::list LayerRefList; + // Keep the constructor protected so only factory methods can create // renderers. explicit RendererCairo(ServiceLocator* service_locator); @@ -205,6 +218,13 @@ class RendererCairo : public Renderer { float min_z, float max_z); + // Mask the area of the current layer that will collide with other images. + void MaskArea(cairo_t* cr, LayerRefList::iterator it); + + // Paint the background with black color. + // TODO(fransiskusx): Support changing the background color. + void PaintBackground(cairo_t* cr); + // Linux Client Display Display* display_; // Linux Client Window @@ -213,17 +233,15 @@ class RendererCairo : public Renderer { // Main surface to render cairo cairo_surface_t* main_surface_; - // Current Frame Data Source - const void* frame_src_data_; - // Current Frame Source Width - unsigned frame_src_width_; - // Current Frame Source Height - unsigned frame_src_height_; - // Current Frame Source Pitch - int frame_src_pitch_; + // Draw the background + cairo_t* bg_drawing_; + + // Array of Layer + LayerRefList layer_list_; }; +} // namespace o2d + } // namespace o3d #endif // O3D_CORE_CROSS_CAIRO_RENDERER_CAIRO_H_ - diff --git a/o3d/core/cross/cairo/texture_cairo.cc b/o3d/core/cross/cairo/texture_cairo.cc index 1fbe076..d179a10 100644 --- a/o3d/core/cross/cairo/texture_cairo.cc +++ b/o3d/core/cross/cairo/texture_cairo.cc @@ -44,6 +44,8 @@ Texture::RGBASwizzleIndices g_gl_abgr32f_swizzle_indices = {0, 1, 2, 3}; } // anonymous namespace. +namespace o2d { + TextureCairo::TextureCairo(ServiceLocator* service_locator, Texture::Format format, int levels, @@ -57,7 +59,8 @@ TextureCairo::TextureCairo(ServiceLocator* service_locator, levels, enable_render_surfaces), renderer_(static_cast( - service_locator->GetService())) { + service_locator->GetService())), + data_(NULL), left_(0), top_(0), width_(0), height_(0), pitch_(0) { DLOG(INFO) << "Texture2D Construct"; DCHECK_NE(format, Texture::UNKNOWN_FORMAT); } @@ -69,7 +72,6 @@ TextureCairo* TextureCairo::Create(ServiceLocator* service_locator, int width, int height, bool enable_render_surfaces) { - DLOG(INFO) << "Texture2DCairo Create"; TextureCairo* texture = new TextureCairo(service_locator, format, levels, @@ -86,6 +88,7 @@ const Texture::RGBASwizzleIndices& TextureCairo::GetABGR32FSwizzleIndices() { } TextureCairo::~TextureCairo() { + renderer_ = NULL; DLOG(INFO) << "Texture2DCairo Destruct"; } @@ -99,9 +102,12 @@ void TextureCairo::SetRect(int level, int src_pitch) { DLOG(INFO) << "Texture2DCairo SetRect"; - renderer_->SetNewFrame(src_data, - src_width, src_height, - src_pitch); + data_ = src_data; + left_ = dst_left; + top_ = dst_top; + width_ = src_width; + height_ = src_height; + pitch_ = src_pitch; } // Locks the given mipmap level of this texture for loading from main memory, @@ -135,5 +141,6 @@ void* TextureCairo::GetTextureHandle() const { return reinterpret_cast(NULL); } -} // namespace o3d +} // namespace o2d +} // namespace o3d diff --git a/o3d/core/cross/cairo/texture_cairo.h b/o3d/core/cross/cairo/texture_cairo.h index 5ba4685..217c9db 100644 --- a/o3d/core/cross/cairo/texture_cairo.h +++ b/o3d/core/cross/cairo/texture_cairo.h @@ -40,6 +40,8 @@ namespace o3d { +namespace o2d { + class RendererCairo; // Texture2DCairo implements the Texture2D interface. @@ -72,6 +74,30 @@ class TextureCairo : public Texture2D { // RGBA to the internal format used by the rendering API. virtual const RGBASwizzleIndices& GetABGR32FSwizzleIndices(); + const void* GetData() { + return data_; + } + + unsigned GetOriginX() { + return left_; + } + + unsigned GetOriginY() { + return top_; + } + + unsigned GetWidth() { + return width_; + } + + unsigned GetHeight() { + return height_; + } + + int GetPitch() { + return pitch_; + } + protected: // Overridden from Texture2D virtual bool PlatformSpecificLock(int level, void** texture_data, int* pitch, @@ -86,9 +112,22 @@ class TextureCairo : public Texture2D { // Returns the implementation-specific texture handle for this texture. virtual void* GetTextureHandle() const; - // The 2d renderer object to be used by client + // The 2d renderer object to be used by client. RendererCairo* renderer_; + // Current Frame Data Source + const void* data_; + // X coordinate + unsigned left_; + // Y coordinate + unsigned top_; + // Current Frame Source Width + unsigned width_; + // Current Frame Source Height + unsigned height_; + // Current Frame Source Pitch + int pitch_; + private: // Initializes the Texture2D. TextureCairo(ServiceLocator* service_locator, @@ -99,7 +138,8 @@ class TextureCairo : public Texture2D { bool enable_render_surfaces); }; +} // namespace o2d + } // namespace o3d #endif // O3D_CORE_CROSS_CAIRO_TEXTURE_CAIRO_H_ - diff --git a/o3d/core/cross/class_manager.cc b/o3d/core/cross/class_manager.cc index 1a3b909..bb51ae4 100644 --- a/o3d/core/cross/class_manager.cc +++ b/o3d/core/cross/class_manager.cc @@ -66,6 +66,7 @@ #include "core/cross/transform.h" #include "core/cross/tree_traversal.h" #include "core/cross/viewport.h" +#include "core/cross/cairo/layer.h" namespace o3d { @@ -178,6 +179,11 @@ ClassManager::ClassManager(ServiceLocator* service_locator) AddTypedClass(); AddTypedClass(); AddTypedClass(); + + // Specific Objects for Cairo +#if defined(RENDERER_CAIRO) + AddTypedClass(); +#endif } void ClassManager::AddClass(const ObjectBase::Class* object_class, diff --git a/o3d/core/cross/renderer.h b/o3d/core/cross/renderer.h index 3be95f4..7a35415 100644 --- a/o3d/core/cross/renderer.h +++ b/o3d/core/cross/renderer.h @@ -298,10 +298,10 @@ class Renderer { ParamCache* param_cache); // Pushes rendering states. - void PushRenderStates(State *state); + virtual void PushRenderStates(State *state); // Pops rendering states to back to their previous settings. - void PopRenderStates(); + virtual void PopRenderStates(); // Binds the passed surfaces to the color and depth buffers of the // renderer. diff --git a/o3d/plugin/idl/idl.gyp b/o3d/plugin/idl/idl.gyp index a6eb6c3..1a16027 100644 --- a/o3d/plugin/idl/idl.gyp +++ b/o3d/plugin/idl/idl.gyp @@ -13,6 +13,15 @@ 'idl_files': [ '