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