Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_DEV_GRAPHICS_2D_DEV_H_ | |
| 6 #define PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ | |
| 7 | |
| 8 #include "ppapi/cpp/graphics_2d.h" | |
| 9 | |
| 10 namespace pp { | |
| 11 | |
| 12 // Graphics2DDev is a version of Graphics2D that exposes under-development APIs | |
| 13 // for HiDPI | |
| 14 class Graphics2DDev : public Graphics2D { | |
| 15 public: | |
| 16 /// Default constructor for creating an is_null() | |
| 17 /// <code>Graphics2DDev</code> object. | |
| 18 Graphics2DDev() : Graphics2D() {} | |
| 19 | |
| 20 // Constructor for creating a <code>Graphics2DDev</code> object from an | |
| 21 // existing <code>Graphics2D</code> object. | |
| 22 Graphics2DDev(const Graphics2D& other) : Graphics2D(other) {} | |
| 23 | |
| 24 virtual ~Graphics2DDev() {} | |
| 25 | |
| 26 /// SetScale() sets the scale factor that will be applied when painting the | |
| 27 /// graphics context onto the output device. Typically, if rendering at device | |
| 28 /// 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 | |
| 30 /// 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 | |
| 32 /// 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 | |
| 34 /// single device pixel. | |
| 35 /// | |
| 36 /// @param[in] scale The scale to apply when painting. | |
| 37 /// | |
| 38 /// @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. | |
| 40 bool SetScale(float scale); | |
| 41 | |
| 42 /// GetScale() gets the scale factor that will be applied when painting the | |
| 43 /// graphics context onto the output device. | |
|
brettw
2012/06/19 18:28:21
This should also specify the return value on error
Josh Horwich
2012/06/19 23:56:15
Done.
| |
| 44 float GetScale(); | |
| 45 }; | |
| 46 | |
| 47 } // namespace pp | |
| 48 | |
| 49 #endif // PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ | |
| OLD | NEW |