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

Side by Side Diff: ppapi/cpp/private/graphics_2d_private.h

Issue 10544168: Implement HiDPI support in Pepper dev interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_CPP_PRIVATE_GRAPHICS_2D_PRIVATE_H_
6 #define PPAPI_CPP_PRIVATE_GRAPHICS_2D_PRIVATE_H_
7
8 #include "ppapi/cpp/graphics_2d.h"
9
10 namespace pp {
11
12 // Graphics2DPrivate is a version of Graphics2D that exposes private APIs
13 // for HiDPI
14 class Graphics2DPrivate : public Graphics2D {
15 public:
16 /// Default constructor for creating an is_null()
17 /// <code>Graphics2DPrivate</code> object.
18 Graphics2DPrivate();
19
20 /// The copy constructor for Graphics2DPrivate. The underlying 2D context is
21 /// not copied; this constructor creates another reference to the original 2D
22 /// context.
23 ///
24 /// @param[in] other A pointer to a <code>Graphics2DPrivate</code> context.
25 Graphics2DPrivate(const Graphics2DPrivate& other);
26
27 /// A constructor allocating a new 2D graphics context with the given size
28 /// in the browser, resulting object will be is_null() if the allocation
29 /// failed.
30 ///
31 /// @param[in] instance The instance with which this resource will be
32 /// associated.
33 ///
34 /// @param[in] size The size of the 2D graphics context in the browser,
35 /// measured in density-independent pixels (DIPs). Note that using this
36 /// constructor will result in a 2D context with a scale between pixels in the
37 /// context and DIPs of 1.0.
38 ///
39 /// @param[in] is_always_opaque Set the <code>is_always_opaque</code> flag
40 /// to true if you know that you will be painting only opaque data to this
41 /// context. This option will disable blending when compositing the module
42 /// with the web page, which might give higher performance on some computers.
43 ///
44 /// If you set <code>is_always_opaque</code>, your alpha channel should
45 /// always be set to 0xFF or there may be painting artifacts. The alpha values
46 /// overwrite the destination alpha values without blending when
47 /// <code>is_always_opaque</code> is true.
48 Graphics2DPrivate(const InstanceHandle& instance,
49 const Size& size,
50 bool is_always_opaque);
51
52 /// A constructor allocating a new 2D graphics context with the given size and
53 /// scale factor in the browser, resulting object will be is_null() if the
54 /// allocation failed.
55 ///
56 /// @param[in] instance The instance with which this resource will be
57 /// associated.
58 ///
59 /// @param[in] size The size of the 2D graphics context in the browser,
60 /// measured in pixels. The browser will use the scale_factor to properly
61 /// map between 1 pixel in the context and 1 density-independent pixel on the
62 /// display.
63 ///
64 /// @param[in] is_always_opaque Set the <code>is_always_opaque</code> flag
65 /// to true if you know that you will be painting only opaque data to this
66 /// context. This option will disable blending when compositing the module
67 /// with the web page, which might give higher performance on some computers.
68 ///
69 /// If you set <code>is_always_opaque</code>, your alpha channel should
70 /// always be set to 0xFF or there may be painting artifacts. The alpha values
71 /// overwrite the destination alpha values without blending when
72 /// <code>is_always_opaque</code> is true.
73 ///
74 /// @param[in] scale The scaling factor between pixels in this context and
75 /// DIPs. For rendering at device resolution, this will typically be equal to
76 /// the device scale of the view resource passed to DidChangeView.
77 /// For example, if the view resource passed to DidChangeView has a rectangle
78 /// of (w=200, h=100) and a device scale of 2.0, one would call this
79 /// constructor with a size of (w=400, h=200) and a scale of 2.0, then treat
80 /// each pixel in the context as a single device pixel.
81 Graphics2DPrivate(const InstanceHandle& instance,
82 const Size& size,
83 bool is_always_opaque,
84 float scale);
85
86 /// A destructor that decrements the reference count of a
87 /// <code>Graphics2DPrivate</code> object made using the previous copy
88 /// constructor. It is possible that the destructor does not toally destroy
89 /// the underlying 2D context if there are outstanding references to it.
90 virtual ~Graphics2DPrivate();
91
92 /// This function assigns one 2D graphics cntext to this 2D graphics context.
93 /// This function increases the reference count of the 2D resource of the
94 /// other 2D graphics context while decrementing the reference counter
95 /// of this 2D graphics context.
96 ///
97 /// @param[in] other An other 2D graphics context.
98 ///
99 /// @return A new Graphics2DPrivate context.
100 Graphics2DPrivate& operator=(const Graphics2DPrivate& other);
101
102 /// Getter function for returning scale of the 2D graphics context.
103 float get_scale() const { return scale_; }
104
105 private:
106 float scale_;
107 };
108
109 } // namespace pp
110
111 #endif // PPAPI_CPP_PRIVATE_GRAPHICS_2D_PRIVATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698