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

Side by Side Diff: ppapi/cpp/dev/graphics_2d_dev.cc

Issue 10832428: Add a query function for the scaling feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fixed Created 8 years, 4 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
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/cpp/dev/graphics_2d_dev.h" 5 #include "ppapi/cpp/dev/graphics_2d_dev.h"
6 6
7 #include "ppapi/c/dev/ppb_graphics_2d_dev.h" 7 #include "ppapi/c/dev/ppb_graphics_2d_dev.h"
8 #include "ppapi/cpp/module_impl.h" 8 #include "ppapi/cpp/module_impl.h"
9 9
10 namespace pp { 10 namespace pp {
11 11
12 namespace { 12 namespace {
13 13
14 template <> const char* interface_name<PPB_Graphics2D_Dev>() { 14 template <> const char* interface_name<PPB_Graphics2D_Dev>() {
15 return PPB_GRAPHICS2D_DEV_INTERFACE; 15 return PPB_GRAPHICS2D_DEV_INTERFACE;
16 } 16 }
17 17
18 } // namespace 18 } // namespace
19 19
20 bool Graphics2DDev::SetScale(float scale) { 20 // static
21 bool Graphics2D_Dev::SupportsScale() {
22 return has_interface<PPB_Graphics2D_Dev>();
23 }
24
25 bool Graphics2D_Dev::SetScale(float scale) {
21 if (!has_interface<PPB_Graphics2D_Dev>()) 26 if (!has_interface<PPB_Graphics2D_Dev>())
22 return false; 27 return false;
23 return PP_ToBool(get_interface<PPB_Graphics2D_Dev>()->SetScale(pp_resource(), 28 return PP_ToBool(get_interface<PPB_Graphics2D_Dev>()->SetScale(pp_resource(),
24 scale)); 29 scale));
25 } 30 }
26 31
27 float Graphics2DDev::GetScale() { 32 float Graphics2D_Dev::GetScale() {
28 if (!has_interface<PPB_Graphics2D_Dev>()) 33 if (!has_interface<PPB_Graphics2D_Dev>())
29 return 1.0f; 34 return 1.0f;
30 return get_interface<PPB_Graphics2D_Dev>()->GetScale(pp_resource()); 35 return get_interface<PPB_Graphics2D_Dev>()->GetScale(pp_resource());
31 } 36 }
32 37
33 } // namespace pp 38 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698