chromium/cc/layers/heads_up_display_layer_impl.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/layers/heads_up_display_layer_impl.h"

#include <stddef.h>
#include <stdint.h>

#include <algorithm>
#include <iomanip>
#include <optional>
#include <utility>
#include <vector>

#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/shared_memory_mapping.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h"
#include "build/build_config.h"
#include "cc/debug/debug_colors.h"
#include "cc/metrics/dropped_frame_counter.h"
#include "cc/paint/display_item_list.h"
#include "cc/paint/image_provider.h"
#include "cc/paint/paint_canvas.h"
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_image_builder.h"
#include "cc/paint/paint_shader.h"
#include "cc/paint/record_paint_canvas.h"
#include "cc/paint/skia_paint_canvas.h"
#include "cc/resources/memory_history.h"
#include "cc/trees/layer_tree_frame_sink.h"
#include "cc/trees/layer_tree_host_impl.h"
#include "cc/trees/layer_tree_impl.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
#include "components/viz/common/gpu/raster_context_provider.h"
#include "components/viz/common/quads/solid_color_draw_quad.h"
#include "components/viz/common/quads/texture_draw_quad.h"
#include "components/viz/common/resources/bitmap_allocation.h"
#include "components/viz/common/resources/platform_color.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/raster_interface.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/shared_image_trace_utils.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/ipc/client/client_shared_image_interface.h"
#include "skia/ext/legacy_display_globals.h"
#include "third_party/skia/include/core/SkFont.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "third_party/skia/include/core/SkTextBlob.h"
#include "third_party/skia/include/core/SkTypeface.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gl/trace_util.h"

