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

Unified Diff: ppapi/cpp/graphics_2d.h

Issue 12989006: Move HiDPI-related Pepper interfaces to stable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win build, add test Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/cpp/graphics_2d.h
diff --git a/ppapi/cpp/graphics_2d.h b/ppapi/cpp/graphics_2d.h
index 0ce664163eda867c92e6ca3a428ad68261c1c38f..31d04f2bbe07993a70967597cd9b8c771c5cc7d9 100644
--- a/ppapi/cpp/graphics_2d.h
+++ b/ppapi/cpp/graphics_2d.h
@@ -260,6 +260,32 @@ class Graphics2D : public Resource {
// for it.
int32_t Flush(const CompletionCallback& cc);
+ /// Returns true if SetScale and GetScale are supported. False if not.
+ static bool SupportsScale();
dmichael (off chromium) 2013/03/28 21:38:29 Hmm, I don't think we usually have this kind of fu
Josh Horwich 2013/03/29 20:54:23 I originally was worried about cases where view di
+
+ /// SetScale() sets the scale factor that will be applied when painting the
+ /// graphics context onto the output device. Typically, if rendering at device
+ /// resolution is desired, the context would be created with the width and
+ /// height scaled up by the view's GetDeviceScale and SetScale called with a
+ /// scale of 1.0 / GetDeviceScale(). For example, if the view resource passed
+ /// to DidChangeView has a rectangle of (w=200, h=100) and a device scale of
+ /// 2.0, one would call Create with a size of (w=400, h=200) and then call
+ /// SetScale with 0.5. One would then treat each pixel in the context as a
+ /// single device pixel.
+ ///
+ /// @param[in] scale The scale to apply when painting.
+ ///
+ /// @return Returns <code>true</code> on success or <code>false</code>
+ /// if the resource is invalid or the scale factor is 0 or less.
+ bool SetScale(float scale);
+
+ /// GetScale() gets the scale factor that will be applied when painting the
+ /// graphics context onto the output device.
+ ///
+ /// @return Returns the scale factor for the graphics context. If the resource
+ /// is invalid, 0.0 will be returned.
+ float GetScale();
dmichael (off chromium) 2013/03/28 21:38:29 It would be good to mention somewhere that the def
Josh Horwich 2013/03/29 20:54:23 Done.
+
private:
Size size_;
};

Powered by Google App Engine
This is Rietveld 408576698