chromium/ui/gfx/shadow_util.cc

// Copyright 2017 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_util.h"

#include <map>
#include <vector>

#include "base/lazy_instance.h"
#include "base/memory/ptr_util.h"
#include "third_party/skia/include/core/SkRRect.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/image/canvas_image_source.h"
#include "ui/gfx/shadow_value.h"
#include "ui/gfx/skia_paint_util.h"

namespace gfx {
namespace {

// Creates an image with the given shadows painted around a round rect with
// the given corner radius. The image will be just large enough to paint the
// shadows appropriately with a 1px square region reserved for "content".
class ShadowNineboxSource : public CanvasImageSource {};

// A shadow's appearance is determined by its rounded corner radius and shadow
// values. Make these attributes as the key for shadow details.
struct ShadowDetailsKey {};

// Map from shadow details key to a cached shadow.
ShadowDetailsMap;
base::LazyInstance<ShadowDetailsMap>::DestructorAtExit g_shadow_cache =;

}  // namespace

ShadowDetails::ShadowDetails(const gfx::ShadowValues& values,
                             const gfx::ImageSkia& nine_patch_image)
    :{}
ShadowDetails::ShadowDetails(const ShadowDetails& other) = default;
ShadowDetails::~ShadowDetails() {}

const ShadowDetails& ShadowDetails::Get(int elevation,
                                        int corner_radius,
                                        ShadowStyle style) {}

const ShadowDetails& ShadowDetails::Get(int elevation,
                                        int radius,
                                        SkColor key_color,
                                        SkColor ambient_color,
                                        ShadowStyle style) {}

const ShadowDetails& ShadowDetails::Get(int radius,
                                        const gfx::ShadowValues& values) {}

size_t ShadowDetails::GetDetailsCacheSizeForTest() {}

}  // namespace gfx