| Index: ppapi/cpp/private/graphics_2d_private.cc
|
| diff --git a/ppapi/cpp/private/graphics_2d_private.cc b/ppapi/cpp/private/graphics_2d_private.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4caa91fd4318d09eb7bfc692faf5fc44409db090
|
| --- /dev/null
|
| +++ b/ppapi/cpp/private/graphics_2d_private.cc
|
| @@ -0,0 +1,67 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ppapi/cpp/private/graphics_2d_private.h"
|
| +
|
| +#include "ppapi/c/private/ppb_graphics_2d_private.h"
|
| +#include "ppapi/cpp/module_impl.h"
|
| +
|
| +namespace pp {
|
| +
|
| +namespace {
|
| +
|
| +template <> const char* interface_name<PPB_Graphics2D_Private_0_1>() {
|
| + return PPB_GRAPHICS2D_PRIVATE_INTERFACE_0_1;
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| +Graphics2DPrivate::Graphics2DPrivate()
|
| + : Graphics2D(),
|
| + scale_(1.0f) {
|
| +}
|
| +
|
| +Graphics2DPrivate::Graphics2DPrivate(const Graphics2DPrivate& other)
|
| + : Graphics2D(other),
|
| + scale_(other.scale_) {
|
| +}
|
| +
|
| +Graphics2DPrivate::Graphics2DPrivate(const InstanceHandle& instance,
|
| + const Size& size,
|
| + bool is_always_opaque)
|
| + : Graphics2D(instance, size, is_always_opaque),
|
| + scale_(1.0f) {
|
| +}
|
| +
|
| +Graphics2DPrivate::Graphics2DPrivate(const InstanceHandle& instance,
|
| + const Size& size,
|
| + bool is_always_opaque,
|
| + float scale)
|
| + : Graphics2D(),
|
| + scale_(1.0f) {
|
| + if (!has_interface<PPB_Graphics2D_Private_0_1>())
|
| + return;
|
| + PassRefFromConstructor(get_interface<PPB_Graphics2D_Private_0_1>()->Create(
|
| + instance.pp_instance(),
|
| + &size.pp_size(),
|
| + PP_FromBool(is_always_opaque),
|
| + scale));
|
| + if (!is_null()) {
|
| + // Only save size and scale if allocation succeeded
|
| + size_ = size;
|
| + scale_ = scale;
|
| + }
|
| +}
|
| +
|
| +Graphics2DPrivate::~Graphics2DPrivate() {
|
| +}
|
| +
|
| +Graphics2DPrivate& Graphics2DPrivate::operator=(const Graphics2DPrivate& other)
|
| +{
|
| + Graphics2D::operator=(other);
|
| + scale_ = other.scale_;
|
| + return *this;
|
| +}
|
| +
|
| +} // namespace pp
|
|
|