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

#include <stddef.h>

#include <cmath>
#include <limits>
#include <memory>

#include "base/check.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/no_destructor.h"
#include "base/sequence_checker.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/resource/resource_scale_factor.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/image/image_skia_source.h"
#include "ui/gfx/switches.h"

namespace gfx {
namespace {

// static
gfx::ImageSkiaRep& NullImageRep() {}

}  // namespace

namespace internal {
namespace {

ImageSkiaRep ScaleImageSkiaRep(const ImageSkiaRep& rep, float target_scale) {}

}  // namespace

// A helper class such that ImageSkia can be cheaply copied. ImageSkia holds a
// refptr instance of ImageSkiaStorage, which in turn holds all of ImageSkia's
// information.
// The ImageSkia, and this class, are designed to be thread-safe in their const
// methods, but also are bound to a single sequence for mutating methods.
// NOTE: The FindRepresentation() method const and thread-safe *iff* it is
// called with `fetch_new_image` set to true. Otherwise it may mutate the
// class, which is not thread-safe. Internally, mutation is bound to a single
// sequence with a `base::SequenceChecker`.
class ImageSkiaStorage : public base::RefCountedThreadSafe<ImageSkiaStorage> {};

ImageSkiaStorage::ImageSkiaStorage(std::unique_ptr<ImageSkiaSource> source,
                                   const gfx::Size& size)
    :{}

ImageSkiaStorage::ImageSkiaStorage(std::unique_ptr<ImageSkiaSource> source,
                                   float scale)
    :{}

void ImageSkiaStorage::DeleteSource() {}

void ImageSkiaStorage::SetReadOnly() {}

void ImageSkiaStorage::DetachFromSequence() {}

bool ImageSkiaStorage::CanModify() const {}

bool ImageSkiaStorage::CanRead() const {}

void ImageSkiaStorage::AddRepresentation(const ImageSkiaRep& image) {}

bool ImageSkiaStorage::HasRepresentationAtAllScales() const {}

std::vector<ImageSkiaRep>::const_iterator ImageSkiaStorage::FindRepresentation(
    float scale,
    bool fetch_new_image) const {}

ImageSkiaStorage::~ImageSkiaStorage() = default;

}  // internal

ImageSkia::ImageSkia() {}

ImageSkia::ImageSkia(std::unique_ptr<ImageSkiaSource> source,
                     const gfx::Size& size)
    :{}

ImageSkia::ImageSkia(std::unique_ptr<ImageSkiaSource> source, float scale)
    :{}

ImageSkia::ImageSkia(const ImageSkiaRep& image_rep) {}

ImageSkia::ImageSkia(const ImageSkia& other) :{}

ImageSkia& ImageSkia::operator=(const ImageSkia& other) {}

ImageSkia::~ImageSkia() {}

// static
ImageSkia ImageSkia::CreateFromBitmap(const SkBitmap& bitmap, float scale) {}

// static
ImageSkia ImageSkia::CreateFrom1xBitmap(const SkBitmap& bitmap) {}

ImageSkia ImageSkia::DeepCopy() const {}

bool ImageSkia::BackedBySameObjectAs(const gfx::ImageSkia& other) const {}

const void* ImageSkia::GetBackingObject() const {}

void ImageSkia::AddRepresentation(const ImageSkiaRep& image_rep) {}

void ImageSkia::RemoveRepresentation(float scale) {}

bool ImageSkia::HasRepresentation(float scale) const {}

const ImageSkiaRep& ImageSkia::GetRepresentation(float scale) const {}

void ImageSkia::SetReadOnly() {}

void ImageSkia::MakeThreadSafe() {}

bool ImageSkia::IsThreadSafe() const {}

int ImageSkia::width() const {}

gfx::Size ImageSkia::size() const {}

int ImageSkia::height() const {}

std::vector<ImageSkiaRep> ImageSkia::image_reps() const {}

void ImageSkia::EnsureRepsForSupportedScales() const {}

void ImageSkia::RemoveUnsupportedRepresentationsForScale(float scale) {}

bool ImageSkia::IsUniquelyOwned() const {}

void ImageSkia::Init(const ImageSkiaRep& image_rep) {}

const SkBitmap& ImageSkia::GetBitmap() const {}

bool ImageSkia::CanRead() const {}

bool ImageSkia::CanModify() const {}

void ImageSkia::DetachStorageFromSequence() {}

}  // namespace gfx