// ui/gfx/mojom/font_render_params.mojom-shared.cc is auto generated by mojom_bindings_generator.py, do not edit

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

#include "ui/gfx/mojom/font_render_params.mojom-shared.h"
#include <ostream>
#include <utility>
#include "base/strings/stringprintf.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "ui/gfx/mojom/font_render_params.mojom-params-data.h"
namespace gfx {
namespace mojom {

NOINLINE static const char* HintingToStringHelper(Hinting value) {
  // Defined in a helper function to ensure that Clang generates a lookup table.
  switch(value) {
    case Hinting::kNone:
      return "kNone";
    case Hinting::kSlight:
      return "kSlight";
    case Hinting::kMedium:
      return "kMedium";
    case Hinting::kFull:
      return "kFull";
    default:
      return nullptr;
  }
}

std::string HintingToString(Hinting value) {
  const char *str = HintingToStringHelper(value);
  if (!str) {
    return base::StringPrintf("Unknown Hinting value: %i", static_cast<int32_t>(value));
  }
  return str;
}

std::ostream& operator<<(std::ostream& os, Hinting value) {
  return os << HintingToString(value);
}

NOINLINE static const char* SubpixelRenderingToStringHelper(SubpixelRendering value) {
  // Defined in a helper function to ensure that Clang generates a lookup table.
  switch(value) {
    case SubpixelRendering::kNone:
      return "kNone";
    case SubpixelRendering::kRGB:
      return "kRGB";
    case SubpixelRendering::kBGR:
      return "kBGR";
    case SubpixelRendering::kVRGB:
      return "kVRGB";
    case SubpixelRendering::kVBGR:
      return "kVBGR";
    default:
      return nullptr;
  }
}

std::string SubpixelRenderingToString(SubpixelRendering value) {
  const char *str = SubpixelRenderingToStringHelper(value);
  if (!str) {
    return base::StringPrintf("Unknown SubpixelRendering value: %i", static_cast<int32_t>(value));
  }
  return str;
}

std::ostream& operator<<(std::ostream& os, SubpixelRendering value) {
  return os << SubpixelRenderingToString(value);
}

namespace internal {

}  // namespace internal
}  // namespace mojom
}  // namespace gfx

namespace perfetto {

// static
void TraceFormatTraits<::gfx::mojom::Hinting>::WriteIntoTrace(
   perfetto::TracedValue context, ::gfx::mojom::Hinting value) {
  return std::move(context).WriteString(::gfx::mojom::HintingToString(value));
}

} // namespace perfetto

namespace perfetto {

// static
void TraceFormatTraits<::gfx::mojom::SubpixelRendering>::WriteIntoTrace(
   perfetto::TracedValue context, ::gfx::mojom::SubpixelRendering value) {
  return std::move(context).WriteString(::gfx::mojom::SubpixelRenderingToString(value));
}

} // namespace perfetto