diff options
author | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-09 20:20:38 +0000 |
---|---|---|
committer | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-09 20:20:38 +0000 |
commit | f5d8e157ff32700d247e2422dc8b2b0631e63105 (patch) | |
tree | d9134f7a0735a0eafc8c6a46e892de303bf5d407 /o3d | |
parent | 642a6989c4454627a22225a81080c4fcdee986df (diff) | |
download | chromium_src-f5d8e157ff32700d247e2422dc8b2b0631e63105.zip chromium_src-f5d8e157ff32700d247e2422dc8b2b0631e63105.tar.gz chromium_src-f5d8e157ff32700d247e2422dc8b2b0631e63105.tar.bz2 |
Revert 58946 - 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/3272003
TBR=fransiskusx@google.com
Review URL: http://codereview.chromium.org/3366019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58988 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/converter/cross/converter.cc | 3 | ||||
-rw-r--r-- | o3d/converter/cross/renderer_stub.cc | 6 | ||||
-rw-r--r-- | o3d/core/core.gyp | 2 | ||||
-rw-r--r-- | o3d/core/cross/cairo/layer.cc | 69 | ||||
-rw-r--r-- | o3d/core/cross/cairo/layer.h | 137 | ||||
-rw-r--r-- | o3d/core/cross/cairo/renderer_cairo.cc | 125 | ||||
-rw-r--r-- | o3d/core/cross/cairo/renderer_cairo.h | 44 | ||||
-rw-r--r-- | o3d/core/cross/cairo/texture_cairo.cc | 19 | ||||
-rw-r--r-- | o3d/core/cross/cairo/texture_cairo.h | 44 | ||||
-rw-r--r-- | o3d/core/cross/class_manager.cc | 6 | ||||
-rw-r--r-- | o3d/core/cross/renderer.h | 4 | ||||
-rw-r--r-- | o3d/plugin/idl/idl.gyp | 9 | ||||
-rw-r--r-- | o3d/plugin/idl/layer.idl | 74 |
13 files changed, 64 insertions, 478 deletions
diff --git a/o3d/converter/cross/converter.cc b/o3d/converter/cross/converter.cc index 84ebae7..4726392 100644 --- a/o3d/converter/cross/converter.cc +++ b/o3d/converter/cross/converter.cc @@ -37,7 +37,6 @@ #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" @@ -280,7 +279,7 @@ bool Convert(const FilePath& in_filename, ErrorCollector error_collector(&service_locator); scoped_ptr<Renderer> renderer( - RendererStub::CreateDefault(&service_locator)); + Renderer::CreateDefaultRenderer(&service_locator)); 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 0155068..ba0ffd8 100644 --- a/o3d/converter/cross/renderer_stub.cc +++ b/o3d/converter/cross/renderer_stub.cc @@ -211,4 +211,10 @@ const int* RendererStub::GetRGBAUByteNSwizzleTable() { return swizzle_table; } +// 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); +} + } // namespace o3d diff --git a/o3d/core/core.gyp b/o3d/core/core.gyp index ad64ada..c071611 100644 --- a/o3d/core/core.gyp +++ b/o3d/core/core.gyp @@ -474,8 +474,6 @@ { '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 deleted file mode 100644 index e64bd03..0000000 --- a/o3d/core/cross/cairo/layer.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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<Renderer>(); - if (NULL == renderer) { - O3D_ERROR(service_locator) << "No Render Device Available"; - return ObjectBase::Ref(); - } - - Layer* image = new Layer(service_locator); - - RendererCairo* renderer2d = down_cast<RendererCairo*>(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 deleted file mode 100644 index dbe7738..0000000 --- a/o3d/core/cross/cairo/layer.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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 <vector> -#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<Layer> WeakPointerType; - - // Set the corresponding texture for this Layer instance. - void SetTexture(Texture* texture) { - texture_ = down_cast<TextureCairo*>(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 ef70d79..4221e0d 100644 --- a/o3d/core/cross/cairo/renderer_cairo.cc +++ b/o3d/core/cross/cairo/renderer_cairo.cc @@ -36,19 +36,18 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "core/cross/cairo/layer.h" #include "core/cross/cairo/texture_cairo.h" namespace o3d { Renderer* Renderer::CreateDefaultRenderer(ServiceLocator* service_locator) { - return o2d::RendererCairo::CreateDefault(service_locator); + return RendererCairo::CreateDefault(service_locator); } -namespace o2d { - RendererCairo::RendererCairo(ServiceLocator* service_locator) - : Renderer(service_locator), display_(NULL), main_surface_(NULL) { + : 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) { // Don't need to do anything. } @@ -70,6 +69,19 @@ 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 @@ -77,93 +89,35 @@ void RendererCairo::Destroy() { // 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; - } - // Masking areas for other scene. - LayerRefList::iterator start_mask_it = i; - start_mask_it++; - MaskArea(current_drawing, start_mask_it); + if (frame_src_data_ != NULL) { + DLOG(INFO) << "To paint new drawing"; - // Preparing the image to render. + // Preparing the image to render cairo_surface_t* image = cairo_image_surface_create_for_data( const_cast<unsigned char*>( - static_cast<const unsigned char*>(cur_texture->GetData())), - CAIRO_FORMAT_ARGB32, cur_texture->GetWidth(), - cur_texture->GetHeight(), cur_texture->GetPitch()); + static_cast<const unsigned char*>(frame_src_data_)), + CAIRO_FORMAT_ARGB32, frame_src_width_, + frame_src_height_, frame_src_pitch_); + cairo_t* current_drawing = cairo_create(main_surface_); - // Scale the image. + // Scaling the image double width_scaling = - (static_cast<double>(cur->GetScaleX())) / cur_texture->GetWidth(); + (static_cast<double>(display_width())) / frame_src_width_; double height_scaling = - (static_cast<double>(cur->GetScaleY())) / cur_texture->GetHeight(); - + (static_cast<double>(display_height())) / frame_src_height_; cairo_scale(current_drawing, width_scaling, height_scaling); - // 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()); + // Painting the image to the surface + cairo_set_source_surface(current_drawing, image, 0, 0); + cairo_paint(current_drawing); - // Cleaning up the memory. + // Cleaning up the memory + cairo_destroy(current_drawing); 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<double>(cur_mask->GetScaleX()), - static_cast<double>(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), @@ -190,7 +144,7 @@ void RendererCairo::Resize(int width, int height) { DLOG(INFO) << "To Resize " << width << " x " << height; SetClientSize(width, height); - // Resize the mainSurface and buffer + // Resize the mainSurface cairo_xlib_surface_set_size(main_surface_, width, height); } @@ -235,12 +189,6 @@ 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) { @@ -433,10 +381,5 @@ void RendererCairo::SetState(Renderer* renderer, Param* param) { NOTIMPLEMENTED(); } -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 4452bc4f..0ecdad0 100644 --- a/o3d/core/cross/cairo/renderer_cairo.h +++ b/o3d/core/cross/cairo/renderer_cairo.h @@ -36,17 +36,12 @@ #include <cairo.h> #include <build/build_config.h> -#include <list> #include <vector> #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); @@ -65,15 +60,13 @@ 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); @@ -145,15 +138,9 @@ 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<Layer*> LayerRefList; - // Keep the constructor protected so only factory methods can create // renderers. explicit RendererCairo(ServiceLocator* service_locator); @@ -218,13 +205,6 @@ 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 @@ -233,15 +213,17 @@ class RendererCairo : public Renderer { // Main surface to render cairo cairo_surface_t* main_surface_; - // Draw the background - cairo_t* bg_drawing_; - - // Array of Layer - LayerRefList layer_list_; + // 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_; }; -} // 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 d179a10..1fbe076 100644 --- a/o3d/core/cross/cairo/texture_cairo.cc +++ b/o3d/core/cross/cairo/texture_cairo.cc @@ -44,8 +44,6 @@ 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, @@ -59,8 +57,7 @@ TextureCairo::TextureCairo(ServiceLocator* service_locator, levels, enable_render_surfaces), renderer_(static_cast<RendererCairo*>( - service_locator->GetService<Renderer>())), - data_(NULL), left_(0), top_(0), width_(0), height_(0), pitch_(0) { + service_locator->GetService<Renderer>())) { DLOG(INFO) << "Texture2D Construct"; DCHECK_NE(format, Texture::UNKNOWN_FORMAT); } @@ -72,6 +69,7 @@ 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, @@ -88,7 +86,6 @@ const Texture::RGBASwizzleIndices& TextureCairo::GetABGR32FSwizzleIndices() { } TextureCairo::~TextureCairo() { - renderer_ = NULL; DLOG(INFO) << "Texture2DCairo Destruct"; } @@ -102,12 +99,9 @@ void TextureCairo::SetRect(int level, int src_pitch) { DLOG(INFO) << "Texture2DCairo SetRect"; - data_ = src_data; - left_ = dst_left; - top_ = dst_top; - width_ = src_width; - height_ = src_height; - pitch_ = src_pitch; + renderer_->SetNewFrame(src_data, + src_width, src_height, + src_pitch); } // Locks the given mipmap level of this texture for loading from main memory, @@ -141,6 +135,5 @@ void* TextureCairo::GetTextureHandle() const { return reinterpret_cast<void*>(NULL); } -} // namespace o2d - } // namespace o3d + diff --git a/o3d/core/cross/cairo/texture_cairo.h b/o3d/core/cross/cairo/texture_cairo.h index 217c9db..5ba4685 100644 --- a/o3d/core/cross/cairo/texture_cairo.h +++ b/o3d/core/cross/cairo/texture_cairo.h @@ -40,8 +40,6 @@ namespace o3d { -namespace o2d { - class RendererCairo; // Texture2DCairo implements the Texture2D interface. @@ -74,30 +72,6 @@ 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, @@ -112,22 +86,9 @@ 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, @@ -138,8 +99,7 @@ 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 bb51ae4..1a3b909 100644 --- a/o3d/core/cross/class_manager.cc +++ b/o3d/core/cross/class_manager.cc @@ -66,7 +66,6 @@ #include "core/cross/transform.h" #include "core/cross/tree_traversal.h" #include "core/cross/viewport.h" -#include "core/cross/cairo/layer.h" namespace o3d { @@ -179,11 +178,6 @@ ClassManager::ClassManager(ServiceLocator* service_locator) AddTypedClass<TreeTraversal>(); AddTypedClass<VertexBuffer>(); AddTypedClass<Viewport>(); - - // Specific Objects for Cairo -#if defined(RENDERER_CAIRO) - AddTypedClass<o2d::Layer>(); -#endif } void ClassManager::AddClass(const ObjectBase::Class* object_class, diff --git a/o3d/core/cross/renderer.h b/o3d/core/cross/renderer.h index 7a35415..3be95f4 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. - virtual void PushRenderStates(State *state); + void PushRenderStates(State *state); // Pops rendering states to back to their previous settings. - virtual void PopRenderStates(); + 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 1a16027..a6eb6c3 100644 --- a/o3d/plugin/idl/idl.gyp +++ b/o3d/plugin/idl/idl.gyp @@ -13,15 +13,6 @@ 'idl_files': [ '<!@(python get_idl_files.py)', ], - 'conditions': [ - ['renderer == "cairo"', - { - 'idl_files': [ - 'layer.idl', - ], - }, - ], - ], }, 'target_defaults': { 'include_dirs': [ diff --git a/o3d/plugin/idl/layer.idl b/o3d/plugin/idl/layer.idl deleted file mode 100644 index 9525783..0000000 --- a/o3d/plugin/idl/layer.idl +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ - -namespace o3d { - -namespace o2d { - -%[ - Layer defines a container for a layer of scene. - It enables JavaScript to manipulate the layer. -%] -[nocpp, include="core/cross/cairo/layer.h"] class Layer : ParamObject { - %[ - Translate the object from its current coordinate. - - \param x amount to translate in x. - \param y amount to translate in y. - %] - void Translate(float x, float y); - - %[ - Scale the size of the object. - - \param x amount to scale in the x dimension. - \param y amount to scale in the y dimension. - %] - void Scale(float x, float y); - - %[ - Set the transparancy of the object. - - \param alpha amount of the transparancy. - %] - void SetAlpha(float alpha); - - %[ - Set the texture for this object. - - \param texture the texture to assign. - %] - void SetTexture(Texture? texture); -}; // Layer - -} // namespace o2d - -} // namespace o3d |