0

[PDF Ink Signatures] Simplify ink::BrushFamily creation

Since the PDF Viewer is not using textured brushes, remove the
ink::BrushPaint creation code and pass in a default-constructed
BrushPaint instead, per recommendations from Ink Team.

Also remove the use of move semantics, which used to make sense when the
Ink stub and wrapper existed.

Bug: 353942923
Change-Id: I610b3610e4ad65547bd364dd8286068bb271074d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5912425
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Andy Phan <andyphan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1365251}
This commit is contained in:
Lei Zhang
2024-10-08 00:13:44 +00:00
committed by Chromium LUCI CQ
parent a94937b1dc
commit 31a3b8964b

@ -4,9 +4,7 @@
#include "pdf/pdf_ink_brush.h"
#include <numbers>
#include <optional>
#include <utility>
#include "base/check_op.h"
#include "base/notreached.h"
@ -21,13 +19,6 @@ namespace chrome_pdf {
namespace {
ink::Uri CreateBrushUri() {
// TODO(crbug.com/353942923): Use real value here.
auto uri = ink::Uri::Parse("ink://ink/texture:test-texture");
CHECK(uri.ok());
return *uri;
}
float GetCornerRounding(PdfInkBrush::Type type) {
switch (type) {
case PdfInkBrush::Type::kHighlighter:
@ -58,21 +49,9 @@ ink::Brush CreateInkBrush(PdfInkBrush::Type type, PdfInkBrush::Params params) {
tip.corner_rounding = GetCornerRounding(type);
tip.opacity_multiplier = GetOpacity(type);
// TODO(crbug.com/353942923): Use real value here.
ink::BrushPaint::TextureLayer layer;
layer.color_texture_uri = CreateBrushUri();
layer.mapping = ink::BrushPaint::TextureMapping::kWinding;
layer.size_unit = ink::BrushPaint::TextureSizeUnit::kBrushSize;
layer.size = {3, 5};
layer.size_jitter = {0.1, 2};
layer.keyframes = {
{.progress = 0.1,
.rotation = ink::Angle::Radians(std::numbers::pi_v<float> / 4)}};
layer.blend_mode = ink::BrushPaint::BlendMode::kSrcIn;
ink::BrushPaint paint;
paint.texture_layers.push_back(layer);
auto family = ink::BrushFamily::Create(std::move(tip), std::move(paint), "");
// TODO(crbug.com/353942923): Use real `uri_string` here.
auto family = ink::BrushFamily::Create(tip, ink::BrushPaint(),
/*uri_string=*/"");
CHECK(family.ok());
auto brush = ink::Brush::Create(*family,