blob: 935c7c854902b2109aa6e398e7c876dfcba179a1 [file] [log] [blame]
// Copyright 2020 The Fuchsia 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 "scoped_canvas.h"
ScopedCanvasId::ScopedCanvasId(ScopedCanvasId&& other) {
canvas_ = other.canvas_;
id_ = other.id_;
other.canvas_ = nullptr;
}
ScopedCanvasId& ScopedCanvasId::operator=(ScopedCanvasId&& other) {
Reset();
canvas_ = other.canvas_;
id_ = other.id_;
other.canvas_ = nullptr;
return *this;
}
void ScopedCanvasId::Reset() {
if (canvas_) {
canvas_->Free(id_);
}
canvas_ = nullptr;
id_ = 0;
}