michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=8 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_layers_Composer2D_h michael@0: #define mozilla_layers_Composer2D_h michael@0: michael@0: #include "gfxTypes.h" michael@0: #include "nsISupportsImpl.h" michael@0: michael@0: /** michael@0: * Many platforms have dedicated hardware for simple composition. michael@0: * This hardware is usually faster or more power efficient than the michael@0: * GPU. However, in exchange for this better performance, generality michael@0: * has to be sacrificed: no 3d transforms, no intermediate surfaces, michael@0: * no special shader effects, loss of other goodies depending on the michael@0: * platform. michael@0: * michael@0: * Composer2D is a very simple interface to this class of hardware michael@0: * that allows an implementation to "try rendering" with the fast michael@0: * path. If the given layer tree requires more generality than the michael@0: * hardware provides, the implementation should bail and have the michael@0: * layer manager fall back on full GPU composition. michael@0: */ michael@0: michael@0: namespace mozilla { michael@0: michael@0: namespace gfx { michael@0: struct Matrix; michael@0: } michael@0: michael@0: namespace layers { michael@0: michael@0: class Layer; michael@0: michael@0: class Composer2D { michael@0: NS_INLINE_DECL_REFCOUNTING(Composer2D) michael@0: michael@0: protected: michael@0: // Protected destructor, to discourage deletion outside of Release(): michael@0: virtual ~Composer2D() {} michael@0: michael@0: public: michael@0: /** michael@0: * Return true if |aRoot| met the implementation's criteria for fast michael@0: * composition and the render was successful. Return false to fall michael@0: * back on the GPU. michael@0: * michael@0: * |aWorldTransform| must be applied to |aRoot|'s subtree when michael@0: * rendering to the framebuffer. This is a global transform on the michael@0: * entire scene, defined in GL space. If the Composer2D michael@0: * implementation is unable to honor the transform, it should return michael@0: * false. michael@0: * michael@0: * Currently, when TryRender() returns true, the entire framebuffer michael@0: * must have been rendered. michael@0: */ michael@0: virtual bool TryRender(Layer* aRoot, const gfx::Matrix& aWorldTransform, michael@0: bool aGeometryChanged) = 0; michael@0: }; michael@0: michael@0: } // namespace layers michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_layers_Composer2D_h