• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cstdint>
20 #include <string>
21 #include <type_traits>
22 
23 #include <math/mat4.h>
24 #include <ui/FloatRect.h>
25 #include <ui/Rect.h>
26 #include <ui/Region.h>
27 #include <ui/StretchEffect.h>
28 #include <ui/Transform.h>
29 
30 namespace android::compositionengine::impl {
31 
32 void dumpVal(std::string& out, const char* name, bool);
33 void dumpVal(std::string& out, const char* name, const void*);
34 void dumpVal(std::string& out, const char* name, int);
35 void dumpVal(std::string& out, const char* name, float);
36 void dumpVal(std::string& out, const char* name, uint32_t);
37 void dumpHex(std::string& out, const char* name, uint64_t);
38 void dumpVal(std::string& out, const char* name, const char* value);
39 void dumpVal(std::string& out, const char* name, const std::string& value);
40 
41 // For enums with named values
42 void dumpVal(std::string& out, const char* name, const char*, int);
43 void dumpVal(std::string& out, const char* name, const std::string&, int);
44 
45 template <typename EnumType>
dumpVal(std::string & out,const char * name,const char * valueName,EnumType value)46 void dumpVal(std::string& out, const char* name, const char* valueName, EnumType value) {
47     dumpVal(out, name, valueName, static_cast<std::underlying_type_t<EnumType>>(value));
48 }
49 
50 template <typename EnumType>
dumpVal(std::string & out,const char * name,const std::string & valueName,EnumType value)51 void dumpVal(std::string& out, const char* name, const std::string& valueName, EnumType value) {
52     dumpVal(out, name, valueName, static_cast<std::underlying_type_t<EnumType>>(value));
53 }
54 
55 void dumpVal(std::string& out, const char* name, const FloatRect& rect);
56 void dumpVal(std::string& out, const char* name, const Rect& rect);
57 void dumpVal(std::string& out, const char* name, const Region& region);
58 void dumpVal(std::string& out, const char* name, const ui::Transform&);
59 void dumpVal(std::string& out, const char* name, const ui::Size&);
60 
61 void dumpVal(std::string& out, const char* name, const mat4& tr);
62 void dumpVal(std::string& out, const char* name, const StretchEffect&);
63 
64 } // namespace android::compositionengine::impl
65