| Index: ppapi/cpp/private/graphics_2d_private.h
|
| diff --git a/ppapi/cpp/private/graphics_2d_private.h b/ppapi/cpp/private/graphics_2d_private.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..291349c7c7482d0ff986be28422fbd5b94ee20ae
|
| --- /dev/null
|
| +++ b/ppapi/cpp/private/graphics_2d_private.h
|
| @@ -0,0 +1,111 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef PPAPI_CPP_PRIVATE_GRAPHICS_2D_PRIVATE_H_
|
| +#define PPAPI_CPP_PRIVATE_GRAPHICS_2D_PRIVATE_H_
|
| +
|
| +#include "ppapi/cpp/graphics_2d.h"
|
| +
|
| +namespace pp {
|
| +
|
| +// Graphics2DPrivate is a version of Graphics2D that exposes private APIs
|
| +// for HiDPI
|
| +class Graphics2DPrivate : public Graphics2D {
|
| + public:
|
| + /// Default constructor for creating an is_null()
|
| + /// <code>Graphics2DPrivate</code> object.
|
| + Graphics2DPrivate();
|
| +
|
| + /// The copy constructor for Graphics2DPrivate. The underlying 2D context is
|
| + /// not copied; this constructor creates another reference to the original 2D
|
| + /// context.
|
| + ///
|
| + /// @param[in] other A pointer to a <code>Graphics2DPrivate</code> context.
|
| + Graphics2DPrivate(const Graphics2DPrivate& other);
|
| +
|
| + /// A constructor allocating a new 2D graphics context with the given size
|
| + /// in the browser, resulting object will be is_null() if the allocation
|
| + /// failed.
|
| + ///
|
| + /// @param[in] instance The instance with which this resource will be
|
| + /// associated.
|
| + ///
|
| + /// @param[in] size The size of the 2D graphics context in the browser,
|
| + /// measured in density-independent pixels (DIPs). Note that using this
|
| + /// constructor will result in a 2D context with a scale between pixels in the
|
| + /// context and DIPs of 1.0.
|
| + ///
|
| + /// @param[in] is_always_opaque Set the <code>is_always_opaque</code> flag
|
| + /// to true if you know that you will be painting only opaque data to this
|
| + /// context. This option will disable blending when compositing the module
|
| + /// with the web page, which might give higher performance on some computers.
|
| + ///
|
| + /// If you set <code>is_always_opaque</code>, your alpha channel should
|
| + /// always be set to 0xFF or there may be painting artifacts. The alpha values
|
| + /// overwrite the destination alpha values without blending when
|
| + /// <code>is_always_opaque</code> is true.
|
| + Graphics2DPrivate(const InstanceHandle& instance,
|
| + const Size& size,
|
| + bool is_always_opaque);
|
| +
|
| + /// A constructor allocating a new 2D graphics context with the given size and
|
| + /// scale factor in the browser, resulting object will be is_null() if the
|
| + /// allocation failed.
|
| + ///
|
| + /// @param[in] instance The instance with which this resource will be
|
| + /// associated.
|
| + ///
|
| + /// @param[in] size The size of the 2D graphics context in the browser,
|
| + /// measured in pixels. The browser will use the scale_factor to properly
|
| + /// map between 1 pixel in the context and 1 density-independent pixel on the
|
| + /// display.
|
| + ///
|
| + /// @param[in] is_always_opaque Set the <code>is_always_opaque</code> flag
|
| + /// to true if you know that you will be painting only opaque data to this
|
| + /// context. This option will disable blending when compositing the module
|
| + /// with the web page, which might give higher performance on some computers.
|
| + ///
|
| + /// If you set <code>is_always_opaque</code>, your alpha channel should
|
| + /// always be set to 0xFF or there may be painting artifacts. The alpha values
|
| + /// overwrite the destination alpha values without blending when
|
| + /// <code>is_always_opaque</code> is true.
|
| + ///
|
| + /// @param[in] scale The scaling factor between pixels in this context and
|
| + /// DIPs. For rendering at device resolution, this will typically be equal to
|
| + /// the device scale of the view resource passed to DidChangeView.
|
| + /// For example, if the view resource passed to DidChangeView has a rectangle
|
| + /// of (w=200, h=100) and a device scale of 2.0, one would call this
|
| + /// constructor with a size of (w=400, h=200) and a scale of 2.0, then treat
|
| + /// each pixel in the context as a single device pixel.
|
| + Graphics2DPrivate(const InstanceHandle& instance,
|
| + const Size& size,
|
| + bool is_always_opaque,
|
| + float scale);
|
| +
|
| + /// A destructor that decrements the reference count of a
|
| + /// <code>Graphics2DPrivate</code> object made using the previous copy
|
| + /// constructor. It is possible that the destructor does not toally destroy
|
| + /// the underlying 2D context if there are outstanding references to it.
|
| + virtual ~Graphics2DPrivate();
|
| +
|
| + /// This function assigns one 2D graphics cntext to this 2D graphics context.
|
| + /// This function increases the reference count of the 2D resource of the
|
| + /// other 2D graphics context while decrementing the reference counter
|
| + /// of this 2D graphics context.
|
| + ///
|
| + /// @param[in] other An other 2D graphics context.
|
| + ///
|
| + /// @return A new Graphics2DPrivate context.
|
| + Graphics2DPrivate& operator=(const Graphics2DPrivate& other);
|
| +
|
| + /// Getter function for returning scale of the 2D graphics context.
|
| + float get_scale() const { return scale_; }
|
| +
|
| + private:
|
| + float scale_;
|
| +};
|
| +
|
| +} // namespace pp
|
| +
|
| +#endif // PPAPI_CPP_PRIVATE_GRAPHICS_2D_PRIVATE_H_
|
|
|