• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 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 #ifndef PROTOHELPERS_H
17 #define PROTOHELPERS_H
18 
19 #include "Rect.h"
20 #include "protos/hwui.pb.h"
21 
22 namespace android {
23 namespace uirenderer {
24 
set(proto::RectF * dest,const Rect & src)25 void set(proto::RectF* dest, const Rect& src) {
26     dest->set_left(src.left);
27     dest->set_top(src.top);
28     dest->set_right(src.right);
29     dest->set_bottom(src.bottom);
30 }
31 
set(std::string * dest,const SkPath & src)32 void set(std::string* dest, const SkPath& src) {
33     size_t size = src.writeToMemory(nullptr);
34     dest->resize(size);
35     src.writeToMemory(&*dest->begin());
36 }
37 
38 } // namespace uirenderer
39 } // namespace android
40 
41 #endif // PROTOHELPERS_H
42