Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: ppapi/cpp/graphics_2d.h

Issue 9381010: Convert resources to take an instance key instead of an Instance*. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_CPP_GRAPHICS_2D_H_ 5 #ifndef PPAPI_CPP_GRAPHICS_2D_H_
6 #define PPAPI_CPP_GRAPHICS_2D_H_ 6 #define PPAPI_CPP_GRAPHICS_2D_H_
7 7
8 #include "ppapi/c/pp_stdint.h" 8 #include "ppapi/c/pp_stdint.h"
9 #include "ppapi/cpp/resource.h" 9 #include "ppapi/cpp/resource.h"
10 #include "ppapi/cpp/size.h" 10 #include "ppapi/cpp/size.h"
11 11
12 12
13 /// @file 13 /// @file
14 /// This file defines the API to create a 2D graphics context in the browser. 14 /// This file defines the API to create a 2D graphics context in the browser.
15 namespace pp { 15 namespace pp {
16 16
17 class CompletionCallback; 17 class CompletionCallback;
18 class ImageData; 18 class ImageData;
19 class Instance; 19 class InstanceHandle;
20 class Point; 20 class Point;
21 class Rect; 21 class Rect;
22 22
23 class Graphics2D : public Resource { 23 class Graphics2D : public Resource {
24 public: 24 public:
25 /// Default constructor for creating an is_null() <code>Graphics2D</code> 25 /// Default constructor for creating an is_null() <code>Graphics2D</code>
26 /// object. 26 /// object.
27 Graphics2D(); 27 Graphics2D();
28 28
29 /// The copy constructor for Graphics2D. The underlying 2D context is not 29 /// The copy constructor for Graphics2D. The underlying 2D context is not
30 /// copied; this constructor creates another reference to the original 2D 30 /// copied; this constructor creates another reference to the original 2D
31 /// context. 31 /// context.
32 /// 32 ///
33 /// @param[in] other A pointer to a <code>Graphics2D</code> context. 33 /// @param[in] other A pointer to a <code>Graphics2D</code> context.
34 Graphics2D(const Graphics2D& other); 34 Graphics2D(const Graphics2D& other);
35 35
36 /// A constructor allocating a new 2D graphics context with the given size 36 /// A constructor allocating a new 2D graphics context with the given size
37 /// in the browser, resulting object will be is_null() if the allocation 37 /// in the browser, resulting object will be is_null() if the allocation
38 /// failed. 38 /// failed.
39 /// 39 ///
40 /// @param[in] instance The module instance. 40 /// @param[in] instance The instance with which this resource will be
41 /// associated.
42 ///
41 /// @param[in] size The size of the 2D graphics context in the browser, 43 /// @param[in] size The size of the 2D graphics context in the browser,
42 /// measured in device pixels. 44 /// measured in device pixels.
45 ///
43 /// @param[in] is_always_opaque Set the <code>is_always_opaque</code> flag 46 /// @param[in] is_always_opaque Set the <code>is_always_opaque</code> flag
44 /// to true if you know that you will be painting only opaque data to this 47 /// to true if you know that you will be painting only opaque data to this
45 /// context. This option will disable blending when compositing the module 48 /// context. This option will disable blending when compositing the module
46 /// with the web page, which might give higher performance on some computers. 49 /// with the web page, which might give higher performance on some computers.
47 /// 50 ///
48 /// If you set <code>is_always_opaque</code>, your alpha channel should 51 /// If you set <code>is_always_opaque</code>, your alpha channel should
49 /// always be set to 0xFF or there may be painting artifacts. The alpha values 52 /// always be set to 0xFF or there may be painting artifacts. The alpha values
50 /// overwrite the destination alpha values without blending when 53 /// overwrite the destination alpha values without blending when
51 /// <code>is_always_opaque</code> is true. 54 /// <code>is_always_opaque</code> is true.
52 Graphics2D(Instance* instance, const Size& size, bool is_always_opaque); 55 Graphics2D(const InstanceHandle& instance,
56 const Size& size,
57 bool is_always_opaque);
53 58
54 /// A destructor that decrements the reference count of a 59 /// A destructor that decrements the reference count of a
55 /// <code>Graphics2D</code> object made using the previous copy constructor. 60 /// <code>Graphics2D</code> object made using the previous copy constructor.
56 /// It is possible that the destructor does not toally destroy the underlying 61 /// It is possible that the destructor does not toally destroy the underlying
57 /// 2D context if there are outstanding references to it. 62 /// 2D context if there are outstanding references to it.
58 virtual ~Graphics2D(); 63 virtual ~Graphics2D();
59 64
60 /// This function assigns one 2D graphics context to this 2D graphics 65 /// This function assigns one 2D graphics context to this 2D graphics
61 /// context. This function increases the reference count of the 2D resource 66 /// context. This function increases the reference count of the 2D resource
62 /// of the other 2D graphics context while decrementing the reference counter 67 /// of the other 2D graphics context while decrementing the reference counter
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // for it. 260 // for it.
256 int32_t Flush(const CompletionCallback& cc); 261 int32_t Flush(const CompletionCallback& cc);
257 262
258 private: 263 private:
259 Size size_; 264 Size size_;
260 }; 265 };
261 266
262 } // namespace pp 267 } // namespace pp
263 268
264 #endif // PPAPI_CPP_GRAPHICS_2D_H_ 269 #endif // PPAPI_CPP_GRAPHICS_2D_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698