1 /* 2 * Copyright 2020 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 package android.graphics; 18 19 import android.annotation.NonNull; 20 import android.util.proto.ProtoOutputStream; 21 22 /** 23 * Utility class for creating protos from parcelable Graphics classes. 24 * 25 * @hide 26 */ 27 @android.ravenwood.annotation.RavenwoodKeepWholeClass 28 public final class GraphicsProtos { 29 /** GraphicsProtos can never be an instance */ GraphicsProtos()30 private GraphicsProtos() {} 31 32 /** 33 * Write to a protocol buffer output stream. 34 * Protocol buffer message definition at {@link android.graphics.PointProto} 35 * 36 * @param point Point to serialize into a protocol buffer 37 * @param protoOutputStream Stream to write the Point object to. 38 * @param fieldId Field Id of the Point as defined in the parent message 39 * @hide 40 */ dumpPointProto( @onNull Point point, @NonNull ProtoOutputStream protoOutputStream, long fieldId)41 public static void dumpPointProto( 42 @NonNull Point point, @NonNull ProtoOutputStream protoOutputStream, long fieldId) { 43 final long token = protoOutputStream.start(fieldId); 44 protoOutputStream.write(PointProto.X, point.x); 45 protoOutputStream.write(PointProto.Y, point.y); 46 protoOutputStream.end(token); 47 } 48 } 49 50