diff options
-rw-r--r-- | ppapi/cpp/audio.h | 37 | ||||
-rw-r--r-- | ppapi/cpp/audio_config.h | 66 | ||||
-rw-r--r-- | ppapi/cpp/common.h | 21 | ||||
-rw-r--r-- | ppapi/cpp/core.h | 67 | ||||
-rw-r--r-- | ppapi/cpp/graphics_2d.h | 143 | ||||
-rw-r--r-- | ppapi/cpp/image_data.h | 94 | ||||
-rw-r--r-- | ppapi/cpp/non_thread_safe_ref_count.h | 18 | ||||
-rw-r--r-- | ppapi/cpp/point.h | 30 | ||||
-rw-r--r-- | ppapi/cpp/rect.h | 229 | ||||
-rw-r--r-- | ppapi/cpp/resource.h | 31 | ||||
-rw-r--r-- | ppapi/cpp/size.h | 67 |
11 files changed, 455 insertions, 348 deletions
diff --git a/ppapi/cpp/audio.h b/ppapi/cpp/audio.h index 6c8ede8..cc98e56 100644 --- a/ppapi/cpp/audio.h +++ b/ppapi/cpp/audio.h @@ -29,39 +29,44 @@ class Audio : public Resource { /// A constructor that creates an Audio resource. No sound will be heard /// until StartPlayback() is called. The callback is called with the buffer /// address and given user data whenever the buffer needs to be filled. - /// From within the callback, you should not call PPB_Audio functions. - /// The callback will be called on a different thread than the one which - /// created the interface. For performance-critical applications (i.e. - /// low-latency audio), the callback should avoid blocking or calling + /// From within the callback, you should not call <code>PPB_Audio</code> + /// functions. The callback will be called on a different thread than the one + /// which created the interface. For performance-critical applications (such + /// as low-latency audio), the callback should avoid blocking or calling /// functions that can obtain locks, such as malloc. The layout and the size /// of the buffer passed to the audio callback will be determined by - /// the device configuration and is specified in the AudioConfig + /// the device configuration and is specified in the <code>AudioConfig</code> /// documentation. /// - /// @param[in] instance A pointer to an Instance indentifying one instance of - /// a module. - /// @param[in] config An AudioConfig containing the audio config resource. - /// @param[in] callback A PPB_Audio_Callback callback function that the - /// browser calls when it needs more samples to play. + /// @param[in] instance A pointer to an <code>Instance</code> indentifying one + /// instance of a module. + /// @param[in] config An <code>AudioConfig</code> containing the audio config + /// resource. + /// @param[in] callback A <code>PPB_Audio_Callback</code> callback function + /// that the browser calls when it needs more samples to play. /// @param[in] user_data A pointer to user data used in the callback function. Audio(Instance* instance, const AudioConfig& config, PPB_Audio_Callback callback, void* user_data); - - /// Getter function for returning the internal PPB_AudioConfig struct + /// Getter function for returning the internal <code>PPB_AudioConfig</code> + /// struct. + /// /// @return A mutable reference to the PPB_AudioConfig struct. AudioConfig& config() { return config_; } - /// Getter function for returning the internal PPB_AudioConfig struct. - /// @return A const reference to the internal PPB_AudioConfig struct. + /// Getter function for returning the internal <code>PPB_AudioConfig</code> + /// struct. + /// + /// @return A const reference to the internal <code>PPB_AudioConfig</code> + /// struct. const AudioConfig& config() const { return config_; } - /// A function to start playback of audio. + /// StartPlayback() starts playback of audio. bool StartPlayback(); - /// A function to stop playback of audio. + /// StopPlayback stops playback of audio. bool StopPlayback(); private: diff --git a/ppapi/cpp/audio_config.h b/ppapi/cpp/audio_config.h index 64a9773..dfb7cf3 100644 --- a/ppapi/cpp/audio_config.h +++ b/ppapi/cpp/audio_config.h @@ -27,15 +27,16 @@ class Instance; /// /// Buffer layout for a stereo int16 configuration: /// -/// int16_t *buffer16; -/// buffer16[0] is the first left channel sample. -/// buffer16[1] is the first right channel sample. -/// buffer16[2] is the second left channel sample. -/// buffer16[3] is the second right channel sample. -/// ... -/// buffer16[2 * (sample_frame_count - 1)] is the last left channel sample. -/// buffer16[2 * (sample_frame_count - 1) + 1] is the last right channel -/// sample. +/// <code>int16_t *buffer16;</code> +/// <code>buffer16[0]</code> is the first left channel sample. +/// <code>buffer16[1]</code> is the first right channel sample. +/// <code>buffer16[2]</code> is the second left channel sample. +/// <code>buffer16[3]</code> is the second right channel sample. +/// <code>...</code> +/// <code>buffer16[2 * (sample_frame_count - 1)]</code> is the last left +/// channel sample. +/// <code>buffer16[2 * (sample_frame_count - 1) + 1]</code> is the last right +/// channel sample. /// Data will always be in the native endian format of the platform. /// /// <strong>Example:</strong> @@ -54,7 +55,7 @@ class Instance; /// @endcode class AudioConfig : public Resource { public: - /// An empty constructor for an AudioConfig resource. + /// An empty constructor for an <code>AudioConfig</code> resource. AudioConfig(); /// A constructor that creates an audio config based on the given sample rate @@ -62,30 +63,34 @@ class AudioConfig : public Resource { /// resulting resource will be is_null(). You can pass the result of /// RecommendSampleFrameCount() as the sample frame count. /// - /// @param[in] instance A pointer to an Instance indentifying one instance of - /// a module. - /// @param[in] sample_rate A PP_AudioSampleRate which is either - /// PP_AUDIOSAMPLERATE_44100 or PP_AUDIOSAMPLERATE_48000. + /// @param[in] instance A pointer to an <code>Instance</code> indentifying + /// one instance of a module. + /// @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either + /// <code>PP_AUDIOSAMPLERATE_44100</code> or + /// <code>PP_AUDIOSAMPLERATE_48000</code>. /// @param[in] sample_frame_count A uint32_t frame count returned from the - /// RecommendSampleFrameCount function. + /// <code>RecommendSampleFrameCount</code> function. AudioConfig(Instance* instance, PP_AudioSampleRate sample_rate, uint32_t sample_frame_count); - /// This function returns a supported frame count closest to the requested - /// count. The sample frame count determines the overall latency of audio. - /// Smaller frame counts will yield lower latency, but higher CPU - /// utilization. Supported sample frame counts will vary by hardware and - /// system (consider that the local system might be anywhere from a cell - /// phone or a high-end audio workstation). Sample counts less than - /// PP_AUDIOMINSAMPLEFRAMECOUNT and greater than PP_AUDIOMAXSAMPLEFRAMECOUNT - /// are never supported on any system, but values in between aren't - /// necessarily valid. This function will return a supported count closest to - /// the requested value for use in the constructor. + /// RecommendSampleFrameCount() returns a supported frame count closest to + /// the requested count. The sample frame count determines the overall + /// latency of audio. Smaller frame counts will yield lower latency, but + /// higher CPU utilization. Supported sample frame counts will vary by + /// hardware and system (consider that the local system might be anywhere + /// from a cell phone or a high-end audio workstation). Sample counts less + /// than <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than + /// <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any + /// system, but values in between aren't necessarily valid. This function + /// will return a supported count closest to the requested value for use in + /// the constructor. /// - /// @param[in] sample_rate A PP_AudioSampleRate which is either - /// PP_AUDIOSAMPLERATE_44100 or PP_AUDIOSAMPLERATE_48000. + /// @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either + /// <code>PP_AUDIOSAMPLERATE_44100</code> or + /// <code>PP_AUDIOSAMPLERATE_48000</code>. /// @param[in] requested_sample_frame_count A uint_32t requested frame count. + /// /// @return A uint32_t containing the recommended sample frame count if /// successful. If the sample frame count or bit rate is not supported, /// this function will fail and return 0. @@ -93,11 +98,14 @@ class AudioConfig : public Resource { PP_AudioSampleRate sample_rate, uint32_t requested_sample_frame_count); - /// Getter function for returning the internal PP_AudioSampleRate enum. - /// @return The PP_AudioSampleRate enum. + /// Getter function for returning the internal + /// <code>PP_AudioSampleRate</code> enum. + /// + /// @return The <code>PP_AudioSampleRate</code> enum. PP_AudioSampleRate sample_rate() const { return sample_rate_; } /// Getter function for returning the internal sample frame count. + /// /// @return A uint32_t containing the sample frame count. uint32_t sample_frame_count() { return sample_frame_count_; } diff --git a/ppapi/cpp/common.h b/ppapi/cpp/common.h index 1531ae1..b896036 100644 --- a/ppapi/cpp/common.h +++ b/ppapi/cpp/common.h @@ -7,24 +7,29 @@ /// @file -/// Defines the API to convert PP_Bool to and from their C++ equivalent. +/// Defines the API to convert <code>PP_Bool</code> to and from their C++ +/// equivalent. #include "ppapi/c/pp_bool.h" namespace pp { -/// This function is used to convert a C++ bool to the appropriate PP_Bool -/// value. +/// BoolToPPBool() is used to convert a C++ bool to the appropriate +/// <code>PP_Bool</code> value. +/// /// @param[in] value A C++ boolean value. -/// @return A PP_Bool equivalent of the C++ boolean value. +/// +/// @return A <code>PP_Bool</code> equivalent of the C++ boolean value. inline PP_Bool BoolToPPBool(bool value) { return value ? PP_TRUE : PP_FALSE; } -/// This function is used to convert a PP_Bool to a C++ boolean value. -/// value. -/// @param[in] value A PP_Bool boolean value. -/// @return A C++ equivalent of the PP_Bool boolean value. +/// PPBoolToBool() is used to convert a <code>PP_Bool</code> to a C++ +/// boolean value. +/// +/// @param[in] value A <code>PP_Bool</code> boolean value. +/// +/// @return A C++ equivalent of the <code>PP_Bool</code> boolean value. inline bool PPBoolToBool(PP_Bool value) { return !!value; } diff --git a/ppapi/cpp/core.h b/ppapi/cpp/core.h index e6a0853..45a90c3 100644 --- a/ppapi/cpp/core.h +++ b/ppapi/cpp/core.h @@ -23,92 +23,97 @@ class Core { // be called only when doing manual management on raw PP_Resource handles, // which should be fairly rare. - /// A function that increments the reference count for the provided resource. + /// AddRefResource() increments the reference count for the provided + /// <code>resource</code>. /// - /// @param[in] resource A PP_Resource containing the resource. + /// @param[in] resource A <code>PP_Resource</code> containing the resource. void AddRefResource(PP_Resource resource) { interface_->AddRefResource(resource); } - /// A function that decrements the reference count for the provided resource. - /// The resource will be deallocated if the reference count reaches zero. + /// ReleaseResource() decrements the reference count for the provided + /// <code>resource</code>. The resource will be deallocated if the + /// reference count reaches zero. /// - /// @param[in] resource A PP_Resource containing the resource. + /// @param[in] resource A <code>PP_Resource</code> containing the resource. void ReleaseResource(PP_Resource resource) { interface_->ReleaseResource(resource); } - /// A function that allocates memory. + /// MemAlloc() allocates memory. /// /// @param[in] num_bytes A number of bytes to allocate. - /// @return A pointer to the memory if successful, NULL If the + /// + /// @return A pointer to the memory if successful, <code>NULL</code> If the /// allocation fails. void* MemAlloc(uint32_t num_bytes) { return interface_->MemAlloc(num_bytes); } - /// A function that deallocates memory. + /// MemFree() deallocates memory. /// /// @param[in] ptr A pointer to the memory to deallocate. It is safe to - /// pass NULL to this function. + /// pass <code>NULL</code> to this function. void MemFree(void* ptr) { interface_->MemFree(ptr); } - /// A function that that returns the "wall clock time" according to the + /// GetTime() returns the "wall clock time" according to the /// browser. /// - /// @return A PP_Time containing the "wall clock time" according to the - /// browser. + /// @return A <code>PP_Time</code> containing the "wall clock time" according + /// to the browser. PP_Time GetTime() { return interface_->GetTime(); } - /// A function that that returns the "tick time" according to the browser. + /// GetTimeTicks() returns the "tick time" according to the browser. /// This clock is used by the browser when passing some event times to the - /// plugin (e.g., via the PP_InputEvent::time_stamp_seconds field). It is - /// not correlated to any actual wall clock time (like GetTime()). Because + /// plugin (for example, using the + /// <code>PP_InputEvent::time_stamp_seconds</code> field). It is not + /// correlated to any actual wall clock time (like GetTime()). Because /// of this, it will not change if the user changes their computer clock. /// - /// @return A PP_TimeTicks containing the "tick time" according to the - /// browser. + /// @return A <code>PP_TimeTicks</code> containing the "tick time" according + /// to the browser. PP_TimeTicks GetTimeTicks() { return interface_->GetTimeTicks(); } - /// A function that schedules work to be executed on the main pepper thread - /// after the specified delay. The delay may be 0 to specify a call back as - /// soon as possible. + /// CallOnMainThread() schedules work to be executed on the main pepper + /// thread after the specified delay. The delay may be 0 to specify a call + /// back as soon as possible. /// /// The |result| parameter will just be passed as the second argument to the /// callback. Many applications won't need this, but it allows a plugin to /// emulate calls of some callbacks which do use this value. /// - /// NOTE: CallOnMainThread, even when used from the main thread with a delay - /// of 0 milliseconds, will never directly invoke the callback. Even in this - /// case, the callback will be scheduled asynchronously. + /// <strong>Note:</strong> CallOnMainThread(), even when used from the main + /// thread with a delay of 0 milliseconds, will never directly invoke the + /// callback. Even in this case, the callback will be scheduled + /// asynchronously. /// - /// NOTE: If the browser is shutting down or if the plugin has no instances, - /// then the callback function may not be called. + /// <strong>Note:</strong> If the browser is shutting down or if the module + /// has no instances, then the callback function may not be called. /// /// @param[in] delay_in_milliseconds An int32_t delay in milliseconds. - /// @param[in] callback A CompletionCallback callback function that the - /// browser will call after the specified delay. + /// @param[in] callback A <code>CompletionCallback</code> callback function + /// that the browser will call after the specified delay. /// @param[in] result An int32_t that the browser will pass to the given - /// CompletionCallback. + /// <code>CompletionCallback</code>. void CallOnMainThread(int32_t delay_in_milliseconds, const CompletionCallback& callback, int32_t result = 0); - /// A function that returns true if the current thread is the main pepper + /// IsMainThread() returns true if the current thread is the main pepper /// thread. /// /// This function is useful for implementing sanity checks, and deciding if /// dispatching using CallOnMainThread() is required. /// - /// @return A PP_BOOL containing PP_TRUE if the current thread is the main - /// pepper thread, otherwise PP_FALSE. + /// @return A bool containing true if the current thread is + /// the main pepper thread, otherwise false. bool IsMainThread(); private: diff --git a/ppapi/cpp/graphics_2d.h b/ppapi/cpp/graphics_2d.h index e14dcd2..af86e04 100644 --- a/ppapi/cpp/graphics_2d.h +++ b/ppapi/cpp/graphics_2d.h @@ -22,15 +22,15 @@ class Rect; class Graphics2D : public Resource { public: - /// Default constructor for creating an is_null() Graphics2D object. + /// Default constructor for creating an is_null() <code>Graphics2D</code> + /// object. Graphics2D(); - /// A constructor accepting a reference to a Graphics2D graphics context - /// and converting it to a reference counted Graphics2D context. The - /// underlying 2D context is not copied; this constructor creates another - /// reference to the original 2D context. + /// The copy constructor for Graphics2D. The underlying 2D context is not + /// copied; this constructor creates another reference to the original 2D + /// context. /// - /// @param[in] other A pointer to a Graphics2D context. + /// @param[in] other A pointer to a <code>Graphics2D</code> context. Graphics2D(const Graphics2D& other); /// A constructor allocating a new 2D graphics context with the given size @@ -40,26 +40,26 @@ class Graphics2D : public Resource { /// @param[in] instance The module instance. /// @param[in] size The size of the 2D graphics context in the browser, /// measured in device pixels. - /// @param[in] is_always_opaque Set the is_always_opaque flag if you know - /// that you will be painting only opaque data to this context. This will - /// disable blending when compositing the plugin with the web page, which - /// might give higher performance on some computers. - /// If you set is_always_opaque, 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 + /// @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. Graphics2D(Instance* instance, const Size& size, bool is_always_opaque); - /// A destructor that decrements the reference count of a Graphics2D 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. + /// A destructor that decrements the reference count of a + /// <code>Graphics2D</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 ~Graphics2D(); - - /// Assigns one 2D graphics context 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 + /// This function assigns one 2D graphics context 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. @@ -71,7 +71,7 @@ class Graphics2D : public Resource { /// @return The size of the 2D graphics context measured in device pixels. const Size& size() const { return size_; } - /// This function enqueues a paint command of the given image into + /// PaintImageData() enqueues a paint command of the given image into /// the context. This command has no effect until you call Flush(). As a /// result, what counts is the contents of the bitmap when you call Flush, /// not when you call this function. @@ -86,21 +86,22 @@ class Graphics2D : public Resource { /// error. /// /// There are two methods most modules will use for painting. The first - /// method is to generate a new ImageData and then paint it. In this case, - /// you'll set the location of your painting to <code>top_left</code> and - /// set <code>src_rect</code> to NULL. The second is that you're generating - /// small invalid regions out of a larger bitmap representing your entire - /// module's image. + /// method is to generate a new <code>ImageData</code> and then paint it. + /// In this case, you'll set the location of your painting to + /// <code>top_left</code> and set <code>src_rect</code> to <code>NULL</code>. + /// The second is that you're generating small invalid regions out of a larger + /// bitmap representing your entire module's image. /// - /// @param[in] image The ImageData to be painted. - /// @param[in] top_left A Point representing the top_left location where the - /// ImageData will be painted. + /// @param[in] image The <code>ImageData</code> to be painted. + /// @param[in] top_left A <code>Point</code> representing the + /// <code>top_left</code> location where the <code>ImageData</code> will be + /// painted. void PaintImageData(const ImageData& image, const Point& top_left); - /// This function enqueues a paint command of the given image into + /// PaintImageData() enqueues a paint command of the given image into /// the context. This command has no effect until you call Flush(). As a - /// result, what counts is the contents of the bitmap when you call Flush, + /// result, what counts is the contents of the bitmap when you call Flush(), /// not when you call this function. /// /// The provided image will be placed at <code>top_left</code> from the top @@ -116,28 +117,29 @@ class Graphics2D : public Resource { /// The painted area of the source bitmap must fall entirely within the /// context. Attempting to paint outside of the context will result in an /// error. However, the source bitmap may fall outside the context, as long - /// as the src_rect subset of it falls entirely within the context. + /// as the <code>src_rect</code> subset of it falls entirely within the + /// context. /// /// There are two methods most modules will use for painting. The first - /// method is to generate a new ImageData and then paint it. In this case, - /// you'll set the location of your painting to top_left and set src_rect to - /// NULL. The second is that you're generating small invalid regions out of - /// a larger bitmap representing your entire module's image. The - /// second is that you're generating small invalid regions out of a larger + /// method is to generate a new <code>ImageData</code> and then paint it. In + /// this case, you'll set the location of your painting to + /// <code>top_left</code> and set <code>src_rect</code> to <code>NULL</code>. + /// The second is that you're generating small invalid regions out of a larger /// bitmap representing your entire module. In this case, you would set the /// location of your image to (0,0) and then set <code>src_rect</code> to the /// pixels you changed. /// - /// @param[in] image The ImageData to be painted. - /// @param[in] top_left A Point representing the <code>top_left</code> - /// location where the ImageData will be painted. - /// @param[in] src_rect The rectangular area where the ImageData will - /// be painted. + /// @param[in] image The <code>ImageData</code> to be painted. + /// @param[in] top_left A <code>Point</code> representing the + /// <code>top_left</code> location where the <code>ImageData</code> will be + /// painted. + /// @param[in] src_rect The rectangular area where the <code>ImageData</code> + /// will be painted. void PaintImageData(const ImageData& image, const Point& top_left, const Rect& src_rect); - /// This function enqueues a scroll of the context's backing store. This + /// Scroll() enqueues a scroll of the context's backing store. This /// function has no effect until you call Flush(). The data within the /// provided clipping rectangle will be shifted by (dx, dy) pixels. /// @@ -154,11 +156,11 @@ class Graphics2D : public Resource { /// shifted. void Scroll(const Rect& clip, const Point& amount); - /// This function provides a slightly more efficient way to paint the entire - /// module's image. Normally, calling PaintImageData() requires that the - /// browser copy the pixels out of the image and into the graphics context's - /// backing store. This function replaces the graphics context's backing - /// store with the given image, avoiding the copy. + /// ReplaceContents() provides a slightly more efficient way to paint the + /// entire module's image. Normally, calling PaintImageData() requires that + /// the browser copy the pixels out of the image and into the graphics + /// context's backing store. This function replaces the graphics context's + /// backing store with the given image, avoiding the copy. /// /// The new image must be the exact same size as this graphics context. If /// the new image uses a different image format than the browser's native @@ -166,10 +168,11 @@ class Graphics2D : public Resource { /// format), then a conversion will be done inside the browser which may slow /// the performance a little bit. /// - /// The new image will not be painted until you call Flush(). + /// <strong>Note:</strong> The new image will not be painted until you call + /// Flush(). /// - /// Release your references to the image after a call to this function. - /// If you paint to the image after ReplaceContents(), there is the + /// After this call, you should take care to release your references to the + /// image. If you paint to the image after ReplaceContents(), there is the /// possibility of significant painting artifacts because the page might use /// partially-rendered data when copying out of the backing store. /// @@ -181,20 +184,19 @@ class Graphics2D : public Resource { /// allocated during the animation, and the backing store and "front buffer" /// (which the module is painting into) are just being swapped back and forth. /// - /// @param[in] image The ImageData to be painted. + /// @param[in] image The <code>ImageData</code> to be painted. void ReplaceContents(ImageData* image); - - /// This function flushes any enqueued paint, scroll, and replace commands - /// for the backing store. This actually executes the updates, and causes a + /// Flush() flushes any enqueued paint, scroll, and replace commands + /// to the backing store. This actually executes the updates, and causes a /// repaint of the webpage, assuming this graphics context is bound to a /// module instance. /// /// Flush() 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 when the image has been painted to the - /// screen. While you are waiting for a Flush callback, additional calls to - /// Flush() will fail. + /// screen. While you are waiting for a <code>Flush</code> callback, + /// additional calls to Flush() will fail. /// /// Because the callback is executed (or thread unblocked) only when the /// module's image is actually on the screen, this function provides @@ -231,20 +233,25 @@ class Graphics2D : public Resource { /// released your reference to. /// /// <strong>Shutdown</strong> - /// If a plugin instance is removed when a Flush is pending, the + /// If a module instance is removed when a Flush is pending, the /// callback will not be executed. /// - /// @param[in] cc A CompletionCallback to be called when the image has - /// been painted on the screen. - /// @return Returns PP_OK on succes or PP_Error_BadResource the graphics - /// context is invalid, PP_Error_BadArgument if the callback is null and + /// @param[in] cc A <code>CompletionCallback</code> to be called when the + /// image has been painted on the screen. + /// + /// @return Returns <code>PP_OK</code> on success or + /// <code>PP_Error_BadResource</code> if the graphics context is invalid, + /// <code>PP_Error_BadArgument</code> if the callback is null and /// flush is being called from the main thread of the module, or - /// PP_Error_InProgress if a flush is already pending that has not issued - /// its callback yet. In the failure case, nothing will be updated and - /// no callback will be scheduled. + /// <code>PP_Error_InProgress</code> if a flush is already pending that has + /// not issued its callback yet. In the failure case, nothing will be + /// updated and no callback will be scheduled. + + // TODO(darin): We should ensure that the completion callback always runs, so + // that it is easier for consumers to manage memory referenced by a callback. - /// TODO(darin): We should ensure that the completion callback always runs, so - /// that it is easier for consumers to manage memory referenced by a callback. + // TODO(): Add back in the synchronous mode description once we have support + // for it. int32_t Flush(const CompletionCallback& cc); private: diff --git a/ppapi/cpp/image_data.h b/ppapi/cpp/image_data.h index 682174d..b472a85 100644 --- a/ppapi/cpp/image_data.h +++ b/ppapi/cpp/image_data.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -21,7 +21,8 @@ class Plugin; class ImageData : public Resource { public: - /// Default constructor for creating an is_null() ImageData object. + /// Default constructor for creating an is_null() <code>ImageData</code> + /// object. ImageData(); /// A special structure used by the constructor that does not increment the @@ -34,75 +35,60 @@ class ImageData : public Resource { /// @param[in] resource A PP_Resource corresponding to image data. ImageData(PassRef, PP_Resource resource); - /// A constructor accepting a reference to an ImageData to increment the - /// reference count of the underlying Image resource. This constructor - /// produces an ImageData object that shares the underlying Image resource - /// with <code>other</code>. + /// The copy constructor for <code>ImageData</code>. This constructor + /// produces an <code>ImageData</code> object that shares the underlying + /// <code>Image</code> resource with <code>other</code>. /// /// @param[in] other A pointer to an image data. ImageData(const ImageData& other); - /// A constructor that allocates a new ImageData in the browser with the - /// provided parameters. - /// The resulting object will be is_null() if the allocation failed. + /// A constructor that allocates a new <code>ImageData</code> in the browser + /// with the provided parameters. The resulting object will be is_null() if + /// the allocation failed. /// - /// @param[in] instance A PP_Instance indentifying one instance of a module. - /// @param[in] format The desired image format. + /// @param[in] instance A <code>PP_Instance</code> indentifying one instance + /// of a module. + /// + /// @param[in] format A PP_ImageDataFormat containing desired image format. /// PP_ImageDataFormat is an enumeration of the different types of - /// image data formats. - /// - /// The third part of each enumeration value describes the memory layout from - /// the lowest address to the highest. For example, BGRA means the B component - /// is stored in the lowest address, no matter what endianness the platform is - /// using. - /// - /// The PREMUL suffix implies pre-multiplied alpha is used. In this mode, the - /// red, green and blue color components of the pixel data supplied to an - /// image data should be pre-multiplied by their alpha value. For example: - /// starting with floating point color components, here is how to convert - /// them to 8-bit premultiplied components for image data: - /// ...components of a pixel, floats ranging from 0 to 1... - /// float red = 1.0f; - /// float green = 0.50f; - /// float blue = 0.0f; - /// float alpha = 0.75f; - /// ...components for image data are 8-bit values ranging from 0 to 255... - /// uint8_t image_data_red_premul = (uint8_t)(red * alpha * 255.0f); - /// uint8_t image_data_green_premul = (uint8_t)(green * alpha * 255.0f); - /// uint8_t image_data_blue_premul = (uint8_t)(blue * alpha * 255.0f); - /// uint8_t image_data_alpha_premul = (uint8_t)(alpha * 255.0f); - /// Note the resulting pre-multiplied red, green and blue components should - /// not be greater than the alpha value. - /// @param[in] size A pointer to a PP_Size containing the image size. - /// @param[in] init_to_zero A PP_Bool to determine transparency at creation. - /// Set the init_to_zero flag if you want the bitmap initialized to - /// transparent during the creation process. If this flag is not set, the - /// current contents of the bitmap will be undefined, and the plugin should - /// be sure to set all the pixels. + /// image data formats. Refer to the + /// <a href="/chrome/nativeclient/docs/reference/pepperc/ + /// ppb__image__data_8h.html"><code>ppb_image_data.h</code></a> for further + /// information. + /// + /// @param[in] size A pointer to a <code>Size</code> containing the image + /// size. + /// + /// @param[in] init_to_zero A bool used to determine transparency at + /// creation. Set the <code>init_to_zero</code> flag if you want the bitmap + /// initialized to transparent during the creation process. If this flag is + /// not set, the current contents of the bitmap will be undefined, and the + /// module should be sure to set all the pixels. ImageData(Instance* instance, PP_ImageDataFormat format, const Size& size, bool init_to_zero); - /// This function decrements the reference count of this ImageData and - /// increments the reference count of the <code>other</code> ImageData. - /// This ImageData shares the underlying image resource with - /// <code>other</code>. + /// This function decrements the reference count of this + /// <code>ImageData</code> and increments the reference count of the + /// <code>other</code> <code>ImageData</code>. This <code>ImageData</code> + /// shares the underlying image resource with <code>other</code>. /// /// @param[in] other An other image data. + /// /// @return A new image data context. ImageData& operator=(const ImageData& other); - /// This function determines the browser's preferred format for images. - /// Using this format guarantees no extra conversions will occur when + /// GetNativeImageDataFormat() determines the browser's preferred format for + /// images. Using this format guarantees no extra conversions will occur when /// painting. /// - /// @return PP_ImageDataFormat containing the preferred format. + /// @return <code>PP_ImageDataFormat</code> containing the preferred format. static PP_ImageDataFormat GetNativeImageDataFormat(); /// A getter function for returning the current format for images. /// - /// @return PP_ImageDataFormat containing the preferred format. + /// @return <code>PP_ImageDataFormat</code> containing the preferred format. PP_ImageDataFormat format() const { return desc_.format; } /// A getter function for returning the image size. @@ -123,16 +109,18 @@ class ImageData : public Resource { /// This function is used retrieve the address of the given pixel for 32-bit /// pixel formats. /// - /// @param[in] coord A Point representing the x and y coordinates for a - /// specific pixel. + /// @param[in] coord A <code>Point</code> representing the x and y + /// coordinates for a specific pixel. + /// /// @return The address for the pixel. const uint32_t* GetAddr32(const Point& coord) const; /// This function is used retrieve the address of the given pixel for 32-bit /// pixel formats. /// - /// @param[in] coord A Point representing the x and y coordinates for a - /// specific pixel. + /// @param[in] coord A <code>Point</code> representing the x and y + /// coordinates for a specific pixel. + /// /// @return The address for the pixel. uint32_t* GetAddr32(const Point& coord); diff --git a/ppapi/cpp/non_thread_safe_ref_count.h b/ppapi/cpp/non_thread_safe_ref_count.h index d827209..0844eb7 100644 --- a/ppapi/cpp/non_thread_safe_ref_count.h +++ b/ppapi/cpp/non_thread_safe_ref_count.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -9,12 +9,17 @@ #include "ppapi/cpp/logging.h" #include "ppapi/cpp/module.h" +/// @file +/// This file defines the APIs for maintaining a reference counter. namespace pp { -// Simple ref-count that isn't thread safe. Note: in Debug mode, it checks that -// it is either called on the main thread, or always called on another thread. +/// A simple reference counter that is not thread-safe. <strong>Note:</strong> +/// in Debug mode, it checks that it is either called on the main thread, or +/// always called on another thread. class NonThreadSafeRefCount { public: + /// Default constructor. In debug mode, this checks that the object is being + /// created on the main thread. NonThreadSafeRefCount() : ref_(0) { #ifndef NDEBUG @@ -22,15 +27,22 @@ class NonThreadSafeRefCount { #endif } + /// Destructor. ~NonThreadSafeRefCount() { PP_DCHECK(is_main_thread_ == Module::Get()->core()->IsMainThread()); } + /// AddRef() increments the reference counter. + /// + /// @return An int32_t with the incremented reference counter. int32_t AddRef() { PP_DCHECK(is_main_thread_ == Module::Get()->core()->IsMainThread()); return ++ref_; } + /// Release() decrements the reference counter. + /// + /// @return An int32_t with the decremeneted reference counter. int32_t Release() { PP_DCHECK(is_main_thread_ == Module::Get()->core()->IsMainThread()); return --ref_; diff --git a/ppapi/cpp/point.h b/ppapi/cpp/point.h index 7d982c6..fb92c06 100644 --- a/ppapi/cpp/point.h +++ b/ppapi/cpp/point.h @@ -15,32 +15,32 @@ namespace pp { /// A 2 dimensional point with 0,0 being the upper-left starting coordinate. class Point { public: - /// A constructor for a point at 0,0. - Point() { + /// The default constructor for a point at 0,0. + Point() { point_.x = 0; point_.y = 0; } - /// A constructor accepting two int32_t values for x and y and converting - /// them to a Point. - /// @param[in] in_x An int32_t value representing a horizontal coordinate - /// of a point, starting with 0 as the left-most coordinate. - /// @param[in] in_y An int32_t value representing a vertical coordinate - /// of a point, starting with 0 as the top-most coordinate. - Point(int32_t in_x, int32_t in_y) { + /// A constructor accepting two int32_t values for x and y and converting + /// them to a Point. + /// @param[in] in_x An int32_t value representing a horizontal coordinate + /// of a point, starting with 0 as the left-most coordinate. + /// @param[in] in_y An int32_t value representing a vertical coordinate + /// of a point, starting with 0 as the top-most coordinate. + Point(int32_t in_x, int32_t in_y) { point_.x = in_x; point_.y = in_y; } - /// A constructor accepting a pointer to a PP_Point and converting the - /// PP_Point to a Point. This is an implicit conversion constructor. - /// @param[in] point A pointer to a PP_Point. - Point(const PP_Point& point) { // Implicit. + /// A constructor accepting a pointer to a PP_Point and converting the + /// PP_Point to a Point. This is an implicit conversion constructor. + /// @param[in] point A pointer to a PP_Point. + Point(const PP_Point& point) { // Implicit. point_.x = point.x; point_.y = point.y; } - /// Destructor. - ~Point() { + /// Destructor. + ~Point() { } /// A function allowing implicit conversion of a Point to a PP_Point. diff --git a/ppapi/cpp/rect.h b/ppapi/cpp/rect.h index 399b112..7d354df 100644 --- a/ppapi/cpp/rect.h +++ b/ppapi/cpp/rect.h @@ -19,8 +19,8 @@ namespace pp { class Rect { public: - /// The default constructor. Creates a Rect in the upper-left starting - /// coordinate at 0,0 and height and width of 0. + /// The default constructor. Creates a <code>Rect</code> in the upper-left + /// at 0,0 with height and width of 0. Rect() { rect_.point.x = 0; rect_.point.y = 0; @@ -28,9 +28,11 @@ class Rect { rect_.size.height = 0; } - /// A constructor accepting a reference to a PP_Rect and converting the - /// PP_Rect to a Rect. This is an implicit conversion constructor. - /// @param[in] rect A pointer to a PP_Rect. + /// A constructor accepting a reference to a <code>PP_Rect and</code> + /// converting the <code>PP_Rect</code> to a <code>Rect</code>. This is an + /// implicit conversion constructor. + /// + /// @param[in] rect A <code>PP_Rect</code>. Rect(const PP_Rect& rect) { // Implicit. set_x(rect.point.x); set_y(rect.point.y); @@ -39,8 +41,9 @@ class Rect { } /// A constructor accepting two int32_t values for width and height and - /// converting them to a Rect in the upper-left starting coordinate of - /// 0,0. + /// converting them to a <code>Rect</code> in the upper-left starting + /// coordinate of 0,0. + /// /// @param[in] w An int32_t value representing a width. /// @param[in] h An int32_t value representing a height. Rect(int32_t w, int32_t h) { @@ -51,6 +54,7 @@ class Rect { } /// A constructor accepting four int32_t values for width, height, x, and y. + /// /// @param[in] x An int32_t value representing a horizontal coordinate /// of a point, starting with 0 as the left-most coordinate. /// @param[in] y An int32_t value representing a vertical coordinate @@ -64,21 +68,25 @@ class Rect { set_height(h); } - /// A constructor accepting a pointer to a Size and converting the Size to a - /// Rect in the upper-left starting coordinate of 0,0. - /// @param[in] s A pointer to a Size. + /// A constructor accepting a pointer to a Size and converting the + /// <code>Size</code> to a <code>Rect</code> in the upper-left starting + /// coordinate of 0,0. + /// + /// @param[in] s A pointer to a <code>Size</code>. explicit Rect(const Size& s) { set_x(0); set_y(0); set_size(s); } - /// A constructor accepting a pointer to a Point representing the origin - /// of the rectangle and a pointer to a Size representing the height and - /// width. - /// @param[in] origin A pointer to a Point representing the upper-left - /// starting coordinate. - /// @param[in] size A pointer to a Size representing the height and width. + /// A constructor accepting a pointer to a <code>Point</code> representing + /// the origin of the rectangle and a pointer to a Size representing the + /// height and width. + /// + /// @param[in] origin A pointer to a <code>Point<code> representing the + /// upper-left starting coordinate. + /// @param[in] size A pointer to a <code>Size</code> representing the height + /// and width. Rect(const Point& origin, const Size& size) { set_point(origin); set_size(size); @@ -88,56 +96,66 @@ class Rect { ~Rect() { } - /// A function allowing implicit conversion of a Rect to a PP_Rect. - /// @return A Point. + /// PP_Rect() allows implicit conversion of a <code>Rect</code> to a + /// <code>PP_Rect</code>. + /// + /// @return A <code>Point</code>. operator PP_Rect() const { return rect_; } - /// Getter function for returning the internal PP_Rect struct. - /// @return A const reference to the internal PP_Rect struct. + /// Getter function for returning the internal <code>PP_Rect</code> struct. + /// + /// @return A const reference to the internal <code>PP_Rect</code> struct. const PP_Rect& pp_rect() const { return rect_; } - /// Getter function for returning the internal PP_Rect struct. - /// @return A mutable reference to the PP_Rect struct. + /// Getter function for returning the internal <code>PP_Rect</code> struct. + /// + /// @return A mutable reference to the <code>PP_Rect</code> struct. PP_Rect& pp_rect() { return rect_; } /// Getter function for returning the value of x. - /// @return The value of x for this Point. + /// + /// @return The value of x for this <code>Point</code>. int32_t x() const { return rect_.point.x; } /// Setter function for setting the value of x. + /// /// @param[in] in_x A new x value. void set_x(int32_t in_x) { rect_.point.x = in_x; } /// Getter function for returning the value of y. - /// @return The value of y for this Point. + /// + /// @return The value of y for this <code>Point</code>. int32_t y() const { return rect_.point.y; } /// Setter function for setting the value of y. + /// /// @param[in] in_y A new y value. void set_y(int32_t in_y) { rect_.point.y = in_y; } /// Getter function for returning the value of width. - /// @return The value of width for this Rect. + /// + /// @return The value of width for this <code>Rect</code>. int32_t width() const { return rect_.size.width; } /// Setter function for setting the value of width. + /// /// @param[in] w A new width value. void set_width(int32_t w) { if (w < 0) { @@ -148,12 +166,14 @@ class Rect { } /// Getter function for returning the value of height. - /// @return The value of height for this Rect. + /// + /// @return The value of height for this <code>Rect</code>. int32_t height() const { return rect_.size.height; } /// Setter function for setting the value of height. + /// /// @param[in] h A new width height. void set_height(int32_t h) { if (h < 0) { @@ -163,27 +183,32 @@ class Rect { rect_.size.height = h; } - /// Getter function for returning the Point. - /// @return A Point. + /// Getter function for returning the <code>Point</code>. + /// + /// @return A <code>Point</code>. Point point() const { return Point(rect_.point); } - /// Setter function for setting the value of the Point. - /// @param[in] origin A Point representing the upper-left + /// Setter function for setting the value of the <code>Point</code>. + /// + /// @param[in] origin A <code>Point</code> representing the upper-left /// starting coordinate. void set_point(const Point& origin) { rect_.point = origin; } - /// Getter function for returning the Size. + /// Getter function for returning the <code>Size</code>. + /// /// @return The size of the rectangle. Size size() const { return Size(rect_.size); } - /// Setter function for setting the Size. - /// @param[in] s A pointer to a Size representing the height and width. + /// Setter function for setting the <code>Size</code>. + /// + /// @param[in] s A pointer to a <code>Size</code> representing the height + /// and width. void set_size(const Size& s) { rect_.size.width = s.width(); rect_.size.height = s.height(); @@ -211,7 +236,8 @@ class Rect { return y() + height(); } - /// Setter function for setting the value of the Rect. + /// Setter function for setting the value of the <code>Rect</code>. + /// /// @param[in] x A new x value. /// @param[in] y A new y value. /// @param[in] w A new width value. @@ -223,14 +249,16 @@ class Rect { set_height(h); } - /// Setter function for setting the value of the Rect. - /// @param[in] rect A pointer to a PP_Rect. + /// Setter function for setting the value of the <code>Rect</code>. + /// + /// @param[in] rect A pointer to a <code>PP_Rect</code>. void SetRect(const PP_Rect& rect) { rect_ = rect; } - /// A function used to shrink the rectangle by a horizontal and vertical + /// Inset() shrinks the rectangle by a horizontal and vertical /// distance on all sides. + /// /// @param[in] horizontal An int32_t value representing a horizontal /// shrinking distance. /// @param[in] vertical An int32_t value representing a vertical @@ -239,8 +267,9 @@ class Rect { Inset(horizontal, vertical, horizontal, vertical); } - /// A function used to shrink the rectangle by the specified amount on each + /// Inset() shrinks the rectangle by the specified amount on each /// side. + /// /// @param[in] left An int32_t value representing a left /// shrinking distance. /// @param[in] top An int32_t value representing a top @@ -251,97 +280,116 @@ class Rect { /// shrinking distance. void Inset(int32_t left, int32_t top, int32_t right, int32_t bottom); - /// A function used to move the rectangle by a horizontal and vertical - /// distance. + /// Offset() moves the rectangle by a horizontal and vertical distance. + /// /// @param[in] horizontal An int32_t value representing a horzontal /// move distance. /// @param[in] vertical An int32_t value representing a vertical /// move distance. void Offset(int32_t horizontal, int32_t vertical); - /// A function used to move the rectangle by a horizontal and vertical - /// distance. - /// @param[in] point A pointer to a Point representing the horizontal and - /// vertical move distances. + /// Offset() moves the rectangle by a horizontal and vertical distance. + /// + /// @param[in] point A pointer to a <code>Point</code> representing the + /// horizontal and vertical move distances. void Offset(const Point& point) { Offset(point.x(), point.y()); } - /// A function used to determine if the area of a rectangle is zero. - /// Returns true if the area of the rectangle is zero. + /// IsEmpty() determines if the area of a rectangle is zero. Returns true if + /// the area of the rectangle is zero. + /// /// @return True if the area of the rectangle is zero. bool IsEmpty() const { return rect_.size.width == 0 && rect_.size.height == 0; } - /// A function used to determine if the point identified by point_x and - /// point_y falls inside this rectangle. The point (x, y) is inside the - /// rectangle, but the point (x + width, y + height) is not. + /// Contains() determines if the point identified by point_x and point_y + /// falls inside this rectangle. The point (x, y) is inside the rectangle, + /// but the point (x + width, y + height) is not. + /// /// @param[in] point_x An int32_t value representing a x value. /// @param[in] point_y An int32_t value representing a y value. + /// /// @return True if the point_x and point_y fall inside the rectangle. bool Contains(int32_t point_x, int32_t point_y) const; - /// A function used to determine if the specified point is contained by this + /// Contains() determines if the specified point is contained by this /// rectangle. + /// /// @param[in] point A pointer to a Point representing a 2D coordinate. + /// /// @return True if the point_x and point_y fall inside the rectangle. bool Contains(const Point& point) const { return Contains(point.x(), point.y()); } - /// A function used to determine if this rectangle contains the specified - /// rectangle. - /// @param[in] rect A pointer to a Rect. + /// Contains() determines if this rectangle contains the specified rectangle. + /// + /// @param[in] rect A pointer to a <code>Rect</code>. + /// /// @return True if the rectangle fall inside this rectangle. bool Contains(const Rect& rect) const; - /// A function used to determine if this rectangle intersects the specified + /// Insersects() determines if this rectangle intersects the specified /// rectangle. - /// @param[in] rect A pointer to a Rect. + /// + /// @param[in] rect A pointer to a <code>Rect</code>. + /// /// @return True if the rectangle intersects this rectangle. bool Intersects(const Rect& rect) const; - /// A function used to compute the intersection of this rectangle with the - /// given rectangle. - /// @param[in] rect A pointer to a Rect. - /// @return A Rect representing the intersection. + /// Intersect() computes the intersection of this rectangle with the given + /// rectangle. + /// + /// @param[in] rect A pointer to a <code>Rect</code>. + /// + /// @return A <code>Rect</code> representing the intersection. Rect Intersect(const Rect& rect) const; - /// A function used to compute the union of this rectangle with the given - /// rectangle. The union is the smallest rectangle containing both - /// rectangles. - /// @param[in] rect A pointer to a Rect. - /// @return A Rect representing the union. + /// Union() computes the union of this rectangle with the given rectangle. + /// The union is the smallest rectangle containing both rectangles. + /// + /// @param[in] rect A pointer to a <code>Rect</code>. + /// + /// @return A <code>Rect</code> representing the union. Rect Union(const Rect& rect) const; - /// A function used to compute the rectangle resulting from subtracting - /// |rect| from |this|. If |rect| does not intersect completely in either - /// the x- or y-direction, then |*this| is returned. If |rect| contains - /// |this|, then an empty Rect is returned. - /// @param[in] rect A pointer to a Rect. - /// @return A Rect representing the subtraction. + /// Subtract() computes the rectangle resulting from subtracting + /// <code>rect</code> from this Rect. If <code>rect</code>does not intersect + /// completely in either the x or y direction, then <code>*this</code> is + /// returned. If <code>rect<code> contains <code>this</code>, then an empty + /// <code>Rect</code> is returned. + /// + /// @param[in] rect A pointer to a <code>Rect</code>. + /// + /// @return A <code>Rect</code> representing the subtraction. Rect Subtract(const Rect& rect) const; - /// A function used to fit as much of the receiving rectangle within the - /// supplied rectangle as possible, returning the result. For example, if the - /// receiver had a x-location of 2 and a width of 4, and the supplied + /// AdjustToFit() fits as much of the receiving rectangle within + /// the supplied rectangle as possible, returning the result. For example, + /// if the receiver had a x-location of 2 and a width of 4, and the supplied /// rectangle had an x-location of 0 with a width of 5, the returned /// rectangle would have an x-location of 1 with a width of 4. - /// @param[in] rect A pointer to a Rect. - /// @return A Rect representing the difference between this rectangle and the - /// receiving rectangle. + /// + /// @param[in] rect A pointer to a <code>Rect</code>. + /// + /// @return A <code>Rect</code> representing the difference between this + /// rectangle and the receiving rectangle. Rect AdjustToFit(const Rect& rect) const; - /// A function used to determine the center of this rectangle. - /// @return A Point representing the center of this rectangle. + /// CenterPoint() determines the center of this rectangle. + /// + /// @return A <code>Point</code> representing the center of this rectangle. Point CenterPoint() const; - /// A function used to determine if this rectangle shares an entire edge + /// SharesEdgeWith() determines if this rectangle shares an entire edge /// (same width or same height) with the given rectangle, and the /// rectangles do not overlap. - /// @param[in] rect A pointer to a Rect. - /// @return TRUE if this rectangle and supplied rectangle share an edge. + /// + /// @param[in] rect A pointer to a <code>Rect</code>. + /// + /// @return true if this rectangle and supplied rectangle share an edge. bool SharesEdgeWith(const Rect& rect) const; private: @@ -350,10 +398,12 @@ class Rect { } // namespace pp -/// Determines whether the x, y, width, and height values of two rectangles and -/// are equal. -/// @param[in] lhs The Rect on the left-hand side of the equation. -/// @param[in] rhs The Rect on the right-hand side of the equation. +/// This function determines whether the x, y, width, and height values of two +/// rectangles and are equal. +/// +/// @param[in] lhs The <code>Rect</code> on the left-hand side of the equation. +/// @param[in] rhs The <code>Rect</code> on the right-hand side of the equation. +/// /// @return true if they are equal, false if unequal. inline bool operator==(const pp::Rect& lhs, const pp::Rect& rhs) { return lhs.x() == rhs.x() && @@ -362,9 +412,12 @@ inline bool operator==(const pp::Rect& lhs, const pp::Rect& rhs) { lhs.height() == rhs.height(); } -/// Determines whether two Rects are not equal. -/// @param[in] lhs The Rect on the left-hand side of the equation. -/// @param[in] rhs The Rect on the right-hand side of the equation. +/// This function determines whether two Rects are not equal. +/// +/// @param[in] lhs The <code>Rect</code> on the left-hand side of the equation. +/// @param[in] rhs The <code>Rect</code> on the right-hand side of the +/// equation. +/// /// @return true if the given Rects are equal, otherwise false. inline bool operator!=(const pp::Rect& lhs, const pp::Rect& rhs) { return !(lhs == rhs); diff --git a/ppapi/cpp/resource.h b/ppapi/cpp/resource.h index 8d22254..58e4856 100644 --- a/ppapi/cpp/resource.h +++ b/ppapi/cpp/resource.h @@ -8,7 +8,7 @@ #include "ppapi/c/pp_resource.h" /// @file -/// This file defines a Resource type representing data associated +/// This file defines a <code>Resource</code> type representing data associated /// with the module. namespace pp { @@ -21,13 +21,14 @@ class Resource { /// A constructor for copying a resource. /// - /// @param[in] other A Resource. + /// @param[in] other A <code>Resource</code>. Resource(const Resource& other); /// Destructor. virtual ~Resource(); - /// This function assigns one Resource to another Resource. + /// This function assigns one <code>Resource</code> to another + /// <code>Resource</code>. /// /// @param[in] other A Resource. /// @return A Resource containing the assigned Resource. @@ -47,25 +48,27 @@ class Resource { /// Note that the reference count on the resource is unchanged and the caller /// needs to release the resource. /// - /// @return The detached PP_Resource. + /// @return The detached <code>PP_Resource</code>. PP_Resource detach(); protected: - /// A constructor used when a PP_Resource is provided as a return value - /// whose reference count we need to increment. + /// A constructor used when a <code>PP_Resource</code> is provided as a + /// return value whose reference count we need to increment. /// - /// @param[in] resource A PP_Resource. + /// @param[in] resource A <code>PP_Resource</code>. explicit Resource(PP_Resource resource); - /// This function is called by derived class' constructors to initialize this - /// Resource with a PP_Resource that has already had its reference count - /// incremented by Core::AddRefResource. It also assumes this object has no + /// PassRefFromConstructor is called by derived class' constructors to + /// initialize this <code>Resource</code> with a <code>PP_Resource</code> + /// that has already had its reference count incremented by + /// <code>Core::AddRefResource</code>. It also assumes this object has no /// current resource. /// - /// The intended usage is that the derived class constructor will call the - /// default Resource constructor, then make a call to create a resource. It - /// then wants to assign the new resource (which, since it was returned by the - /// browser, is already AddRef'ed). + /// The intended usage of this function that the derived class constructor + /// will call the default <code>Resource</code> constructor, then make a call + /// to create a resource. It then wants to assign the new resource (which, + /// since it was returned by the browser, already had its reference count + /// increased). /// /// @param[in] resource A PP_Resource. void PassRefFromConstructor(PP_Resource resource); diff --git a/ppapi/cpp/size.h b/ppapi/cpp/size.h index 35bc493..9ee09ba 100644 --- a/ppapi/cpp/size.h +++ b/ppapi/cpp/size.h @@ -24,9 +24,11 @@ class Size { size_.height = 0; } - /// A constructor accepting a pointer to a PP_Size and converting the - /// PP_Size to a Size. This is an implicit conversion constructor. - /// @param[in] s A pointer to a PP_Size. + /// A constructor accepting a pointer to a <code>PP_Size</code> and + /// converting the <code>PP_Size</code> to a <code>Size</code>. This is an + /// implicit conversion constructor. + /// + /// @param[in] s A pointer to a <code>PP_Size</code>. Size(const PP_Size& s) { // Implicit. // Want the >= 0 checking of the setter. set_width(s.width); @@ -34,7 +36,8 @@ class Size { } /// A constructor accepting two int values for width and height and - /// converting them to a Size. + /// converting them to a <code>Size</code>. + /// /// @param[in] w An int value representing a width. /// @param[in] h An int value representing a height. Size(int w, int h) { @@ -47,31 +50,37 @@ class Size { ~Size() { } - /// A function allowing implicit conversion of a Size to a PP_Size. + /// PP_Size() allows implicit conversion of a <code>Size</code> to a + /// <code>PP_Size</code>. + /// /// @return A Size. operator PP_Size() { return size_; } - /// Getter function for returning the internal PP_Size struct. - /// @return A const reference to the internal PP_Size struct. + /// Getter function for returning the internal <code>PP_Size</code> struct. + /// + /// @return A const reference to the internal <code>PP_Size</code> struct. const PP_Size& pp_size() const { return size_; } - /// Getter function for returning the internal PP_Size struct. - /// @return A mutable reference to the PP_Size struct. + /// Getter function for returning the internal <code>PP_Size</code> struct. + /// + /// @return A mutable reference to the <code>PP_Size</code> struct. PP_Size& pp_size() { return size_; } /// Getter function for returning the value of width. - /// @return The value of width for this Size. + /// + /// @return The value of width for this <code>Size</code>. int width() const { return size_.width; } /// Setter function for setting the value of width. + /// /// @param[in] w A new width value. void set_width(int w) { if (w < 0) { @@ -82,12 +91,14 @@ class Size { } /// Getter function for returning the value of height. - /// @return The value of height for this Size. + /// + /// @return The value of height for this <code>Size</code>. int height() const { return size_.height; } /// Setter function for setting the value of height. + /// /// @param[in] h A new height value. void set_height(int h) { if (h < 0) { @@ -97,13 +108,15 @@ class Size { size_.height = h; } - /// A function for determining the area (width * height). + /// GetArea() determines the area (width * height). + /// /// @return The area int GetArea() const { return width() * height(); } - /// Setter function for setting the value of width and height. + /// SetSize() sets the value of width and height. + /// /// @param[in] w A new width value. /// @param[in] h A new height value. void SetSize(int w, int h) { @@ -111,7 +124,8 @@ class Size { set_height(h); } - /// A function used to enlarge the size of an object. + /// Enlarge() enlarges the size of an object. + /// /// @param[in] w A width to add the current width. /// @param[in] h A height to add to the current height. void Enlarge(int w, int h) { @@ -119,7 +133,8 @@ class Size { set_height(height() + h); } - /// A function used to determine if the size is zero. + /// IsEmpty() determines if the size is zero. + /// /// @return true if the size is zero. bool IsEmpty() const { // Size doesn't allow negative dimensions, so testing for 0 is enough. @@ -132,19 +147,25 @@ class Size { } // namespace pp -/// Determines whether the width and height values of two sizes are equal. -/// @param[in] lhs The Size on the left-hand side of the equation. -/// @param[in] rhs The Size on the right-hand side of the equation. +/// This function determines whether the width and height values of two sizes +/// are equal. +/// +/// @param[in] lhs The <code>Size</code> on the left-hand side of the equation. +/// @param[in] rhs The <code>Size</code> on the right-hand side of the +/// equation. +/// /// @return true if they are equal, false if unequal. inline bool operator==(const pp::Size& lhs, const pp::Size& rhs) { return lhs.width() == rhs.width() && lhs.height() == rhs.height(); } -/// Determines whether two Sizes are not equal. -/// @param[in] lhs The Size on the left-hand side of the equation. -/// @param[in] rhs The Size on the right-hand side of the equation. -/// @return true if the Size of lhs are equal to the Size -/// of rhs, otherwise false. +/// This function determines whether two <code>Sizes</code> are not equal. +/// +/// @param[in] lhs The <code>Size</code> on the left-hand side of the equation. +/// @param[in] rhs The <code>Size</code> on the right-hand side of the equation. +/// +/// @return true if the <code>Size</code> of lhs are equal to the +/// <code>Size</code> of rhs, otherwise false. inline bool operator!=(const pp::Size& lhs, const pp::Size& rhs) { return !(lhs == rhs); } |