#include "cc/layers/nine_patch_generator.h"
#include "base/trace_event/traced_value.h"
#include "cc/base/math_util.h"
#include "cc/trees/layer_tree_impl.h"
#include "components/viz/client/client_resource_provider.h"
#include "components/viz/common/quads/compositor_render_pass.h"
#include "components/viz/common/quads/texture_draw_quad.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/rect_f.h"
namespace cc {
namespace {
const int kMaxOcclusionPatches = …;
const int kMaxPatches = …;
gfx::Rect BoundsToRect(int x1, int y1, int x2, int y2) { … }
gfx::RectF NormalizedRect(const gfx::Rect& rect,
float total_width,
float total_height) { … }
}
NinePatchGenerator::Patch::Patch(const gfx::Rect& image_rect,
const gfx::Size& total_image_bounds,
const gfx::Rect& output_rect)
: … { … }
NinePatchGenerator::NinePatchGenerator()
: … { … }
bool NinePatchGenerator::SetLayout(const gfx::Size& image_bounds,
const gfx::Size& output_bounds,
const gfx::Rect& aperture,
const gfx::Rect& border,
const gfx::Rect& output_occlusion,
bool fill_center,
bool nearest_neighbor) { … }
void NinePatchGenerator::CheckGeometryLimitations() { … }
std::vector<NinePatchGenerator::Patch>
NinePatchGenerator::ComputeQuadsWithoutOcclusion() const { … }
std::vector<NinePatchGenerator::Patch>
NinePatchGenerator::ComputeQuadsWithOcclusion() const { … }
std::vector<NinePatchGenerator::Patch> NinePatchGenerator::GeneratePatches()
const { … }
void NinePatchGenerator::AppendQuadsForCc(
LayerImpl* layer_impl,
UIResourceId ui_resource_id,
viz::CompositorRenderPass* render_pass,
viz::SharedQuadState* shared_quad_state,
const std::vector<Patch>& patches,
const gfx::Vector2d& offset) { … }
void NinePatchGenerator::AppendQuads(
viz::ResourceId resource,
bool opaque,
base::FunctionRef<gfx::Rect(const gfx::Rect&)> clip_visible_rect,
viz::ClientResourceProvider* client_resource_provider,
viz::CompositorRenderPass* render_pass,
viz::SharedQuadState* shared_quad_state,
const std::vector<Patch>& patches,
const gfx::Vector2d& offset) { … }
void NinePatchGenerator::AsValueInto(
base::trace_event::TracedValue* state) const { … }
}