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

Unified Diff: ppapi/proxy/graphics_2d_resource.cc

Issue 1881603002: Added SetLayerTransform to PPAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added Graphics2D 1.2 to histograms Created 4 years, 8 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
« no previous file with comments | « ppapi/proxy/graphics_2d_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/graphics_2d_resource.cc
diff --git a/ppapi/proxy/graphics_2d_resource.cc b/ppapi/proxy/graphics_2d_resource.cc
index 3b91a6a493b99c6f64422b43b235272b66f301f6..8bfea9d57ea30a4149d555fe9aaaab5668d093ab 100644
--- a/ppapi/proxy/graphics_2d_resource.cc
+++ b/ppapi/proxy/graphics_2d_resource.cc
@@ -113,6 +113,20 @@ float Graphics2DResource::GetScale() {
return scale_;
}
+PP_Bool Graphics2DResource::SetLayerTransform(float scale,
+ const PP_Point* origin,
+ const PP_Point* translate) {
+ if (scale <= 0.0f)
+ return PP_FALSE;
+ // Adding the origin to the transform.
+ PP_FloatPoint translate_with_origin;
+ translate_with_origin.x = (1 - scale) * origin->x - translate->x;
+ translate_with_origin.y = (1 - scale) * origin->y - translate->y;
+ Post(RENDERER,
+ PpapiHostMsg_Graphics2D_SetLayerTransform(scale, translate_with_origin));
+ return PP_TRUE;
+}
+
int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) {
// If host is not even created, return failure immediately. This can happen
// when failed to initialize (in constructor).
« no previous file with comments | « ppapi/proxy/graphics_2d_resource.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698