#include "cc/paint/solid_color_analyzer.h"
#include <cmath>
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "cc/paint/paint_op.h"
#include "cc/paint/paint_op_buffer_iterator.h"
#include "third_party/skia/include/core/SkTypes.h"
#include "third_party/skia/include/utils/SkNoDrawCanvas.h"
namespace cc {
namespace {
SkColor4f DoSrcOverAlphaBlend(SkColor4f src, SkColor4f dst) { … }
bool ActsLikeClear(SkBlendMode mode, float src_alpha) { … }
bool IsSolidColorBlendMode(SkBlendMode blendmode) { … }
bool IsSolidColorPaint(const PaintFlags& flags) { … }
template <typename T>
bool IsFullQuad(const SkCanvas& canvas, const T& drawn_shape) { … }
void CalculateSolidColor(SkColor4f src_color,
SkBlendMode blendmode,
SkColor4f* dst_color,
bool* is_solid_color) { … }
void CheckIfSolidColor(const SkCanvas& canvas,
SkColor4f color,
SkBlendMode blendmode,
bool* is_solid_color,
bool* is_transparent,
SkColor4f* out_color) { … }
template <typename T>
void CheckIfSolidShape(const SkCanvas& canvas,
const T& shape,
const PaintFlags& flags,
bool* is_solid_color,
bool* is_transparent,
SkColor4f* color) { … }
bool CheckIfRRectClipCoversCanvas(const SkCanvas& canvas,
const SkRRect& rrect) { … }
}
std::optional<SkColor4f> SolidColorAnalyzer::DetermineIfSolidColor(
const PaintOpBuffer& buffer,
const gfx::Rect& rect,
int max_ops_to_analyze,
const std::vector<size_t>* offsets) { … }
}