chromium/ui/gfx/shadow_value.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 "ui/gfx/shadow_value.h"

#include <stddef.h>

#include <algorithm>

#include "base/check_op.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/stringprintf.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/vector2d_conversions.h"

namespace gfx {

namespace {

// To match the CSS notion of blur (spread outside the bounding box) to the
// Skia notion of blur (spread outside and inside the bounding box), we have
// to double the designer-provided blur values.
constexpr int kBlurCorrection =;

Insets GetInsets(const ShadowValues& shadows, bool include_inner_blur) {}

}  // namespace

ShadowValue ShadowValue::Scale(float scale) const {}

std::string ShadowValue::ToString() const {}

// static
Insets ShadowValue::GetMargin(const ShadowValues& shadows) {}

// static
Insets ShadowValue::GetBlurRegion(const ShadowValues& shadows) {}

// static
ShadowValues ShadowValue::MakeShadowValues(int elevation,
                                           SkColor key_shadow_color,
                                           SkColor ambient_shadow_color) {}

// static
ShadowValues ShadowValue::MakeMdShadowValues(int elevation, SkColor color) {}

// static
ShadowValues ShadowValue::MakeMdShadowValues(int elevation,
                                             SkColor key_shadow_color,
                                             SkColor ambient_shadow_color) {}

#if BUILDFLAG(IS_CHROMEOS)
// static
ShadowValues ShadowValue::MakeChromeOSSystemUIShadowValues(int elevation,
                                                           SkColor color) {
  // To see what this looks like for elevation 24, try this CSS:
  //   box-shadow: 0 24px 24px rgba(0, 0, 0, .24),
  //               0 0 24px rgba(0, 0, 0, .10);
  return MakeChromeOSSystemUIShadowValues(elevation, SkColorSetA(color, 0x3d),
                                          SkColorSetA(color, 0x1a));
}

// static
ShadowValues ShadowValue::MakeChromeOSSystemUIShadowValues(
    int elevation,
    SkColor key_shadow_color,
    SkColor ambient_shadow_color) {
  ShadowValues shadow_values;
  // "Key shadow": y offset is elevation and blur equals to the elevation.
  shadow_values.emplace_back(Vector2d(0, elevation),
                             kBlurCorrection * elevation, key_shadow_color);
  // "Ambient shadow": no offset and blur matches the elevation.
  shadow_values.emplace_back(Vector2d(), kBlurCorrection * elevation,
                             ambient_shadow_color);
  return shadow_values;
}
#endif

}  // namespace gfx