| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #include "ppapi/cpp/private/graphics_2d_private.h" |
| 6 |
| 7 #include "ppapi/c/private/ppb_graphics_2d_private.h" |
| 8 #include "ppapi/cpp/module_impl.h" |
| 9 |
| 10 namespace pp { |
| 11 |
| 12 namespace { |
| 13 |
| 14 template <> const char* interface_name<PPB_Graphics2D_Private_0_1>() { |
| 15 return PPB_GRAPHICS2D_PRIVATE_INTERFACE_0_1; |
| 16 } |
| 17 |
| 18 } // namespace |
| 19 |
| 20 Graphics2DPrivate::Graphics2DPrivate() |
| 21 : Graphics2D(), |
| 22 scale_(1.0f) { |
| 23 } |
| 24 |
| 25 Graphics2DPrivate::Graphics2DPrivate(const Graphics2DPrivate& other) |
| 26 : Graphics2D(other), |
| 27 scale_(other.scale_) { |
| 28 } |
| 29 |
| 30 Graphics2DPrivate::Graphics2DPrivate(const InstanceHandle& instance, |
| 31 const Size& size, |
| 32 bool is_always_opaque) |
| 33 : Graphics2D(instance, size, is_always_opaque), |
| 34 scale_(1.0f) { |
| 35 } |
| 36 |
| 37 Graphics2DPrivate::Graphics2DPrivate(const InstanceHandle& instance, |
| 38 const Size& size, |
| 39 bool is_always_opaque, |
| 40 float scale) |
| 41 : Graphics2D(), |
| 42 scale_(1.0f) { |
| 43 if (!has_interface<PPB_Graphics2D_Private_0_1>()) |
| 44 return; |
| 45 PassRefFromConstructor(get_interface<PPB_Graphics2D_Private_0_1>()->Create( |
| 46 instance.pp_instance(), |
| 47 &size.pp_size(), |
| 48 PP_FromBool(is_always_opaque), |
| 49 scale)); |
| 50 if (!is_null()) { |
| 51 // Only save size and scale if allocation succeeded |
| 52 size_ = size; |
| 53 scale_ = scale; |
| 54 } |
| 55 } |
| 56 |
| 57 Graphics2DPrivate::~Graphics2DPrivate() { |
| 58 } |
| 59 |
| 60 Graphics2DPrivate& Graphics2DPrivate::operator=(const Graphics2DPrivate& other) |
| 61 { |
| 62 Graphics2D::operator=(other); |
| 63 scale_ = other.scale_; |
| 64 return *this; |
| 65 } |
| 66 |
| 67 } // namespace pp |
| OLD | NEW |