/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

syntax = "proto2";

import "protos/perfetto/trace/android/graphics/rect.proto";

package perfetto.protos;

message RegionProto {
  // Previously: uint64 id
  reserved 1;
  repeated RectProto rect = 2;
}

message SizeProto {
  optional int32 w = 1;
  optional int32 h = 2;
}

message TransformProto {
  optional float dsdx = 1;
  optional float dtdx = 2;
  optional float dsdy = 3;
  optional float dtdy = 4;
  optional int32 type = 5;
}

message ColorProto {
  optional float r = 1;
  optional float g = 2;
  optional float b = 3;
  optional float a = 4;
}

message InputWindowInfoProto {
  optional uint32 layout_params_flags = 1;
  optional int32 layout_params_type = 2;
  optional RectProto frame = 3;
  optional RegionProto touchable_region = 4;

  optional int32 surface_inset = 5;
  optional bool visible = 6;
  optional bool can_receive_keys = 7 [deprecated = true];
  optional bool focusable = 8;
  optional bool has_wallpaper = 9;

  optional float global_scale_factor = 10;
  optional float window_x_scale = 11 [deprecated = true];
  optional float window_y_scale = 12 [deprecated = true];

  optional int32 crop_layer_id = 13;
  optional bool replace_touchable_region_with_crop = 14;
  optional RectProto touchable_region_crop = 15;
  optional TransformProto transform = 16;
  optional uint32 input_config = 17;
}

message BlurRegion {
  optional uint32 blur_radius = 1;
  optional uint32 corner_radius_tl = 2 [deprecated = true];
  optional uint32 corner_radius_tr = 3 [deprecated = true];
  optional uint32 corner_radius_bl = 4 [deprecated = true];
  optional float corner_radius_br = 5 [deprecated = true];
  optional float corner_radius_tlx = 11;
  optional float corner_radius_tly = 12;
  optional float corner_radius_trx = 13;
  optional float corner_radius_try = 14;
  optional float corner_radius_blx = 15;
  optional float corner_radius_bly = 16;
  optional float corner_radius_brx = 17;
  optional float corner_radius_bry = 18;
  optional float alpha = 6;
  optional int32 left = 7;
  optional int32 top = 8;
  optional int32 right = 9;
  optional int32 bottom = 10;
}

message ColorTransformProto {
  // This will be a 4x4 matrix of float values
  repeated float val = 1 [packed = true];
}

enum TrustedOverlay {
  UNSET = 0;
  DISABLED = 1;
  ENABLED = 2;
};
message BoxShadowSettings {
  message BoxShadowParams {
    optional float blur_radius = 1;
    optional float spread_radius = 2;
    optional int32 color = 3;
    optional float offset_x = 4;
    optional float offset_y = 5;
  }
  repeated BoxShadowParams box_shadows = 1;
}

message BorderSettings {
  optional float stroke_width = 1;
  optional int32 color = 2;
}