[PDF Ink Signatures] Update InkBrushFamily to use move semantics
Change InkBrushFamily::Create() to take its InkBrushPaint and InkBrushTip arguments instead of copying them. Update the two structs and the Create() caller to support move semantics. Change-Id: I112cf42bb51d5e7792db5c7cd7812f1cc02c034b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5565281 Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com> Reviewed-by: Andy Phan <andyphan@chromium.org> Reviewed-by: Alan Screen <awscreen@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/main@{#1305442}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
38b05884e8
commit
ce5829a893
@@ -15,8 +15,8 @@ struct InkBrushTip;
|
|||||||
|
|
||||||
class InkBrushFamily {
|
class InkBrushFamily {
|
||||||
public:
|
public:
|
||||||
static std::unique_ptr<InkBrushFamily> Create(const InkBrushTip& tip,
|
static std::unique_ptr<InkBrushFamily> Create(InkBrushTip tip,
|
||||||
const InkBrushPaint& paint,
|
InkBrushPaint paint,
|
||||||
std::string_view uri_string);
|
std::string_view uri_string);
|
||||||
|
|
||||||
~InkBrushFamily();
|
~InkBrushFamily();
|
||||||
|
@@ -8,6 +8,10 @@ namespace chrome_pdf {
|
|||||||
|
|
||||||
InkBrushPaint::InkBrushPaint() = default;
|
InkBrushPaint::InkBrushPaint() = default;
|
||||||
|
|
||||||
|
InkBrushPaint::InkBrushPaint(InkBrushPaint&&) noexcept = default;
|
||||||
|
|
||||||
|
InkBrushPaint& InkBrushPaint::operator=(InkBrushPaint&&) noexcept = default;
|
||||||
|
|
||||||
InkBrushPaint::~InkBrushPaint() = default;
|
InkBrushPaint::~InkBrushPaint() = default;
|
||||||
|
|
||||||
InkBrushPaint::TextureLayer::TextureLayer() = default;
|
InkBrushPaint::TextureLayer::TextureLayer() = default;
|
||||||
|
@@ -13,6 +13,10 @@ namespace chrome_pdf {
|
|||||||
|
|
||||||
struct InkBrushPaint {
|
struct InkBrushPaint {
|
||||||
InkBrushPaint();
|
InkBrushPaint();
|
||||||
|
InkBrushPaint(const InkBrushPaint&) = delete;
|
||||||
|
InkBrushPaint& operator=(const InkBrushPaint&) = delete;
|
||||||
|
InkBrushPaint(InkBrushPaint&&) noexcept;
|
||||||
|
InkBrushPaint& operator=(InkBrushPaint&&) noexcept;
|
||||||
~InkBrushPaint();
|
~InkBrushPaint();
|
||||||
|
|
||||||
enum class TextureMapping {
|
enum class TextureMapping {
|
||||||
|
@@ -8,6 +8,10 @@ namespace chrome_pdf {
|
|||||||
|
|
||||||
InkBrushTip::InkBrushTip() = default;
|
InkBrushTip::InkBrushTip() = default;
|
||||||
|
|
||||||
|
InkBrushTip::InkBrushTip(InkBrushTip&&) noexcept = default;
|
||||||
|
|
||||||
|
InkBrushTip& InkBrushTip::operator=(InkBrushTip&&) noexcept = default;
|
||||||
|
|
||||||
InkBrushTip::~InkBrushTip() = default;
|
InkBrushTip::~InkBrushTip() = default;
|
||||||
|
|
||||||
} // namespace chrome_pdf
|
} // namespace chrome_pdf
|
||||||
|
@@ -13,6 +13,10 @@ namespace chrome_pdf {
|
|||||||
|
|
||||||
struct InkBrushTip {
|
struct InkBrushTip {
|
||||||
InkBrushTip();
|
InkBrushTip();
|
||||||
|
InkBrushTip(const InkBrushTip&) = delete;
|
||||||
|
InkBrushTip& operator=(const InkBrushTip&) = delete;
|
||||||
|
InkBrushTip(InkBrushTip&&) noexcept;
|
||||||
|
InkBrushTip& operator=(InkBrushTip&&) noexcept;
|
||||||
~InkBrushTip();
|
~InkBrushTip();
|
||||||
|
|
||||||
float scale_x = 1;
|
float scale_x = 1;
|
||||||
|
@@ -7,13 +7,15 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
|
#include "pdf/ink/ink_brush_paint.h"
|
||||||
|
#include "pdf/ink/ink_brush_tip.h"
|
||||||
|
|
||||||
namespace chrome_pdf {
|
namespace chrome_pdf {
|
||||||
|
|
||||||
// static
|
// static
|
||||||
std::unique_ptr<InkBrushFamily> InkBrushFamily::Create(
|
std::unique_ptr<InkBrushFamily> InkBrushFamily::Create(
|
||||||
const InkBrushTip& tip,
|
InkBrushTip tip,
|
||||||
const InkBrushPaint& paint,
|
InkBrushPaint paint,
|
||||||
std::string_view uri_string) {
|
std::string_view uri_string) {
|
||||||
// Protected ctor.
|
// Protected ctor.
|
||||||
return base::WrapUnique(new InkBrushFamily());
|
return base::WrapUnique(new InkBrushFamily());
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <numbers>
|
#include <numbers>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/check_op.h"
|
#include "base/check_op.h"
|
||||||
#include "pdf/ink/ink_brush.h"
|
#include "pdf/ink/ink_brush.h"
|
||||||
@@ -68,7 +69,7 @@ std::unique_ptr<InkBrush> PdfInkBrush::CreateInkBrush() {
|
|||||||
|
|
||||||
InkBrushPaint paint;
|
InkBrushPaint paint;
|
||||||
paint.texture_layers.push_back(layer);
|
paint.texture_layers.push_back(layer);
|
||||||
auto family = InkBrushFamily::Create(tip, paint, "");
|
auto family = InkBrushFamily::Create(std::move(tip), std::move(paint), "");
|
||||||
CHECK(family);
|
CHECK(family);
|
||||||
|
|
||||||
return InkBrush::Create(std::move(family),
|
return InkBrush::Create(std::move(family),
|
||||||
|
Reference in New Issue
Block a user