summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorjond@google.com <jond@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-24 20:56:42 +0000
committerjond@google.com <jond@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-24 20:56:42 +0000
commite7a51bf1cb4d6047a0d1971bfa7b17fb1055ac2d (patch)
tree487f35736ed24e25096f5f5664014e11031f2666 /ppapi
parentf42a7f91ab1aded32bf1c71c853cda2ee2414496 (diff)
downloadchromium_src-e7a51bf1cb4d6047a0d1971bfa7b17fb1055ac2d.zip
chromium_src-e7a51bf1cb4d6047a0d1971bfa7b17fb1055ac2d.tar.gz
chromium_src-e7a51bf1cb4d6047a0d1971bfa7b17fb1055ac2d.tar.bz2
New and updated documentation.
Review URL: http://codereview.chromium.org/8004005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106973 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/cpp/graphics_3d.h185
-rw-r--r--ppapi/cpp/graphics_3d_client.h15
2 files changed, 118 insertions, 82 deletions
diff --git a/ppapi/cpp/graphics_3d.h b/ppapi/cpp/graphics_3d.h
index 98e61a3..67b6a79 100644
--- a/ppapi/cpp/graphics_3d.h
+++ b/ppapi/cpp/graphics_3d.h
@@ -8,62 +8,70 @@
#include "ppapi/c/ppb_graphics_3d.h"
#include "ppapi/cpp/resource.h"
+/// @file
+/// This file defines the API to create a 3D rendering context in the browser.
namespace pp {
class CompletionCallback;
class Instance;
class Var;
+/// This class represents a 3D rendering context in the browser.
class Graphics3D : public Resource {
public:
- /// Creates an is_null() Graphics3D object.
+ /// Default constructor for creating an is_null() Graphics3D object.
Graphics3D();
- /// Creates and initializes a 3D rendering context. The returned context is
- /// off-screen to start with. It must be attached to a plugin instance using
- /// Instance::BindGraphics to draw on the web page.
+ /// A constructor for creating and and initializing a 3D rendering context.
+ /// The returned context is created off-screen and must be attached
+ /// to a module instance using <code>Instance::BindGraphics</code> to draw on
+ /// the web page.
///
/// @param[in] instance The instance that will own the new Graphics3D.
///
- /// @param[in] attrib_list The list of attributes for the context. It is a
- /// list of attribute name-value pairs in which each attribute is immediately
- /// followed by the corresponding desired value. The list is terminated with
- /// PP_GRAPHICS3DATTRIB_NONE. The attrib_list may be NULL or empty
- /// (first attribute is PP_GRAPHICS3DATTRIB_NONE). If an attribute is not
- /// specified in attrib_list, then the default value is used (it is said to
- /// be specified implicitly).
- ///
- /// Attributes for the context are chosen according to an attribute-specific
- /// criteria. Attributes can be classified into two categories:
- /// - AtLeast: The attribute value in the returned context meets or exceeds
- /// the value specified in attrib_list.
- /// - Exact: The attribute value in the returned context is equal to
- /// the value specified in attrib_list.
- ///
- /// Attributes that can be specified in attrib_list include:
- /// - PP_GRAPHICS3DATTRIB_ALPHA_SIZE: Category: AtLeast Default: 0.
- /// - PP_GRAPHICS3DATTRIB_BLUE_SIZE: Category: AtLeast Default: 0.
- /// - PP_GRAPHICS3DATTRIB_GREEN_SIZE: Category: AtLeast Default: 0.
- /// - PP_GRAPHICS3DATTRIB_RED_SIZE: Category: AtLeast Default: 0.
- /// - PP_GRAPHICS3DATTRIB_DEPTH_SIZE: Category: AtLeast Default: 0.
- /// - PP_GRAPHICS3DATTRIB_STENCIL_SIZE: Category: AtLeast Default: 0.
- /// - PP_GRAPHICS3DATTRIB_SAMPLES: Category: AtLeast Default: 0.
- /// - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS: Category: AtLeast Default: 0.
- /// - PP_GRAPHICS3DATTRIB_WIDTH: Category: Exact Default: 0.
- /// - PP_GRAPHICS3DATTRIB_HEIGHT: Category: Exact Default: 0.
- /// - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR:
- /// Category: Exact Default: Implementation defined.
+ /// @param[in] attrib_list The list of attributes (name=value pairs) for the
+ /// context. The list is terminated with
+ /// <code>PP_GRAPHICS3DATTRIB_NONE</code>. The <code>attrib_list</code> may
+ /// be <code>NULL</code> or empty (first attribute is
+ /// <code>PP_GRAPHICS3DATTRIB_NONE</code>). If an attribute is not specified
+ /// in <code>attrib_list</code>, then the default value is used.
+ ///
+ /// Attributes are classified into two categories:
+ ///
+ /// 1. AtLeast: The attribute value in the returned context will meet or
+ /// exceed the value requested when creating the object.
+ /// 2. Exact: The attribute value in the returned context is equal to
+ /// the value requested when creating the object.
+ ///
+ /// AtLeast attributes are (all have default values of 0):
+ ///
+ /// <code>PP_GRAPHICS3DATTRIB_ALPHA_SIZE</code>
+ /// <code>PP_GRAPHICS3DATTRIB_BLUE_SIZE</code>
+ /// <code>PP_GRAPHICS3DATTRIB_GREEN_SIZE</code>
+ /// <code>PP_GRAPHICS3DATTRIB_RED_SIZE</code>
+ /// <code>PP_GRAPHICS3DATTRIB_DEPTH_SIZE</code>
+ /// <code>PP_GRAPHICS3DATTRIB_STENCIL_SIZE</code>
+ /// <code>PP_GRAPHICS3DATTRIB_SAMPLES</code>
+ /// <code>PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS</code>
+ ///
+ /// Exact attributes are:
+ ///
+ /// <code>PP_GRAPHICS3DATTRIB_WIDTH</code> Default 0
+ /// <code>PP_GRAPHICS3DATTRIB_HEIGHT</code> Default 0
+ /// <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code>
+ /// Default: Implementation defined.
///
/// On failure, the object will be is_null().
Graphics3D(const Instance* instance,
const int32_t* attrib_list);
- /// Creates and initializes a 3D rendering context. The returned context is
- /// off-screen to start with. It must be attached to a plugin instance using
- /// Instance::BindGraphics to draw on the web page.
+ /// A constructor for creating and initializing a 3D rendering context. The
+ /// returned context is created off-screen. It must be attached to a
+ /// module instance using <code>Instance::BindGraphics</code> to draw on the
+ /// web page.
///
- /// This is identical to the 2-argument version except that this version
- /// allows sharing of resources with another context.
+ /// This constructor is identical to the 2-argument version except that this
+ /// version allows sharing of resources with another context.
///
/// @param[in] instance The instance that will own the new Graphics3D.
///
@@ -74,27 +82,34 @@ class Graphics3D : public Resource {
/// can share data in this fashion.
//
/// @param[in] attrib_list The list of attributes for the context. See the
- /// 2-argument version for more information.
+ /// 2-argument version of this constructor for more information.
///
/// On failure, the object will be is_null().
Graphics3D(const Instance* instance,
const Graphics3D& share_context,
const int32_t* attrib_list);
+ /// Destructor.
~Graphics3D();
- /// Retrieves the value for each attribute in attrib_list. The list
- /// has the same structure as described for the constructor.
- /// It is both input and output structure for this function.
+ /// GetAttribs() retrieves the value for each attribute in
+ /// <code>attrib_list</code>. The list has the same structure as described
+ /// for the constructor. All attribute values specified in
+ /// <code>pp_graphics_3d.h</code> can be retrieved.
///
- /// All attributes specified in PPB_Graphics3D.Create can be queried for.
- /// On failure the following error codes may be returned:
- /// - PP_ERROR_BADRESOURCE if context is invalid.
- /// - PP_ERROR_BADARGUMENT if attrib_list is NULL or any attribute in the
- /// attrib_list is not a valid attribute.
+ /// @param[in,out] attrib_list The list of attributes (name=value pairs) for
+ /// the context. The list is terminated with
+ /// <code>PP_GRAPHICS3DATTRIB_NONE</code>.
///
- /// Example usage: To get the values for rgb bits in the color buffer,
- /// this function must be called as following:
+ /// The following error codes may be returned on failure:
+ ///
+ /// PP_ERROR_BADRESOURCE if context is invalid.
+ /// PP_ERROR_BADARGUMENT if <code>attrib_list</code> is NULL or any attribute
+ /// in the <code>attrib_list</code> is not a valid attribute.
+ ///
+ /// <strong>Example:</strong>
+ ///
+ /// <code>
/// int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0,
/// PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0,
/// PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0,
@@ -103,10 +118,14 @@ class Graphics3D : public Resource {
/// int red_bits = attrib_list[1];
/// int green_bits = attrib_list[3];
/// int blue_bits = attrib_list[5];
+ /// </code>
+ ///
+ /// This example retrieves the values for rgb bits in the color buffer.
int32_t GetAttribs(int32_t* attrib_list) const;
- /// Sets the values for each attribute in attrib_list. The list
- /// has the same structure as described for PPB_Graphics3D.Create.
+ /// SetAttribs() sets the values for each attribute in
+ /// <code>attrib_list</code>. The list has the same structure as the list
+ /// used in the constructors.
///
/// Attributes that can be specified are:
/// - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR
@@ -117,47 +136,55 @@ class Graphics3D : public Resource {
/// attrib_list is not a valid attribute.
int32_t SetAttribs(int32_t* attrib_list);
- /// Resizes the backing surface for the context.
+ /// ResizeBuffers() resizes the backing surface for the context.
///
- /// On failure the following error codes may be returned:
- /// - PP_ERROR_BADRESOURCE if context is invalid.
- /// - PP_ERROR_BADARGUMENT if the value specified for width or height
- /// is less than zero.
+ /// @param[in] width The width of the backing surface.
+ /// @param[in] height The height of the backing surface.
///
- /// If the surface could not be resized due to insufficient resources,
- /// PP_ERROR_NOMEMORY error is returned on the next SwapBuffers callback.
+ /// @return An int32_t containing <code>PP_ERROR_BADRESOURCE</code> if
+ /// context is invalid or <code>PP_ERROR_BADARGUMENT</code> if the value
+ /// specified for width or height is less than zero.
+ /// <code>PP_ERROR_NOMEMORY</code> might be returned on the next
+ /// SwapBuffers() callback if the surface could not be resized due to
+ /// insufficient resources.
int32_t ResizeBuffers(int32_t width, int32_t height);
- /// Makes the contents of the color buffer available for compositing.
- /// This function has no effect on off-screen surfaces - ones not bound
- /// to any plugin instance. The contents of ancillary buffers are always
- /// undefined after calling SwapBuffers. The contents of the color buffer are
- /// undefined if the value of the PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR attribute
- /// of context is not PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED.
- ///
- /// SwapBuffers runs in asynchronous mode. Specify a callback function and the
- /// argument for that callback function. The callback function will be
+ /// SwapBuffers() makes the contents of the color buffer available for
+ /// compositing. This function has no effect on off-screen surfaces: surfaces
+ /// not bound to any module instance. The contents of ancillary buffers are
+ /// always undefined after calling SwapBuffers(). The contents of the color
+ /// buffer are undefined if the value of the
+ /// <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code> attribute of context is
+ /// not <code>PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED</code>.
+ ///
+ /// SwapBuffers() runs in asynchronous mode. Specify a callback function and
+ /// the argument for that callback function. The callback function will be
/// executed on the calling thread after the color buffer has been composited
- /// with rest of the html page. While you are waiting for a SwapBuffers
- /// callback, additional calls to SwapBuffers will fail.
+ /// with rest of the html page. While you are waiting for a SwapBuffers()
+ /// callback, additional calls to SwapBuffers() will fail.
///
/// Because the callback is executed (or thread unblocked) only when the
- /// plugin's current state is actually on the screen, this function provides a
- /// way to rate limit animations. By waiting until the image is on the screen
- /// before painting the next frame, you can ensure you're not generating
- /// updates faster than the screen can be updated.
+ /// instance's current state is actually on the screen, this function
+ /// provides a way to rate limit animations. By waiting until the image is on
+ /// the screen before painting the next frame, you can ensure you're not
+ /// generating updates faster than the screen can be updated.
///
- /// SwapBuffers performs an implicit flush operation on context.
+ /// SwapBuffers() performs an implicit flush operation on context.
/// If the context gets into an unrecoverable error condition while
/// processing a command, the error code will be returned as the argument
/// for the callback. The callback may return the following error codes:
- /// - PP_ERROR_NOMEMORY
- /// - PP_ERROR_CONTEXT_LOST
- /// Note that the same error code may also be obtained by calling GetError.
///
- /// On failure SwapBuffers may return the following error codes:
- /// - PP_ERROR_BADRESOURCE if context is invalid.
- /// - PP_ERROR_BADARGUMENT if callback is invalid.
+ /// <code>PP_ERROR_NOMEMORY</code>
+ /// <code>PP_ERROR_CONTEXT_LOST</code>
+ ///
+ /// Note that the same error code may also be obtained by calling GetError().
+ ///
+ /// param[in] cc A <code>CompletionCallback</code> to be called upon
+ /// completion of SwapBuffers().
+ ///
+ /// @return An int32_t containing <code>PP_ERROR_BADRESOURCE</code> if
+ /// context is invalid or <code>PP_ERROR_BADARGUMENT</code> if callback is
+ /// invalid.
int32_t SwapBuffers(const CompletionCallback& cc);
};
diff --git a/ppapi/cpp/graphics_3d_client.h b/ppapi/cpp/graphics_3d_client.h
index 511ca2d..1d2e053 100644
--- a/ppapi/cpp/graphics_3d_client.h
+++ b/ppapi/cpp/graphics_3d_client.h
@@ -7,6 +7,9 @@
#include "ppapi/c/pp_stdint.h"
+/// @file
+/// This file defines the API for callbacks related to 3D.
+
namespace pp {
class Instance;
@@ -19,12 +22,18 @@ class Widget_Dev;
// instance.
class Graphics3DClient {
public:
+ ///
+ /// A constructor for creating a Graphics3DClient.
+ ///
+ /// @param[in] instance The instance that will own the new
+ /// <code>Graphics3DClient</code>.
Graphics3DClient(Instance* instance);
+
+ /// Destructor.
virtual ~Graphics3DClient();
- /**
- * Notification that the context was lost for the 3D devices.
- */
+ /// Graphics3DContextLost() is a notification that the context was lost for
+ /// the 3D devices.
virtual void Graphics3DContextLost() = 0;
private: