flutter_flutter/lib/ui/window/pointer_data_packet.cc
Chris Bracken 16b900b63e
Prefer C++ standard headers to their C counterpart (#21091)
We currently use a mix of C standard includes (e.g. limits.h) and their
C++ variants (e.g. climits). This migrates to a consistent style for all
cases where the C++ variants are acceptable, but leaves the C
equivalents in place where they are required, such as in the embedder
API and other headers that may be used from C.
2020-09-11 17:10:00 -07:00

24 lines
694 B
C++

// Copyright 2013 The Flutter 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 "flutter/lib/ui/window/pointer_data_packet.h"
#include <cstring>
namespace flutter {
PointerDataPacket::PointerDataPacket(size_t count)
: data_(count * sizeof(PointerData)) {}
PointerDataPacket::PointerDataPacket(uint8_t* data, size_t num_bytes)
: data_(data, data + num_bytes) {}
PointerDataPacket::~PointerDataPacket() = default;
void PointerDataPacket::SetPointerData(size_t i, const PointerData& data) {
memcpy(&data_[i * sizeof(PointerData)], &data, sizeof(PointerData));
}
} // namespace flutter