blob: dec31d715c7b37a879c3dc056db671630c6bc72a [file] [log] [blame]
Greg Daniel1d3c8c12020-09-23 14:23:36 -04001/*
2 * Copyright 2020 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "include/gpu/GrBackendSurfaceMutableState.h"
9
10#include <new>
11
12GrBackendSurfaceMutableState::GrBackendSurfaceMutableState(const GrBackendSurfaceMutableState& that)
13 : fBackend(that.fBackend), fIsValid(that.fIsValid) {
14 if (!fIsValid) {
15 return;
16 }
17 switch (fBackend) {
18 case GrBackend::kVulkan:
19#ifdef SK_VULKAN
20 SkASSERT(that.fBackend == GrBackend::kVulkan);
21 fVkState = that.fVkState;
22#endif
23 break;
24 default:
25 (void)that;
26 SkUNREACHABLE;
27 }
28}
29
30GrBackendSurfaceMutableState& GrBackendSurfaceMutableState::operator=(
31 const GrBackendSurfaceMutableState& that) {
32 if (this != &that) {
33 this->~GrBackendSurfaceMutableState();
34 new (this) GrBackendSurfaceMutableState(that);
35 }
36 return *this;
37}
38