namespace cc {

namespace {

void DrawArc(PaintCanvas* canvas,
             const SkRect& oval,
             SkScalar start_angle,
             SkScalar sweep_angle,
             const PaintFlags& flags) {}

class DummyImageProvider : public ImageProvider {};

std::string ToStringTwoDecimalPrecision(double input) {}

#if BUILDFLAG(IS_ANDROID)
struct MetricsDrawSizes {
  const int kTopPadding = 35;
  const int kPadding = 15;
  const int kFontHeight = 32;
  const int kWidth = 525;
  const int kSidePadding = 20;
  const int kBadgeWidth = 25;
} constexpr metrics_sizes;
#else
struct MetricsDrawSizes {} constexpr metrics_sizes;
#endif

constexpr int ComputeTotalHeight(int num_of_lines) {}
}  // namespace

HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(
    LayerTreeImpl* tree_impl,
    int id,
    const std::string& paused_localized_message)
    :{}

HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {}

mojom::LayerType HeadsUpDisplayLayerImpl::GetLayerType() const {}

std::unique_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl(
    LayerTreeImpl* tree_impl) const {}

class HudGpuBacking : public ResourcePool::GpuBacking {};

class HudSoftwareBacking : public ResourcePool::SoftwareBacking {};

bool HeadsUpDisplayLayerImpl::WillDraw(
    DrawMode draw_mode,
    viz::ClientResourceProvider* resource_provider) {}

void HeadsUpDisplayLayerImpl::DidDraw(
    viz::ClientResourceProvider* resource_provider) {}

void HeadsUpDisplayLayerImpl::AppendQuads(
    viz::CompositorRenderPass* render_pass,
    AppendQuadsData* append_quads_data) {}

void HeadsUpDisplayLayerImpl::UpdateHudTexture(
    DrawMode draw_mode,
    LayerTreeFrameSink* layer_tree_frame_sink,
    viz::ClientResourceProvider* resource_provider,
    const RasterCapabilities& raster_caps,
    const viz::CompositorRenderPassList& list) {}

void HeadsUpDisplayLayerImpl::ReleaseResources() {}

gfx::Rect HeadsUpDisplayLayerImpl::GetEnclosingVisibleRectInTargetSpace()
    const {}

void HeadsUpDisplayLayerImpl::SetHUDTypeface(sk_sp<SkTypeface> typeface) {}

const std::vector<gfx::Rect>& HeadsUpDisplayLayerImpl::LayoutShiftRects()
    const {}

void HeadsUpDisplayLayerImpl::SetLayoutShiftRects(
    const std::vector<gfx::Rect>& rects) {}

void HeadsUpDisplayLayerImpl::ClearLayoutShiftRects() {}

void HeadsUpDisplayLayerImpl::SetWebVitalMetrics(
    std::unique_ptr<WebVitalMetrics> web_vital_metrics) {}

void HeadsUpDisplayLayerImpl::PushPropertiesTo(LayerImpl* layer) {}

void HeadsUpDisplayLayerImpl::UpdateHudContents() {}

void HeadsUpDisplayLayerImpl::DrawHudContents(PaintCanvas* canvas) {}

void HeadsUpDisplayLayerImpl::DrawDebuggerPaused(PaintCanvas* canvas) {}

void HeadsUpDisplayLayerImpl::DrawText(PaintCanvas* canvas,
                                       const PaintFlags& flags,
                                       const std::string& text,
                                       TextAlign align,
                                       int size,
                                       int x,
                                       int y) const {}

void HeadsUpDisplayLayerImpl::DrawText(PaintCanvas* canvas,
                                       const PaintFlags& flags,
                                       const std::string& text,
                                       TextAlign align,
                                       int size,
                                       const SkPoint& pos) const {}

void HeadsUpDisplayLayerImpl::DrawGraphBackground(PaintCanvas* canvas,
                                                  PaintFlags* flags,
                                                  const SkRect& bounds) const {}

void HeadsUpDisplayLayerImpl::DrawGraphLines(PaintCanvas* canvas,
                                             PaintFlags* flags,
                                             const SkRect& bounds) const {}

void HeadsUpDisplayLayerImpl::DrawSeparatorLine(PaintCanvas* canvas,
                                                PaintFlags* flags,
                                                const SkRect& bounds) const {}

SkRect HeadsUpDisplayLayerImpl::DrawFrameThroughputDisplay(
    PaintCanvas* canvas,
    const DroppedFrameCounter* dropped_frame_counter,
    int right,
    int top) const {}

SkRect HeadsUpDisplayLayerImpl::DrawMemoryDisplay(PaintCanvas* canvas,
                                                  int right,
                                                  int top,
                                                  int width) const {}

SkRect HeadsUpDisplayLayerImpl::DrawGpuRasterizationStatus(PaintCanvas* canvas,
                                                           int right,
                                                           int top,
                                                           int width) const {}

void HeadsUpDisplayLayerImpl::DrawDebugRect(
    PaintCanvas* canvas,
    PaintFlags* flags,
    const DebugRect& rect,
    SkColor4f stroke_color,
    SkColor4f fill_color,
    float stroke_width,
    const std::string& label_text) const {}

void HeadsUpDisplayLayerImpl::DrawDebugRects(
    PaintCanvas* canvas,
    DebugRectHistory* debug_rect_history) {}

int HeadsUpDisplayLayerImpl::DrawSingleMetric(
    PaintCanvas* canvas,
    int left,
    int right,
    int top,
    std::string name,
    const WebVitalMetrics::MetricsInfo& info,
    bool has_value,
    double value) const {}

SkRect HeadsUpDisplayLayerImpl::DrawWebVitalMetrics(PaintCanvas* canvas,
                                                    int left,
                                                    int top,
                                                    int width) const {}

int HeadsUpDisplayLayerImpl::DrawSinglePercentageMetric(PaintCanvas* canvas,
                                                        int left,
                                                        int right,
                                                        int top,
                                                        std::string name,
                                                        double value) const {}

SkRect HeadsUpDisplayLayerImpl::DrawSmoothnessMetrics(PaintCanvas* canvas,
                                                      int left,
                                                      int top,
                                                      int width) const {}

void HeadsUpDisplayLayerImpl::AsValueInto(
    base::trace_event::TracedValue* dict) const {}

}  // namespace cc