#include "third_party/blink/renderer/core/paint/nine_piece_image_grid.h"
#include "third_party/blink/renderer/core/layout/geometry/box_strut.h"
#include "third_party/blink/renderer/platform/geometry/length_functions.h"
#include "ui/gfx/geometry/outsets.h"
namespace blink {
namespace {
LayoutUnit ComputeEdgeWidth(const BorderImageLength& border_slice,
int border_side,
float image_side,
int box_extent) { … }
float ComputeEdgeSlice(const Length& slice, float slice_scale, float maximum) { … }
gfx::Outsets SnapEdgeWidths(const PhysicalBoxStrut& edge_widths,
const gfx::Size& snapped_box_size) { … }
}
NinePieceImageGrid::NinePieceImageGrid(const NinePieceImage& nine_piece_image,
const gfx::SizeF& image_size,
const gfx::Vector2dF& slice_scale,
float zoom,
const gfx::Rect& border_image_area,
const gfx::Outsets& border_widths,
PhysicalBoxSides sides_to_include)
: … { … }
static gfx::RectF Subrect(const gfx::RectF& rect,
float offset_x,
float offset_y,
float width,
float height) { … }
static gfx::RectF Subrect(const gfx::Rect& rect,
float offset_x,
float offset_y,
float width,
float height) { … }
static gfx::RectF Subrect(const gfx::SizeF& size,
float offset_x,
float offset_y,
float width,
float height) { … }
static inline void SetCornerPiece(
NinePieceImageGrid::NinePieceDrawInfo& draw_info,
bool is_drawable,
const gfx::RectF& source,
const gfx::RectF& destination) { … }
void NinePieceImageGrid::SetDrawInfoCorner(NinePieceDrawInfo& draw_info,
NinePiece piece) const { … }
static inline void SetHorizontalEdge(
NinePieceImageGrid::NinePieceDrawInfo& draw_info,
const NinePieceImageGrid::Edge& edge,
const gfx::RectF& source,
const gfx::RectF& destination,
ENinePieceImageRule tile_rule) { … }
static inline void SetVerticalEdge(
NinePieceImageGrid::NinePieceDrawInfo& draw_info,
const NinePieceImageGrid::Edge& edge,
const gfx::RectF& source,
const gfx::RectF& destination,
ENinePieceImageRule tile_rule) { … }
void NinePieceImageGrid::SetDrawInfoEdge(NinePieceDrawInfo& draw_info,
NinePiece piece) const { … }
void NinePieceImageGrid::SetDrawInfoMiddle(NinePieceDrawInfo& draw_info) const { … }
NinePieceImageGrid::NinePieceDrawInfo NinePieceImageGrid::GetNinePieceDrawInfo(
NinePiece piece) const { … }
}