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

Side by Side Diff: ppapi/thunk/ppb_graphics_2d_thunk.cc

Issue 10544168: Implement HiDPI support in Pepper dev interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/thunk/ppb_graphics_2d_api.h ('k') | ppapi/thunk/ppb_view_thunk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ppapi/c/dev/ppb_graphics_2d_dev.h"
5 #include "ppapi/c/pp_completion_callback.h" 6 #include "ppapi/c/pp_completion_callback.h"
6 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
7 #include "ppapi/c/ppb_graphics_2d.h" 8 #include "ppapi/c/ppb_graphics_2d.h"
8 #include "ppapi/shared_impl/tracked_callback.h" 9 #include "ppapi/shared_impl/tracked_callback.h"
9 #include "ppapi/thunk/enter.h" 10 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/ppb_graphics_2d_api.h" 11 #include "ppapi/thunk/ppb_graphics_2d_api.h"
11 #include "ppapi/thunk/resource_creation_api.h" 12 #include "ppapi/thunk/resource_creation_api.h"
12 #include "ppapi/thunk/thunk.h" 13 #include "ppapi/thunk/thunk.h"
13 14
14 namespace ppapi { 15 namespace ppapi {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 enter.object()->ReplaceContents(image_data); 72 enter.object()->ReplaceContents(image_data);
72 } 73 }
73 74
74 int32_t Flush(PP_Resource graphics_2d, PP_CompletionCallback callback) { 75 int32_t Flush(PP_Resource graphics_2d, PP_CompletionCallback callback) {
75 EnterGraphics2D enter(graphics_2d, callback, true); 76 EnterGraphics2D enter(graphics_2d, callback, true);
76 if (enter.failed()) 77 if (enter.failed())
77 return enter.retval(); 78 return enter.retval();
78 return enter.SetResult(enter.object()->Flush(enter.callback())); 79 return enter.SetResult(enter.object()->Flush(enter.callback()));
79 } 80 }
80 81
82 PP_Bool SetScale(PP_Resource graphics_2d, float scale) {
83 EnterGraphics2D enter(graphics_2d, true);
84 if (enter.failed())
85 return PP_FALSE;
86 return PP_FromBool(enter.object()->SetScale(scale));
87 }
88
89 float GetScale(PP_Resource graphics_2d) {
90 EnterGraphics2D enter(graphics_2d, true);
91 if (enter.failed())
92 return 0.0f;
93 return enter.object()->GetScale();
94 }
95
81 const PPB_Graphics2D g_ppb_graphics_2d_thunk = { 96 const PPB_Graphics2D g_ppb_graphics_2d_thunk = {
82 &Create, 97 &Create,
83 &IsGraphics2D, 98 &IsGraphics2D,
84 &Describe, 99 &Describe,
85 &PaintImageData, 100 &PaintImageData,
86 &Scroll, 101 &Scroll,
87 &ReplaceContents, 102 &ReplaceContents,
88 &Flush 103 &Flush
89 }; 104 };
90 105
106 const PPB_Graphics2D_Dev g_ppb_graphics_2d_dev_thunk = {
107 &SetScale,
108 &GetScale
109 };
110
91 } // namespace 111 } // namespace
92 112
93 const PPB_Graphics2D_1_0* GetPPB_Graphics2D_1_0_Thunk() { 113 const PPB_Graphics2D_1_0* GetPPB_Graphics2D_1_0_Thunk() {
94 return &g_ppb_graphics_2d_thunk; 114 return &g_ppb_graphics_2d_thunk;
95 } 115 }
96 116
117 const PPB_Graphics2D_Dev_0_1* GetPPB_Graphics2D_Dev_0_1_Thunk() {
118 return &g_ppb_graphics_2d_dev_thunk;
119 }
120
97 } // namespace thunk 121 } // namespace thunk
98 } // namespace ppapi 122 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_graphics_2d_api.h ('k') | ppapi/thunk/ppb_view_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698