Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_DEV_GRAPHICS_2D_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ |
| 6 #define PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ | 6 #define PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ |
| 7 | 7 |
| 8 #include "ppapi/cpp/graphics_2d.h" | 8 #include "ppapi/cpp/graphics_2d.h" |
| 9 | 9 |
| 10 namespace pp { | 10 namespace pp { |
| 11 | 11 |
| 12 // Graphics2DDev is a version of Graphics2D that exposes under-development APIs | 12 // Graphics2DDev is a version of Graphics2D that exposes under-development APIs |
| 13 // for HiDPI | 13 // for HiDPI |
| 14 class Graphics2DDev : public Graphics2D { | 14 class Graphics2D_Dev : public Graphics2D { |
|
Josh Horwich
2012/08/21 23:53:29
Just a reminder that we'll want to quickly rev cli
| |
| 15 public: | 15 public: |
| 16 /// Default constructor for creating an is_null() | 16 /// Default constructor for creating an is_null() |
| 17 /// <code>Graphics2DDev</code> object. | 17 /// <code>Graphics2D_Dev</code> object. |
| 18 Graphics2DDev() : Graphics2D() {} | 18 Graphics2D_Dev() : Graphics2D() {} |
| 19 | 19 |
| 20 // Constructor for creating a <code>Graphics2DDev</code> object from an | 20 // Constructor for creating a <code>Graphics2DDev</code> object from an |
| 21 // existing <code>Graphics2D</code> object. | 21 // existing <code>Graphics2D</code> object. |
| 22 Graphics2DDev(const Graphics2D& other) : Graphics2D(other) {} | 22 Graphics2D_Dev(const Graphics2D& other) : Graphics2D(other) {} |
| 23 | 23 |
| 24 virtual ~Graphics2DDev() {} | 24 virtual ~Graphics2D_Dev() {} |
| 25 | |
| 26 /// Returns true if SetScale and GetScale are supported. False if not. | |
| 27 static bool SupportsScale(); | |
| 25 | 28 |
| 26 /// SetScale() sets the scale factor that will be applied when painting the | 29 /// SetScale() sets the scale factor that will be applied when painting the |
| 27 /// graphics context onto the output device. Typically, if rendering at device | 30 /// graphics context onto the output device. Typically, if rendering at device |
| 28 /// resolution is desired, the context would be created with the width and | 31 /// resolution is desired, the context would be created with the width and |
| 29 /// height scaled up by the view's GetDeviceScale and SetScale called with a | 32 /// height scaled up by the view's GetDeviceScale and SetScale called with a |
| 30 /// scale of 1.0 / GetDeviceScale(). For example, if the view resource passed | 33 /// scale of 1.0 / GetDeviceScale(). For example, if the view resource passed |
| 31 /// to DidChangeView has a rectangle of (w=200, h=100) and a device scale of | 34 /// to DidChangeView has a rectangle of (w=200, h=100) and a device scale of |
| 32 /// 2.0, one would call Create with a size of (w=400, h=200) and then call | 35 /// 2.0, one would call Create with a size of (w=400, h=200) and then call |
| 33 /// SetScale with 0.5. One would then treat each pixel in the context as a | 36 /// SetScale with 0.5. One would then treat each pixel in the context as a |
| 34 /// single device pixel. | 37 /// single device pixel. |
| 35 /// | 38 /// |
| 36 /// @param[in] scale The scale to apply when painting. | 39 /// @param[in] scale The scale to apply when painting. |
| 37 /// | 40 /// |
| 38 /// @return Returns <code>true</code> on success or <code>false</code> | 41 /// @return Returns <code>true</code> on success or <code>false</code> |
| 39 /// if the resource is invalid or the scale factor is 0 or less. | 42 /// if the resource is invalid or the scale factor is 0 or less. |
| 40 bool SetScale(float scale); | 43 bool SetScale(float scale); |
| 41 | 44 |
| 42 /// GetScale() gets the scale factor that will be applied when painting the | 45 /// GetScale() gets the scale factor that will be applied when painting the |
| 43 /// graphics context onto the output device. | 46 /// graphics context onto the output device. |
| 44 /// | 47 /// |
| 45 /// @return Returns the scale factor for the graphics context. If the resource | 48 /// @return Returns the scale factor for the graphics context. If the resource |
| 46 /// is invalid, 0.0 will be returned. | 49 /// is invalid, 0.0 will be returned. |
| 47 float GetScale(); | 50 float GetScale(); |
| 48 }; | 51 }; |
| 49 | 52 |
| 50 } // namespace pp | 53 } // namespace pp |
| 51 | 54 |
| 52 #endif // PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ | 55 #endif // PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ |
| OLD | NEW |