chromium/third_party/blink/renderer/platform/graphics/dark_mode_filter.cc

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

#include "third_party/blink/renderer/platform/graphics/dark_mode_filter.h"

#include <cmath>
#include <optional>

#include "base/check_op.h"
#include "base/command_line.h"
#include "base/containers/lru_cache.h"
#include "base/notreached.h"
#include "third_party/blink/public/common/switches.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/graphics/dark_mode_color_classifier.h"
#include "third_party/blink/renderer/platform/graphics/dark_mode_color_filter.h"
#include "third_party/blink/renderer/platform/graphics/dark_mode_image_cache.h"
#include "third_party/blink/renderer/platform/graphics/dark_mode_image_classifier.h"
#include "third_party/blink/renderer/platform/graphics/image.h"
#include "third_party/blink/renderer/platform/wtf/hash_functions.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkColorFilter.h"
#include "third_party/skia/include/core/SkPixmap.h"
#include "third_party/skia/include/core/SkRect.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "ui/gfx/color_utils.h"

namespace blink {

namespace {

const size_t kMaxCacheSize =;
constexpr SkColor SK_ColorDark =;

bool IsRasterSideDarkModeForImagesEnabled() {}

bool ShouldUseRasterSidePath(Image* image) {}

sk_sp<cc::ColorFilter> GetDarkModeFilterForImageOnMainThread(
    DarkModeFilter* filter,
    Image* image,
    const SkIRect& rounded_src) {}

}  // namespace

// DarkModeInvertedColorCache - Implements cache for inverted colors.
class DarkModeInvertedColorCache {};

DarkModeFilter::DarkModeFilter(const DarkModeSettings& settings)
    :{}

DarkModeFilter::~DarkModeFilter() {}

DarkModeFilter::ImmutableData::ImmutableData(const DarkModeSettings& settings)
    :{}

DarkModeImagePolicy DarkModeFilter::GetDarkModeImagePolicy() const {}

// Heuristic to maintain contrast for borders and selections (see:
// crbug.com/1263545,crbug.com/1298969)
SkColor4f DarkModeFilter::AdjustDarkenColor(
    const SkColor4f& color,
    DarkModeFilter::ElementRole role,
    const SkColor4f& contrast_background) {}

SkColor4f DarkModeFilter::InvertColorIfNeeded(
    const SkColor4f& color,
    ElementRole role,
    const SkColor4f& contrast_background) {}

SkColor4f DarkModeFilter::InvertColorIfNeeded(const SkColor4f& color,
                                              ElementRole role) {}

void DarkModeFilter::ApplyFilterToImage(Image* image,
                                        cc::PaintFlags* flags,
                                        const SkRect& src) {}

bool DarkModeFilter::ShouldApplyFilterToImage(ImageType type) const {}

sk_sp<cc::ColorFilter> DarkModeFilter::GenerateImageFilter(
    const SkPixmap& pixmap,
    const SkIRect& src) const {}

sk_sp<cc::ColorFilter> DarkModeFilter::GetImageFilter() const {}

std::optional<cc::PaintFlags> DarkModeFilter::ApplyToFlagsIfNeeded(
    const cc::PaintFlags& flags,
    ElementRole role,
    SkColor4f contrast_background) {}

bool DarkModeFilter::ShouldApplyToColor(const SkColor4f& color,
                                        ElementRole role) {}

size_t DarkModeFilter::GetInvertedColorCacheSizeForTesting() {}

}  // namespace blink