Rename PaintOpType enum values to be consistent with PaintOp class names
For example, kDrawrect is renamed to kDrawRect to be consistent with
class DrawRectOp.
Also simplify PaintOpTypeToString, but with a side effect that the
strings are ended with "Op".
Change-Id: Ic3f955e1e2d8ad2d98342167626e89b3e3126cc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5034472
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1225702}
diff --git a/cc/paint/discardable_image_map.cc b/cc/paint/discardable_image_map.cc
index 26a2dd4..4e25e466 100644
--- a/cc/paint/discardable_image_map.cc
+++ b/cc/paint/discardable_image_map.cc
@@ -137,13 +137,13 @@
}
PaintOpType op_type = static_cast<PaintOpType>(op.type);
- if (op_type == PaintOpType::kDrawimage) {
+ if (op_type == PaintOpType::kDrawImage) {
const auto& image_op = static_cast<const DrawImageOp&>(op);
AddImage(
image_op.image, image_op.flags.useDarkModeForImage(),
SkRect::MakeIWH(image_op.image.width(), image_op.image.height()),
op_rect, ctm, image_op.flags.getFilterQuality());
- } else if (op_type == PaintOpType::kDrawimagerect) {
+ } else if (op_type == PaintOpType::kDrawImageRect) {
const auto& image_rect_op = static_cast<const DrawImageRectOp&>(op);
// TODO(crbug.com/1155544): Make a RectToRect method that uses SkM44s
// in MathUtil.
@@ -152,7 +152,7 @@
AddImage(image_rect_op.image, image_rect_op.flags.useDarkModeForImage(),
image_rect_op.src, op_rect, matrix,
image_rect_op.flags.getFilterQuality());
- } else if (op_type == PaintOpType::kDrawskottie) {
+ } else if (op_type == PaintOpType::kDrawSkottie) {
const auto& skottie_op = static_cast<const DrawSkottieOp&>(op);
for (const auto& image_pair : skottie_op.images) {
const SkottieFrameData& frame_data = image_pair.second;
@@ -188,7 +188,7 @@
std::move(image_src_rect), std::move(dst_rect), matrix,
frame_data.quality);
}
- } else if (op_type == PaintOpType::kDrawrecord) {
+ } else if (op_type == PaintOpType::kDrawRecord) {
GatherDiscardableImages(
static_cast<const DrawRecordOp&>(op).record.buffer(),
top_level_op_rect, canvas);
diff --git a/cc/paint/display_item_list.cc b/cc/paint/display_item_list.cc
index b934f88d..6adcc34 100644
--- a/cc/paint/display_item_list.cc
+++ b/cc/paint/display_item_list.cc
@@ -41,9 +41,9 @@
if (!buffer.has_draw_text_ops())
return;
for (const PaintOp& op : buffer) {
- if (op.GetType() == PaintOpType::kDrawtextblob) {
+ if (op.GetType() == PaintOpType::kDrawTextBlob) {
yield(static_cast<const DrawTextBlobOp&>(op), rect);
- } else if (op.GetType() == PaintOpType::kDrawrecord) {
+ } else if (op.GetType() == PaintOpType::kDrawRecord) {
IterateTextContent(static_cast<const DrawRecordOp&>(op).record.buffer(),
yield, rect);
}
@@ -59,9 +59,9 @@
DCHECK_EQ(rects.size(), offsets.size());
size_t index = 0;
for (const PaintOp& op : PaintOpBuffer::OffsetIterator(buffer, offsets)) {
- if (op.GetType() == PaintOpType::kDrawtextblob) {
+ if (op.GetType() == PaintOpType::kDrawTextBlob) {
yield(static_cast<const DrawTextBlobOp&>(op), rects[index]);
- } else if (op.GetType() == PaintOpType::kDrawrecord) {
+ } else if (op.GetType() == PaintOpType::kDrawRecord) {
IterateTextContent(static_cast<const DrawRecordOp&>(op).record.buffer(),
yield, rects[index]);
}
@@ -133,11 +133,11 @@
size_t index = 0;
for (const PaintOp& op :
PaintOpBuffer::OffsetIterator(paint_op_buffer_, offsets)) {
- if (op.GetType() == PaintOpType::kDrawtextblob ||
+ if (op.GetType() == PaintOpType::kDrawTextBlob ||
// Don't walk into the record because the visual rect is already the
// bounding box of the sub paint operations. This works for most paint
// results for text generated by blink.
- (op.GetType() == PaintOpType::kDrawrecord &&
+ (op.GetType() == PaintOpType::kDrawRecord &&
static_cast<const DrawRecordOp&>(op).record.has_draw_text_ops())) {
area += static_cast<double>(rects[index].width()) * rects[index].height();
}
@@ -406,7 +406,7 @@
transpose_image_size = (concat_op.matrix.rc(0, 0) == 0);
break;
}
- case PaintOpType::kDrawimagerect: {
+ case PaintOpType::kDrawImageRect: {
if (result)
return std::nullopt;
const auto& draw_image_rect_op =
@@ -425,7 +425,7 @@
PaintFlags::FilterQuality::kNone;
break;
}
- case PaintOpType::kDrawrecord:
+ case PaintOpType::kDrawRecord:
if (result)
return std::nullopt;
result = DirectlyCompositedImageResultForPaintOpBuffer(
diff --git a/cc/paint/display_item_list_unittest.cc b/cc/paint/display_item_list_unittest.cc
index 94a6bf8..e5c2724 100644
--- a/cc/paint/display_item_list_unittest.cc
+++ b/cc/paint/display_item_list_unittest.cc
@@ -127,7 +127,7 @@
EXPECT_TRACED_RECT(0, 0, 0, 0, visual_rect);
name = item_dict->FindString("name");
ASSERT_NE(nullptr, name);
- EXPECT_EQ("DrawRect", *name);
+ EXPECT_EQ("DrawRectOp", *name);
item_dict = ((*items)[1]).GetIfDict();
ASSERT_NE(nullptr, item_dict);
@@ -136,7 +136,7 @@
EXPECT_TRACED_RECT(8, 9, 10, 10, visual_rect);
name = item_dict->FindString("name");
ASSERT_NE(nullptr, name);
- EXPECT_EQ("DrawRect", *name);
+ EXPECT_EQ("DrawRectOp", *name);
}
TEST_F(DisplayItemListTest, SingleUnpairedRange) {
@@ -570,9 +570,9 @@
ASSERT_NE(nullptr, items);
ASSERT_EQ(7u, items->size());
- const char* expected_names[] = {"Save", "Concat", "SaveLayer",
- "Translate", "DrawRect", "Restore",
- "Restore"};
+ const char* expected_names[] = {
+ "SaveOp", "ConcatOp", "SaveLayerOp", "TranslateOp",
+ "DrawRectOp", "RestoreOp", "RestoreOp"};
bool expected_has_skp[] = {false, true, true, true, true, false, false};
for (int i = 0; i < 7; ++i) {
diff --git a/cc/paint/paint_op.cc b/cc/paint/paint_op.cc
index decb0df2..7cce3dc 100644
--- a/cc/paint/paint_op.cc
+++ b/cc/paint/paint_op.cc
@@ -318,76 +318,22 @@
bool PaintOp::g_has_paint_flags[kNumOpTypes] = {TYPES(M)};
#undef M
-#undef TYPES
-
const SkRect PaintOp::kUnsetRect = {SK_ScalarInfinity, 0, 0, 0};
std::string PaintOpTypeToString(PaintOpType type) {
switch (type) {
- case PaintOpType::kAnnotate:
- return "Annotate";
- case PaintOpType::kClippath:
- return "ClipPath";
- case PaintOpType::kCliprect:
- return "ClipRect";
- case PaintOpType::kCliprrect:
- return "ClipRRect";
- case PaintOpType::kConcat:
- return "Concat";
- case PaintOpType::kCustomdata:
- return "CustomData";
- case PaintOpType::kDrawcolor:
- return "DrawColor";
- case PaintOpType::kDrawdrrect:
- return "DrawDRRect";
- case PaintOpType::kDrawimage:
- return "DrawImage";
- case PaintOpType::kDrawimagerect:
- return "DrawImageRect";
- case PaintOpType::kDrawirect:
- return "DrawIRect";
- case PaintOpType::kDrawline:
- return "DrawLine";
- case PaintOpType::kDrawoval:
- return "DrawOval";
- case PaintOpType::kDrawpath:
- return "DrawPath";
- case PaintOpType::kDrawrecord:
- return "DrawRecord";
- case PaintOpType::kDrawrect:
- return "DrawRect";
- case PaintOpType::kDrawrrect:
- return "DrawRRect";
- case PaintOpType::kDrawskottie:
- return "DrawSkottie";
- case PaintOpType::kDrawslug:
- return "DrawSlug";
- case PaintOpType::kDrawtextblob:
- return "DrawTextBlob";
- case PaintOpType::kNoop:
- return "Noop";
- case PaintOpType::kRestore:
- return "Restore";
- case PaintOpType::kRotate:
- return "Rotate";
- case PaintOpType::kSave:
- return "Save";
- case PaintOpType::kSavelayer:
- return "SaveLayer";
- case PaintOpType::kSavelayeralpha:
- return "SaveLayerAlpha";
- case PaintOpType::kScale:
- return "Scale";
- case PaintOpType::kSetmatrix:
- return "SetMatrix";
- case PaintOpType::kSetnodeid:
- return "SetNodeId";
- case PaintOpType::kTranslate:
- return "Translate";
+#define M(T) \
+ case T::kType: \
+ return #T;
+
+ TYPES(M)
+#undef M
}
- return "UNKNOWN";
+ NOTREACHED_NORETURN();
}
+#undef TYPES
+
std::ostream& operator<<(std::ostream& os, PaintOpType type) {
return os << PaintOpTypeToString(type);
}
@@ -1679,8 +1625,8 @@
original_ctm);
// Convert DrawTextBlobOp to DrawSlugOp.
- if (GetType() == PaintOpType::kDrawtextblob) {
- return writer.FinishOp(static_cast<uint8_t>(PaintOpType::kDrawslug));
+ if (GetType() == PaintOpType::kDrawTextBlob) {
+ return writer.FinishOp(static_cast<uint8_t>(PaintOpType::kDrawSlug));
}
return writer.FinishOp(type);
}
@@ -1733,78 +1679,78 @@
DCHECK(op.IsDrawOp());
switch (op.GetType()) {
- case PaintOpType::kDrawcolor:
+ case PaintOpType::kDrawColor:
return false;
- case PaintOpType::kDrawdrrect: {
+ case PaintOpType::kDrawDRRect: {
const auto& rect_op = static_cast<const DrawDRRectOp&>(op);
*rect = rect_op.outer.getBounds();
rect->sort();
return true;
}
- case PaintOpType::kDrawimage: {
+ case PaintOpType::kDrawImage: {
const auto& image_op = static_cast<const DrawImageOp&>(op);
*rect = SkRect::MakeXYWH(image_op.left, image_op.top,
image_op.image.width(), image_op.image.height());
rect->sort();
return true;
}
- case PaintOpType::kDrawimagerect: {
+ case PaintOpType::kDrawImageRect: {
const auto& image_rect_op = static_cast<const DrawImageRectOp&>(op);
*rect = image_rect_op.dst;
rect->sort();
return true;
}
- case PaintOpType::kDrawirect: {
+ case PaintOpType::kDrawIRect: {
const auto& rect_op = static_cast<const DrawIRectOp&>(op);
*rect = SkRect::Make(rect_op.rect);
rect->sort();
return true;
}
- case PaintOpType::kDrawline: {
+ case PaintOpType::kDrawLine: {
const auto& line_op = static_cast<const DrawLineOp&>(op);
rect->setLTRB(line_op.x0, line_op.y0, line_op.x1, line_op.y1);
rect->sort();
return true;
}
- case PaintOpType::kDrawoval: {
+ case PaintOpType::kDrawOval: {
const auto& oval_op = static_cast<const DrawOvalOp&>(op);
*rect = oval_op.oval;
rect->sort();
return true;
}
- case PaintOpType::kDrawpath: {
+ case PaintOpType::kDrawPath: {
const auto& path_op = static_cast<const DrawPathOp&>(op);
*rect = path_op.path.getBounds();
rect->sort();
return true;
}
- case PaintOpType::kDrawrect: {
+ case PaintOpType::kDrawRect: {
const auto& rect_op = static_cast<const DrawRectOp&>(op);
*rect = rect_op.rect;
rect->sort();
return true;
}
- case PaintOpType::kDrawrrect: {
+ case PaintOpType::kDrawRRect: {
const auto& rect_op = static_cast<const DrawRRectOp&>(op);
*rect = rect_op.rrect.rect();
rect->sort();
return true;
}
- case PaintOpType::kDrawrecord:
+ case PaintOpType::kDrawRecord:
return false;
- case PaintOpType::kDrawskottie: {
+ case PaintOpType::kDrawSkottie: {
const auto& skottie_op = static_cast<const DrawSkottieOp&>(op);
*rect = skottie_op.dst;
rect->sort();
return true;
}
- case PaintOpType::kDrawtextblob: {
+ case PaintOpType::kDrawTextBlob: {
const auto& text_op = static_cast<const DrawTextBlobOp&>(op);
*rect = text_op.blob->bounds().makeOffset(text_op.x, text_op.y);
rect->sort();
return true;
}
- case PaintOpType::kDrawslug: {
+ case PaintOpType::kDrawSlug: {
const auto& slug_op = static_cast<const DrawSlugOp&>(op);
*rect = slug_op.slug->sourceBoundsWithOrigin();
rect->sort();
@@ -1896,16 +1842,16 @@
return true;
}
- if (op.GetType() == PaintOpType::kDrawimage &&
+ if (op.GetType() == PaintOpType::kDrawImage &&
static_cast<const DrawImageOp&>(op).HasDiscardableImages()) {
return true;
- } else if (op.GetType() == PaintOpType::kDrawimagerect &&
+ } else if (op.GetType() == PaintOpType::kDrawImageRect &&
static_cast<const DrawImageRectOp&>(op).HasDiscardableImages()) {
return true;
- } else if (op.GetType() == PaintOpType::kDrawrecord &&
+ } else if (op.GetType() == PaintOpType::kDrawRecord &&
static_cast<const DrawRecordOp&>(op).HasDiscardableImages()) {
return true;
- } else if (op.GetType() == PaintOpType::kDrawskottie &&
+ } else if (op.GetType() == PaintOpType::kDrawSkottie &&
static_cast<const DrawSkottieOp&>(op).HasDiscardableImages()) {
return true;
}
diff --git a/cc/paint/paint_op.h b/cc/paint/paint_op.h
index 6b11a49..9b75fda 100644
--- a/cc/paint/paint_op.h
+++ b/cc/paint/paint_op.h
@@ -69,36 +69,36 @@
enum class PaintOpType : uint8_t {
kAnnotate,
- kClippath,
- kCliprect,
- kCliprrect,
+ kClipPath,
+ kClipRect,
+ kClipRRect,
kConcat,
- kCustomdata,
- kDrawcolor,
- kDrawdrrect,
- kDrawimage,
- kDrawimagerect,
- kDrawirect,
- kDrawline,
- kDrawoval,
- kDrawpath,
- kDrawrecord,
- kDrawrect,
- kDrawrrect,
- kDrawskottie,
- kDrawslug,
- kDrawtextblob,
+ kCustomData,
+ kDrawColor,
+ kDrawDRRect,
+ kDrawImage,
+ kDrawImageRect,
+ kDrawIRect,
+ kDrawLine,
+ kDrawOval,
+ kDrawPath,
+ kDrawRecord,
+ kDrawRect,
+ kDrawRRect,
+ kDrawSkottie,
+ kDrawSlug,
+ kDrawTextBlob,
kNoop,
kRestore,
kRotate,
kSave,
- kSavelayer,
- kSavelayeralpha,
+ kSaveLayer,
+ kSaveLayerAlpha,
kScale,
- kSetmatrix,
- kSetnodeid,
+ kSetMatrix,
+ kSetNodeId,
kTranslate,
- kLastpaintoptype = kTranslate,
+ kLastPaintOpType = kTranslate,
};
CC_PAINT_EXPORT std::string PaintOpTypeToString(PaintOpType type);
@@ -199,7 +199,7 @@
bool HasSaveLayerOps() const { return false; }
bool HasSaveLayerAlphaOps() const { return false; }
// Returns true if effects are present that would break LCD text or be broken
- // by the flags for kSavelayeralpha to preserving LCD text.
+ // by the flags for kSaveLayerAlpha to preserving LCD text.
bool HasEffectsPreventingLCDTextForSaveLayerAlpha() const { return false; }
bool HasDiscardableImages() const { return false; }
@@ -216,13 +216,13 @@
// memory buffers and so don't have their destructors run automatically.
void DestroyThis();
- // kDrawcolor is more restrictive on the blend modes that can be used.
+ // kDrawColor is more restrictive on the blend modes that can be used.
static bool IsValidDrawColorSkBlendMode(SkBlendMode mode) {
return static_cast<uint32_t>(mode) <=
static_cast<uint32_t>(SkBlendMode::kLastCoeffMode);
}
- // PaintFlags can have more complex blend modes than kDrawcolor.
+ // PaintFlags can have more complex blend modes than kDrawColor.
static bool IsValidPaintFlagsSkBlendMode(SkBlendMode mode) {
return static_cast<uint32_t>(mode) <=
static_cast<uint32_t>(SkBlendMode::kLastMode);
@@ -244,7 +244,7 @@
}
static constexpr size_t kNumOpTypes =
- static_cast<size_t>(PaintOpType::kLastpaintoptype) + 1;
+ static_cast<size_t>(PaintOpType::kLastPaintOpType) + 1;
static bool g_is_draw_op[kNumOpTypes];
static bool g_has_paint_flags[kNumOpTypes];
@@ -311,7 +311,7 @@
class CC_PAINT_EXPORT ClipPathOp final : public PaintOp {
public:
- static constexpr PaintOpType kType = PaintOpType::kClippath;
+ static constexpr PaintOpType kType = PaintOpType::kClipPath;
ClipPathOp(SkPath path,
SkClipOp op,
bool antialias,
@@ -341,7 +341,7 @@
class CC_PAINT_EXPORT ClipRectOp final : public PaintOp {
public:
- static constexpr PaintOpType kType = PaintOpType::kCliprect;
+ static constexpr PaintOpType kType = PaintOpType::kClipRect;
ClipRectOp(const SkRect& rect, SkClipOp op, bool antialias)
: PaintOp(kType), rect(rect), op(op), antialias(antialias) {}
static void Raster(const ClipRectOp* op,
@@ -361,7 +361,7 @@
class CC_PAINT_EXPORT ClipRRectOp final : public PaintOp {
public:
- static constexpr PaintOpType kType = PaintOpType::kCliprrect;
+ static constexpr PaintOpType kType = PaintOpType::kClipRRect;
ClipRRectOp(const SkRRect& rrect, SkClipOp op, bool antialias)
: PaintOp(kType), rrect(rrect), op(op), antialias(antialias) {}
static void Raster(const ClipRRectOp* op,
@@ -399,7 +399,7 @@
class CC_PAINT_EXPORT CustomDataOp final : public PaintOp {
public:
- static constexpr PaintOpType kType = PaintOpType::kCustomdata;
+ static constexpr PaintOpType kType = PaintOpType::kCustomData;
explicit CustomDataOp(uint32_t id) : PaintOp(kType), id(id) {}
static void Raster(const CustomDataOp* op,
SkCanvas* canvas,
@@ -417,7 +417,7 @@
class CC_PAINT_EXPORT DrawColorOp final : public PaintOp {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawcolor;
+ static constexpr PaintOpType kType = PaintOpType::kDrawColor;
static constexpr bool kIsDrawOp = true;
DrawColorOp(SkColor4f color, SkBlendMode mode)
: PaintOp(kType), color(color), mode(mode) {}
@@ -437,7 +437,7 @@
class CC_PAINT_EXPORT DrawDRRectOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawdrrect;
+ static constexpr PaintOpType kType = PaintOpType::kDrawDRRect;
static constexpr bool kIsDrawOp = true;
DrawDRRectOp(const SkRRect& outer,
const SkRRect& inner,
@@ -462,7 +462,7 @@
class CC_PAINT_EXPORT DrawImageOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawimage;
+ static constexpr PaintOpType kType = PaintOpType::kDrawImage;
static constexpr bool kIsDrawOp = true;
DrawImageOp(const PaintImage& image, SkScalar left, SkScalar top);
DrawImageOp(const PaintImage& image,
@@ -499,7 +499,7 @@
class CC_PAINT_EXPORT DrawImageRectOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawimagerect;
+ static constexpr PaintOpType kType = PaintOpType::kDrawImageRect;
static constexpr bool kIsDrawOp = true;
DrawImageRectOp(const PaintImage& image,
const SkRect& src,
@@ -541,7 +541,7 @@
class CC_PAINT_EXPORT DrawIRectOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawirect;
+ static constexpr PaintOpType kType = PaintOpType::kDrawIRect;
static constexpr bool kIsDrawOp = true;
DrawIRectOp(const SkIRect& rect, const PaintFlags& flags)
: PaintOpWithFlags(kType, flags), rect(rect) {}
@@ -562,7 +562,7 @@
class CC_PAINT_EXPORT DrawLineOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawline;
+ static constexpr PaintOpType kType = PaintOpType::kDrawLine;
static constexpr bool kIsDrawOp = true;
DrawLineOp(SkScalar x0,
SkScalar y0,
@@ -601,7 +601,7 @@
class CC_PAINT_EXPORT DrawOvalOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawoval;
+ static constexpr PaintOpType kType = PaintOpType::kDrawOval;
static constexpr bool kIsDrawOp = true;
DrawOvalOp(const SkRect& oval, const PaintFlags& flags)
: PaintOpWithFlags(kType, flags), oval(oval) {}
@@ -624,7 +624,7 @@
class CC_PAINT_EXPORT DrawPathOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawpath;
+ static constexpr PaintOpType kType = PaintOpType::kDrawPath;
static constexpr bool kIsDrawOp = true;
DrawPathOp(const SkPath& path,
const PaintFlags& flags,
@@ -657,7 +657,7 @@
class CC_PAINT_EXPORT DrawRecordOp final : public PaintOp {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawrecord;
+ static constexpr PaintOpType kType = PaintOpType::kDrawRecord;
static constexpr bool kIsDrawOp = true;
explicit DrawRecordOp(PaintRecord record);
~DrawRecordOp();
@@ -682,7 +682,7 @@
class CC_PAINT_EXPORT DrawRectOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawrect;
+ static constexpr PaintOpType kType = PaintOpType::kDrawRect;
static constexpr bool kIsDrawOp = true;
DrawRectOp(const SkRect& rect, const PaintFlags& flags)
: PaintOpWithFlags(kType, flags), rect(rect) {}
@@ -702,7 +702,7 @@
class CC_PAINT_EXPORT DrawRRectOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawrrect;
+ static constexpr PaintOpType kType = PaintOpType::kDrawRRect;
static constexpr bool kIsDrawOp = true;
DrawRRectOp(const SkRRect& rrect, const PaintFlags& flags)
: PaintOpWithFlags(kType, flags), rrect(rrect) {}
@@ -722,7 +722,7 @@
class CC_PAINT_EXPORT DrawSkottieOp final : public PaintOp {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawskottie;
+ static constexpr PaintOpType kType = PaintOpType::kDrawSkottie;
static constexpr bool kIsDrawOp = true;
DrawSkottieOp(scoped_refptr<SkottieWrapper> skottie,
SkRect dst,
@@ -769,7 +769,7 @@
class CC_PAINT_EXPORT DrawSlugOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawslug;
+ static constexpr PaintOpType kType = PaintOpType::kDrawSlug;
static constexpr bool kIsDrawOp = true;
DrawSlugOp(sk_sp<sktext::gpu::Slug> slug, const PaintFlags& flags);
~DrawSlugOp();
@@ -797,7 +797,7 @@
class CC_PAINT_EXPORT DrawTextBlobOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kDrawtextblob;
+ static constexpr PaintOpType kType = PaintOpType::kDrawTextBlob;
static constexpr bool kIsDrawOp = true;
DrawTextBlobOp(sk_sp<SkTextBlob> blob,
SkScalar x,
@@ -885,7 +885,7 @@
class CC_PAINT_EXPORT SaveLayerOp final : public PaintOpWithFlags {
public:
- static constexpr PaintOpType kType = PaintOpType::kSavelayer;
+ static constexpr PaintOpType kType = PaintOpType::kSaveLayer;
explicit SaveLayerOp(const PaintFlags& flags)
: PaintOpWithFlags(kType, flags), bounds(kUnsetRect) {}
SaveLayerOp(const SkRect& bounds, const PaintFlags& flags)
@@ -899,7 +899,7 @@
bool HasNonAAPaint() const { return false; }
// We simply assume any effects (or even no effects -- just starting an empty
// transparent layer) would break LCD text or be broken by the flags for
- // kSavelayeralpha to preserve LCD text.
+ // kSaveLayerAlpha to preserve LCD text.
bool HasEffectsPreventingLCDTextForSaveLayerAlpha() const { return true; }
bool HasSaveLayerOps() const { return true; }
HAS_SERIALIZATION_FUNCTIONS();
@@ -912,7 +912,7 @@
class CC_PAINT_EXPORT SaveLayerAlphaOp final : public PaintOp {
public:
- static constexpr PaintOpType kType = PaintOpType::kSavelayeralpha;
+ static constexpr PaintOpType kType = PaintOpType::kSaveLayerAlpha;
template <class F, class = std::enable_if_t<std::is_same_v<F, float>>>
explicit SaveLayerAlphaOp(F alpha)
: PaintOp(kType), bounds(kUnsetRect), alpha(alpha) {}
@@ -955,14 +955,14 @@
class CC_PAINT_EXPORT SetMatrixOp final : public PaintOp {
public:
- static constexpr PaintOpType kType = PaintOpType::kSetmatrix;
+ static constexpr PaintOpType kType = PaintOpType::kSetMatrix;
explicit SetMatrixOp(const SkM44& matrix) : PaintOp(kType), matrix(matrix) {}
// This is the only op that needs the original ctm of the SkCanvas
- // used for raster (since kSetmatrix is relative to the recording origin and
+ // used for raster (since kSetMatrix is relative to the recording origin and
// shouldn't clobber the SkCanvas raster origin).
//
// TODO(enne): Find some cleaner way to do this, possibly by making
- // all kSetmatrix calls kConcat??
+ // all kSetMatrix calls kConcat??
static void Raster(const SetMatrixOp* op,
SkCanvas* canvas,
const PlaybackParams& params);
@@ -978,7 +978,7 @@
class CC_PAINT_EXPORT SetNodeIdOp final : public PaintOp {
public:
- static constexpr PaintOpType kType = PaintOpType::kSetnodeid;
+ static constexpr PaintOpType kType = PaintOpType::kSetNodeId;
explicit SetNodeIdOp(int node_id) : PaintOp(kType), node_id(node_id) {}
static void Raster(const SetNodeIdOp* op,
SkCanvas* canvas,
diff --git a/cc/paint/paint_op_buffer_iterator.cc b/cc/paint/paint_op_buffer_iterator.cc
index 28ba1af6..e97998a5 100644
--- a/cc/paint/paint_op_buffer_iterator.cc
+++ b/cc/paint/paint_op_buffer_iterator.cc
@@ -15,7 +15,7 @@
static const PaintOp* GetNestedSingleDrawingOp(const PaintOp* op) {
if (!op->IsDrawOp())
return nullptr;
- while (op->GetType() == PaintOpType::kDrawrecord) {
+ while (op->GetType() == PaintOpType::kDrawRecord) {
auto* draw_record_op = static_cast<const DrawRecordOp*>(op);
if (draw_record_op->record.size() > 1) {
// If there's more than one op, then we need to keep the
@@ -65,7 +65,7 @@
current_alpha_ = 1.0f;
for (current_op_ = NextUnfoldedOp(); current_op_;
current_op_ = NextUnfoldedOp()) {
- if (current_op_->GetType() != PaintOpType::kSavelayeralpha) {
+ if (current_op_->GetType() != PaintOpType::kSaveLayerAlpha) {
break;
}
const PaintOp* second = NextUnfoldedOp();
@@ -73,7 +73,7 @@
break;
if (second->GetType() == PaintOpType::kRestore) {
- // Drop a kSavelayeralpha/kRestore combo.
+ // Drop a kSaveLayerAlpha/kRestore combo.
continue;
}
@@ -89,16 +89,16 @@
auto* save_op = static_cast<const SaveLayerAlphaOp*>(current_op_);
if (draw_op->IsPaintOpWithFlags() &&
// SkPaint::drawTextBlob() applies alpha on each glyph so we don't
- // fold kSavelayeralpha into DrwaTextBlob to ensure correct alpha
+ // fold kSaveLayerAlpha into DrwaTextBlob to ensure correct alpha
// even if some glyphs overlap.
- draw_op->GetType() != PaintOpType::kDrawtextblob) {
+ draw_op->GetType() != PaintOpType::kDrawTextBlob) {
auto* flags_op = static_cast<const PaintOpWithFlags*>(draw_op);
if (flags_op->flags.SupportsFoldingAlpha()) {
current_alpha_ = save_op->alpha;
current_op_ = draw_op;
break;
}
- } else if (draw_op->GetType() == PaintOpType::kDrawcolor &&
+ } else if (draw_op->GetType() == PaintOpType::kDrawColor &&
static_cast<const DrawColorOp*>(draw_op)->mode ==
SkBlendMode::kSrcOver) {
auto* draw_color_op = static_cast<const DrawColorOp*>(draw_op);
@@ -112,7 +112,7 @@
}
// If we get here, then we could not find a foldable sequence after
- // this kSavelayeralpha, so store any peeked at ops.
+ // this kSaveLayerAlpha, so store any peeked at ops.
stack_.push_back(second);
if (third)
stack_.push_back(third);
diff --git a/cc/paint/paint_op_buffer_iterator.h b/cc/paint/paint_op_buffer_iterator.h
index d97c605e..a5b6847 100644
--- a/cc/paint/paint_op_buffer_iterator.h
+++ b/cc/paint/paint_op_buffer_iterator.h
@@ -123,7 +123,7 @@
op_offset_ = target_offset;
DCHECK(!*this || (*this)->type <=
- static_cast<uint32_t>(PaintOpType::kLastpaintoptype));
+ static_cast<uint32_t>(PaintOpType::kLastPaintOpType));
return *this;
}
OffsetIterator operator++(int) {
diff --git a/cc/paint/paint_op_buffer_serializer.cc b/cc/paint/paint_op_buffer_serializer.cc
index 5024d17..ee5f1a8e 100644
--- a/cc/paint/paint_op_buffer_serializer.cc
+++ b/cc/paint/paint_op_buffer_serializer.cc
@@ -200,11 +200,11 @@
PaintOp::QuickRejectDraw(op, canvas);
// Skip text ops if there is no SkStrikeServer.
skip_op |=
- op.GetType() == PaintOpType::kDrawtextblob && !options_.strike_server;
+ op.GetType() == PaintOpType::kDrawTextBlob && !options_.strike_server;
if (skip_op)
return true;
- if (op.GetType() == PaintOpType::kDrawrecord) {
+ if (op.GetType() == PaintOpType::kDrawRecord) {
int save_count = canvas->getSaveCount();
Save(canvas, params);
SerializeBuffer(
@@ -213,7 +213,7 @@
return true;
}
- if (op.GetType() == PaintOpType::kDrawimagerect &&
+ if (op.GetType() == PaintOpType::kDrawImageRect &&
static_cast<const DrawImageRectOp&>(op).image.IsPaintWorklet()) {
DCHECK(options_.image_provider);
const DrawImageRectOp& draw_op = static_cast<const DrawImageRectOp&>(op);
@@ -342,7 +342,7 @@
// 2) kDrawtextblob ops since they need to be analyzed by the cache diff
// canvas
// to serialize/lock the requisite glyphs for this op.
- if (op.IsDrawOp() && op.GetType() != PaintOpType::kDrawtextblob) {
+ if (op.IsDrawOp() && op.GetType() != PaintOpType::kDrawTextBlob) {
return;
}
diff --git a/cc/paint/paint_op_buffer_unittest.cc b/cc/paint/paint_op_buffer_unittest.cc
index a1fa0bd..cb14513e 100644
--- a/cc/paint/paint_op_buffer_unittest.cc
+++ b/cc/paint/paint_op_buffer_unittest.cc
@@ -255,7 +255,7 @@
EXPECT_TRUE(original.EqualsForTesting(destination));
}
-// Verify that a kSavelayeralpha / Draw / kRestore can be optimized to just
+// Verify that a kSaveLayerAlpha / Draw / kRestore can be optimized to just
// a draw with opacity.
TEST(PaintOpBufferTest, SaveDrawRestore) {
PaintOpBuffer buffer;
@@ -285,7 +285,7 @@
EXPECT_NEAR(expected_alpha, canvas.paint_.getAlphaf(), 0.01f);
}
-// Verify that we don't optimize kSavelayeralpha / kDrawtextblob / kRestore.
+// Verify that we don't optimize kSaveLayerAlpha / kDrawTextBlob / kRestore.
TEST(PaintOpBufferTest, SaveDrawTextBlobRestore) {
PaintOpBuffer buffer;
@@ -405,7 +405,7 @@
}
// Test that the save/draw/restore optimization applies if the single op
-// is a kDrawrecord that itself has a single draw op.
+// is a kDrawRecord that itself has a single draw op.
TEST(PaintOpBufferTest, SaveDrawRestore_SingleOpRecordWithSingleOp) {
PaintOpBuffer sub_buffer;
@@ -757,7 +757,7 @@
for (PaintOpBuffer::PlaybackFoldingIterator iter(buffer_, &offsets); iter;
++iter) {
const PaintOp& op = *iter;
- EXPECT_EQ(op.GetType(), PaintOpType::kDrawimagerect);
+ EXPECT_EQ(op.GetType(), PaintOpType::kDrawImageRect);
EXPECT_TRUE(PaintOp::QuickRejectDraw(op, canvas));
}
}
@@ -863,7 +863,7 @@
testing::Sequence s;
EXPECT_CALL(canvas, OnDrawPaintWithColor(0u)).InSequence(s);
EXPECT_CALL(canvas, OnDrawPaintWithColor(1u)).InSequence(s);
- // The empty kSavelayeralpha/kRestore is dropped.
+ // The empty kSaveLayerAlpha/kRestore is dropped.
EXPECT_CALL(canvas, OnDrawPaintWithColor(2u)).InSequence(s);
EXPECT_CALL(canvas, OnDrawPaintWithColor(3u)).InSequence(s);
EXPECT_CALL(canvas, OnDrawPaintWithColor(4u)).InSequence(s);
@@ -891,7 +891,7 @@
testing::Sequence s;
EXPECT_CALL(canvas, OnDrawPaintWithColor(0u)).InSequence(s);
EXPECT_CALL(canvas, OnDrawPaintWithColor(1u)).InSequence(s);
- // The kSavelayeralpha/kRestore is not dropped if we draw the middle
+ // The kSaveLayerAlpha/kRestore is not dropped if we draw the middle
// range, as we need them to represent the two draws inside the layer
// correctly.
EXPECT_CALL(canvas, OnSaveLayer()).InSequence(s);
@@ -908,7 +908,7 @@
testing::Sequence s;
EXPECT_CALL(canvas, OnDrawPaintWithColor(0u)).InSequence(s);
EXPECT_CALL(canvas, OnDrawPaintWithColor(1u)).InSequence(s);
- // The now-empty kSavelayeralpha/kRestore is dropped
+ // The now-empty kSaveLayerAlpha/kRestore is dropped
EXPECT_CALL(canvas, OnDrawPaintWithColor(4u)).InSequence(s);
Playback(&canvas, Select({0, 1, 2, 5, 6}));
}
@@ -939,7 +939,7 @@
testing::Sequence s;
EXPECT_CALL(canvas, OnDrawRectWithColor(0u)).InSequence(s);
EXPECT_CALL(canvas, OnDrawRectWithColor(1u)).InSequence(s);
- // The empty kSavelayeralpha/kRestore is dropped, the containing
+ // The empty kSaveLayerAlpha/kRestore is dropped, the containing
// operation can be drawn with alpha.
EXPECT_CALL(canvas, OnDrawRectWithColor(2u)).InSequence(s);
EXPECT_CALL(canvas, OnDrawRectWithColor(3u)).InSequence(s);
@@ -969,7 +969,7 @@
// Items are are {0, 1, save, 2, 3, 4, restore}.
- // If the middle range is played, then the kSavelayeralpha/kRestore
+ // If the middle range is played, then the kSaveLayerAlpha/kRestore
// can't be dropped.
{
testing::Sequence s;
@@ -984,7 +984,7 @@
}
Mock::VerifyAndClearExpectations(&canvas);
- // If the middle range is not played, then the kSavelayeralpha/kRestore
+ // If the middle range is not played, then the kSaveLayerAlpha/kRestore
// can be dropped.
{
testing::Sequence s;
@@ -995,7 +995,7 @@
}
Mock::VerifyAndClearExpectations(&canvas);
- // If the middle range is not played, then the kSavelayeralpha/kRestore
+ // If the middle range is not played, then the kSaveLayerAlpha/kRestore
// can be dropped.
{
testing::Sequence s;
@@ -1299,8 +1299,8 @@
size_t bytes_to_read = 0;
EXPECT_TRUE(
ReadAndValidateOpHeader(current_, remaining_, &type, &bytes_to_read));
- if (op.GetType() == PaintOpType::kDrawtextblob) {
- EXPECT_EQ(type, static_cast<int>(PaintOpType::kDrawslug));
+ if (op.GetType() == PaintOpType::kDrawTextBlob) {
+ EXPECT_EQ(type, static_cast<int>(PaintOpType::kDrawSlug));
} else {
EXPECT_EQ(op.type, type);
}
@@ -1811,61 +1811,61 @@
case PaintOpType::kAnnotate:
PushAnnotateOps(&buffer_);
break;
- case PaintOpType::kClippath:
+ case PaintOpType::kClipPath:
PushClipPathOps(&buffer_);
break;
- case PaintOpType::kCliprect:
+ case PaintOpType::kClipRect:
PushClipRectOps(&buffer_);
break;
- case PaintOpType::kCliprrect:
+ case PaintOpType::kClipRRect:
PushClipRRectOps(&buffer_);
break;
case PaintOpType::kConcat:
PushConcatOps(&buffer_);
break;
- case PaintOpType::kCustomdata:
+ case PaintOpType::kCustomData:
PushCustomDataOps(&buffer_);
break;
- case PaintOpType::kDrawcolor:
+ case PaintOpType::kDrawColor:
PushDrawColorOps(&buffer_);
break;
- case PaintOpType::kDrawdrrect:
+ case PaintOpType::kDrawDRRect:
PushDrawDRRectOps(&buffer_);
break;
- case PaintOpType::kDrawimage:
+ case PaintOpType::kDrawImage:
PushDrawImageOps(&buffer_);
break;
- case PaintOpType::kDrawimagerect:
+ case PaintOpType::kDrawImageRect:
PushDrawImageRectOps(&buffer_);
break;
- case PaintOpType::kDrawirect:
+ case PaintOpType::kDrawIRect:
PushDrawIRectOps(&buffer_);
break;
- case PaintOpType::kDrawline:
+ case PaintOpType::kDrawLine:
PushDrawLineOps(&buffer_);
break;
- case PaintOpType::kDrawoval:
+ case PaintOpType::kDrawOval:
PushDrawOvalOps(&buffer_);
break;
- case PaintOpType::kDrawpath:
+ case PaintOpType::kDrawPath:
PushDrawPathOps(&buffer_);
break;
- case PaintOpType::kDrawrecord:
+ case PaintOpType::kDrawRecord:
// Not supported.
break;
- case PaintOpType::kDrawrect:
+ case PaintOpType::kDrawRect:
PushDrawRectOps(&buffer_);
break;
- case PaintOpType::kDrawrrect:
+ case PaintOpType::kDrawRRect:
PushDrawRRectOps(&buffer_);
break;
- case PaintOpType::kDrawskottie:
+ case PaintOpType::kDrawSkottie:
PushDrawSkottieOps(&buffer_);
break;
- case PaintOpType::kDrawslug:
- // TODO(crbug.com/1321150): fix the test for kDrawslug.
+ case PaintOpType::kDrawSlug:
+ // TODO(crbug.com/1321150): fix the test for kDrawSlug.
break;
- case PaintOpType::kDrawtextblob:
+ case PaintOpType::kDrawTextBlob:
// TODO(crbug.com/1321150): fix the test for kDrawtextblobs
// PushDrawTextBlobOps(&buffer_);
break;
@@ -1881,22 +1881,22 @@
case PaintOpType::kSave:
PushSaveOps(&buffer_);
break;
- case PaintOpType::kSavelayer:
+ case PaintOpType::kSaveLayer:
PushSaveLayerOps(&buffer_);
break;
- case PaintOpType::kSavelayeralpha:
+ case PaintOpType::kSaveLayerAlpha:
PushSaveLayerAlphaOps(&buffer_);
break;
case PaintOpType::kScale:
PushScaleOps(&buffer_);
break;
- case PaintOpType::kSetmatrix:
+ case PaintOpType::kSetMatrix:
PushSetMatrixOps(&buffer_);
break;
case PaintOpType::kTranslate:
PushTranslateOps(&buffer_);
break;
- case PaintOpType::kSetnodeid:
+ case PaintOpType::kSetNodeId:
PushSetNodeIdOps(&buffer_);
break;
}
@@ -1910,15 +1910,15 @@
bool IsTypeSupported() {
// TODO(crbug.com/1321150): fix the test for kDrawtextblobs
- if (GetParamType() == PaintOpType::kDrawtextblob ||
- GetParamType() == PaintOpType::kDrawslug) {
+ if (GetParamType() == PaintOpType::kDrawTextBlob ||
+ GetParamType() == PaintOpType::kDrawSlug) {
return false;
}
// DrawRecordOps must be flattened and are not currently serialized. All
// other types must push non-zero amounts of ops in PushTestOps.
- return GetParamType() != PaintOpType::kDrawrecord &&
- (GetParamType() != PaintOpType::kDrawskottie || kIsSkottieSupported);
+ return GetParamType() != PaintOpType::kDrawRecord &&
+ (GetParamType() != PaintOpType::kDrawSkottie || kIsSkottieSupported);
}
protected:
@@ -1931,7 +1931,7 @@
P,
PaintOpSerializationTest,
::testing::Range(static_cast<uint8_t>(0),
- static_cast<uint8_t>(PaintOpType::kLastpaintoptype)));
+ static_cast<uint8_t>(PaintOpType::kLastPaintOpType)));
// Test serializing and then deserializing all test ops. They should all
// write successfully and be identical to the original ops in the buffer.
@@ -2135,8 +2135,8 @@
}
// See https://crbug.com/1321150#c3.
- if (GetParamType() == PaintOpType::kDrawtextblob ||
- GetParamType() == PaintOpType::kDrawslug) {
+ if (GetParamType() == PaintOpType::kDrawTextBlob ||
+ GetParamType() == PaintOpType::kDrawSlug) {
return;
}
@@ -2262,7 +2262,7 @@
PaintOpBuffer::Iterator iter(buffer);
const PaintOp* op = iter.get();
ASSERT_TRUE(op);
- EXPECT_EQ(op->GetType(), PaintOpType::kDrawtextblob);
+ EXPECT_EQ(op->GetType(), PaintOpType::kDrawTextBlob);
size_t output_size = kSerializedBytesPerOp * buffer.size();
std::unique_ptr<char, base::AlignedFreeDeleter> output =
@@ -2291,7 +2291,7 @@
output.get(), serializer.TotalBytesWritten(),
serializer.options_provider()->deserialize_options())) {
ASSERT_TRUE(iter);
- EXPECT_EQ(PaintOpType::kDrawslug, base_written.GetType());
+ EXPECT_EQ(PaintOpType::kDrawSlug, base_written.GetType());
++iter;
++i;
}
@@ -2479,7 +2479,7 @@
// Bogus types fail to deserialize.
PaintOpWriter::WriteHeaderForTesting(
- input.get(), static_cast<uint8_t>(PaintOpType::kLastpaintoptype) + 1,
+ input.get(), static_cast<uint8_t>(PaintOpType::kLastPaintOpType) + 1,
serialized_size);
EXPECT_FALSE(PaintOp::Deserialize(input.get(), bytes_written, output,
std::size(output), &bytes_read,
@@ -3185,7 +3185,7 @@
PlaybackParams params(nullptr);
testing::Sequence s;
- if (op.GetType() == PaintOpType::kDrawimage) {
+ if (op.GetType() == PaintOpType::kDrawImage) {
// Save/scale/image/restore from DrawImageop.
EXPECT_CALL(canvas, willSave()).InSequence(s);
EXPECT_CALL(canvas, didScale(1.0f / expected_scale.width(),
@@ -3196,13 +3196,13 @@
SkCanvas::kFast_SrcRectConstraint));
EXPECT_CALL(canvas, willRestore()).InSequence(s);
op.Raster(&canvas, params);
- } else if (op.GetType() == PaintOpType::kDrawimagerect) {
+ } else if (op.GetType() == PaintOpType::kDrawImageRect) {
EXPECT_CALL(canvas, onDrawImageRect2(NonLazyImage(),
MatchesRect(rect, expected_scale),
SkRect::MakeWH(10, 10), _, _,
SkCanvas::kFast_SrcRectConstraint));
op.Raster(&canvas, params);
- } else if (op.GetType() == PaintOpType::kDrawoval) {
+ } else if (op.GetType() == PaintOpType::kDrawOval) {
EXPECT_CALL(canvas, onDrawOval(SkRect::MakeWH(10, 10),
MatchesShader(flags, expected_scale)));
op.Raster(&canvas, params);
@@ -3595,7 +3595,7 @@
PaintOpBuffer new_buffer = std::move(buffer);
EXPECT_EQ(buffer.size(), 0u);
EXPECT_EQ(new_buffer.size(), 1u);
- EXPECT_EQ(new_buffer.GetFirstOp().GetType(), PaintOpType::kCustomdata);
+ EXPECT_EQ(new_buffer.GetFirstOp().GetType(), PaintOpType::kCustomData);
PaintOpBuffer buffer2;
buffer2.push<CustomDataOp>(1234u);
@@ -3783,7 +3783,7 @@
EXPECT_EQ(buffers[i]->size(), 2u);
for (const PaintOp& base_op : *buffers[i]) {
- if (base_op.GetType() != PaintOpType::kDrawrect) {
+ if (base_op.GetType() != PaintOpType::kDrawRect) {
continue;
}
const auto& op = static_cast<const DrawRectOp&>(base_op);
@@ -3984,7 +3984,7 @@
EXPECT_FALSE(buffer2.has_save_layer_alpha_ops());
EXPECT_TRUE(buffer2.has_effects_preventing_lcd_text_for_save_layer_alpha());
- // Neither buffer has effects preventing lcd text for kSavelayeralpha.
+ // Neither buffer has effects preventing lcd text for kSaveLayerAlpha.
EXPECT_FALSE(buffer1.NeedsAdditionalInvalidationForLCDText(buffer2));
EXPECT_FALSE(buffer2.NeedsAdditionalInvalidationForLCDText(buffer1));
@@ -3993,7 +3993,7 @@
PaintOpBuffer buffer3;
buffer3.push<DrawRecordOp>(record2);
EXPECT_TRUE(buffer3.has_effects_preventing_lcd_text_for_save_layer_alpha());
- // Neither buffer has both DrawText and kSavelayeralpha.
+ // Neither buffer has both DrawText and kSaveLayerAlpha.
EXPECT_FALSE(buffer1.NeedsAdditionalInvalidationForLCDText(buffer3));
EXPECT_FALSE(buffer3.NeedsAdditionalInvalidationForLCDText(buffer1));
EXPECT_FALSE(
@@ -4015,7 +4015,7 @@
EXPECT_TRUE(buffer3.has_draw_text_ops());
EXPECT_TRUE(buffer3.has_save_layer_alpha_ops());
EXPECT_TRUE(buffer3.has_effects_preventing_lcd_text_for_save_layer_alpha());
- // Both have DrawText and kSavelayeralpha, and have different
+ // Both have DrawText and kSaveLayerAlpha, and have different
// has_effects_preventing_lcd_text_for_save_layer_alpha().
EXPECT_TRUE(
record1.buffer().NeedsAdditionalInvalidationForLCDText(buffer3));
@@ -4026,7 +4026,7 @@
}
// A regression test for crbug.com/1195276. Ensure that PlaybackParams works
-// with kSetmatrix operations.
+// with kSetMatrix operations.
TEST(PaintOpBufferTest, SetMatrixOpWithNonIdentityPlaybackParams) {
for (const auto& original_ctm : test_matrices) {
for (const auto& matrix : test_matrices) {
diff --git a/cc/paint/paint_op_reader.cc b/cc/paint/paint_op_reader.cc
index 1af06fd..06536c7 100644
--- a/cc/paint/paint_op_reader.cc
+++ b/cc/paint/paint_op_reader.cc
@@ -106,7 +106,7 @@
if (*serialized_size % BufferAlignment() != 0) {
return false;
}
- if (*type > static_cast<uint8_t>(PaintOpType::kLastpaintoptype)) {
+ if (*type > static_cast<uint8_t>(PaintOpType::kLastPaintOpType)) {
return false;
}
return true;
diff --git a/cc/paint/solid_color_analyzer.cc b/cc/paint/solid_color_analyzer.cc
index 7170e090..6e239da 100644
--- a/cc/paint/solid_color_analyzer.cc
+++ b/cc/paint/solid_color_analyzer.cc
@@ -267,7 +267,7 @@
const PaintOp& op = *frame.iter;
PlaybackParams params(nullptr, SkM44(frame.original_ctm));
switch (op.GetType()) {
- case PaintOpType::kDrawrecord: {
+ case PaintOpType::kDrawRecord: {
const auto& record_op = static_cast<const DrawRecordOp&>(op);
stack.emplace_back(PaintOpBuffer::CompositeIterator(
record_op.record.buffer(), nullptr),
@@ -276,16 +276,16 @@
}
// Any of the following ops result in non solid content.
- case PaintOpType::kDrawdrrect:
- case PaintOpType::kDrawimage:
- case PaintOpType::kDrawimagerect:
- case PaintOpType::kDrawirect:
- case PaintOpType::kDrawline:
- case PaintOpType::kDrawoval:
- case PaintOpType::kDrawpath:
+ case PaintOpType::kDrawDRRect:
+ case PaintOpType::kDrawImage:
+ case PaintOpType::kDrawImageRect:
+ case PaintOpType::kDrawIRect:
+ case PaintOpType::kDrawLine:
+ case PaintOpType::kDrawOval:
+ case PaintOpType::kDrawPath:
return std::nullopt;
// TODO(vmpstr): Add more tests on exceeding max_ops_to_analyze.
- case PaintOpType::kDrawrrect: {
+ case PaintOpType::kDrawRRect: {
if (++num_draw_ops > max_ops_to_analyze)
return std::nullopt;
const auto& rrect_op = static_cast<const DrawRRectOp&>(op);
@@ -293,20 +293,20 @@
&is_transparent, &color);
break;
}
- case PaintOpType::kDrawskottie:
- case PaintOpType::kDrawslug:
- case PaintOpType::kDrawtextblob:
+ case PaintOpType::kDrawSkottie:
+ case PaintOpType::kDrawSlug:
+ case PaintOpType::kDrawTextBlob:
// Anything that has to do a save layer is probably not solid. As it will
// likely need more than one draw op.
// TODO(vmpstr): We could investigate handling these.
- case PaintOpType::kSavelayer:
- case PaintOpType::kSavelayeralpha:
+ case PaintOpType::kSaveLayer:
+ case PaintOpType::kSaveLayerAlpha:
// Complex clips will probably result in non solid color as it might not
// cover the canvas.
// TODO(vmpstr): We could investigate handling these.
- case PaintOpType::kClippath:
+ case PaintOpType::kClipPath:
return std::nullopt;
- case PaintOpType::kCliprrect: {
+ case PaintOpType::kClipRRect: {
const auto& rrect_op = static_cast<const ClipRRectOp&>(op);
bool does_cover_canvas =
CheckIfRRectClipCoversCanvas(canvas, rrect_op.rrect);
@@ -316,7 +316,7 @@
return std::nullopt;
break;
}
- case PaintOpType::kDrawrect: {
+ case PaintOpType::kDrawRect: {
if (++num_draw_ops > max_ops_to_analyze)
return std::nullopt;
const auto& rect_op = static_cast<const DrawRectOp&>(op);
@@ -324,7 +324,7 @@
&is_transparent, &color);
break;
}
- case PaintOpType::kDrawcolor: {
+ case PaintOpType::kDrawColor: {
if (++num_draw_ops > max_ops_to_analyze)
return std::nullopt;
const auto& color_op = static_cast<const DrawColorOp&>(op);
@@ -332,7 +332,7 @@
&is_transparent, &color);
break;
}
- case PaintOpType::kCliprect: {
+ case PaintOpType::kClipRect: {
// SolidColorAnalyzer uses an SkNoDrawCanvas which uses an
// SkNoPixelsDevice which says (without looking) that the canvas's
// clip is always a rect. So, if this clip could result in not
@@ -346,15 +346,15 @@
// Don't affect the canvas, so ignore.
case PaintOpType::kAnnotate:
- case PaintOpType::kCustomdata:
- case PaintOpType::kSetnodeid:
+ case PaintOpType::kCustomData:
+ case PaintOpType::kSetNodeId:
case PaintOpType::kNoop:
break;
// The rest of the ops should only affect our state canvas.
case PaintOpType::kConcat:
case PaintOpType::kScale:
- case PaintOpType::kSetmatrix:
+ case PaintOpType::kSetMatrix:
case PaintOpType::kRestore:
case PaintOpType::kRotate:
case PaintOpType::kSave:
diff --git a/cc/test/paint_op_helper.h b/cc/test/paint_op_helper.h
index 4682e9f..b1da0d3 100644
--- a/cc/test/paint_op_helper.h
+++ b/cc/test/paint_op_helper.h
@@ -44,190 +44,170 @@
static std::string ToString(const PaintOp& base_op) {
std::ostringstream str;
- str << std::boolalpha;
+ str << std::boolalpha << base_op.GetType() << "(";
switch (base_op.GetType()) {
case PaintOpType::kAnnotate: {
const auto& op = static_cast<const AnnotateOp&>(base_op);
- str << "AnnotateOp(type=" << ToString(op.annotation_type)
- << ", rect=" << ToString(op.rect) << ", data=" << ToString(op.data)
- << ")";
+ str << "type=" << ToString(op.annotation_type)
+ << ", rect=" << ToString(op.rect) << ", data=" << ToString(op.data);
break;
}
- case PaintOpType::kClippath: {
+ case PaintOpType::kClipPath: {
const auto& op = static_cast<const ClipPathOp&>(base_op);
- str << "ClipPathOp(path=" << ToString(op.path)
- << ", op=" << ToString(op.op) << ", antialias=" << op.antialias
- << ", use_cache=" << (op.use_cache == UsePaintCache::kEnabled)
- << ")";
+ str << "path=" << ToString(op.path) << ", op=" << ToString(op.op)
+ << ", antialias=" << op.antialias
+ << ", use_cache=" << (op.use_cache == UsePaintCache::kEnabled);
break;
}
- case PaintOpType::kCliprect: {
+ case PaintOpType::kClipRect: {
const auto& op = static_cast<const ClipRectOp&>(base_op);
- str << "ClipRectOp(rect=" << ToString(op.rect)
- << ", op=" << ToString(op.op) << ", antialias=" << op.antialias
- << ")";
+ str << "rect=" << ToString(op.rect) << ", op=" << ToString(op.op)
+ << ", antialias=" << op.antialias;
break;
}
- case PaintOpType::kCliprrect: {
+ case PaintOpType::kClipRRect: {
const auto& op = static_cast<const ClipRRectOp&>(base_op);
- str << "ClipRRectOp(rrect=" << ToString(op.rrect)
- << ", op=" << ToString(op.op) << ", antialias=" << op.antialias
- << ")";
+ str << "rrect=" << ToString(op.rrect) << ", op=" << ToString(op.op)
+ << ", antialias=" << op.antialias;
break;
}
case PaintOpType::kConcat: {
const auto& op = static_cast<const ConcatOp&>(base_op);
- str << "ConcatOp(matrix=" << ToString(op.matrix) << ")";
+ str << "matrix=" << ToString(op.matrix);
break;
}
- case PaintOpType::kCustomdata: {
+ case PaintOpType::kCustomData: {
const auto& op = static_cast<const CustomDataOp&>(base_op);
- str << "CustomDataOp(id=" << ToString(op.id) << ")";
+ str << "id=" << ToString(op.id);
break;
}
- case PaintOpType::kDrawcolor: {
+ case PaintOpType::kDrawColor: {
const auto& op = static_cast<const DrawColorOp&>(base_op);
- str << "DrawColorOp(color=" << ToString(op.color)
- << ", mode=" << ToString(op.mode) << ")";
+ str << "color=" << ToString(op.color) << ", mode=" << ToString(op.mode);
break;
}
- case PaintOpType::kDrawdrrect: {
+ case PaintOpType::kDrawDRRect: {
const auto& op = static_cast<const DrawDRRectOp&>(base_op);
- str << "DrawDRRectOp(outer=" << ToString(op.outer)
+ str << "outer=" << ToString(op.outer)
<< ", inner=" << ToString(op.inner)
- << ", flags=" << ToString(op.flags) << ")";
+ << ", flags=" << ToString(op.flags);
break;
}
- case PaintOpType::kDrawimage: {
+ case PaintOpType::kDrawImage: {
const auto& op = static_cast<const DrawImageOp&>(base_op);
- str << "DrawImageOp(image=" << ToString(op.image)
- << ", left=" << ToString(op.left) << ", top=" << ToString(op.top)
- << ", flags=" << ToString(op.flags) << ")";
+ str << "image=" << ToString(op.image) << ", left=" << ToString(op.left)
+ << ", top=" << ToString(op.top) << ", flags=" << ToString(op.flags);
break;
}
- case PaintOpType::kDrawimagerect: {
+ case PaintOpType::kDrawImageRect: {
const auto& op = static_cast<const DrawImageRectOp&>(base_op);
- str << "DrawImageRectOp(image=" << ToString(op.image)
- << ", src=" << ToString(op.src) << ", dst=" << ToString(op.dst)
+ str << "image=" << ToString(op.image) << ", src=" << ToString(op.src)
+ << ", dst=" << ToString(op.dst)
<< ", constraint=" << ToString(op.constraint)
- << ", flags=" << ToString(op.flags) << ")";
+ << ", flags=" << ToString(op.flags);
break;
}
- case PaintOpType::kDrawirect: {
+ case PaintOpType::kDrawIRect: {
const auto& op = static_cast<const DrawIRectOp&>(base_op);
- str << "DrawIRectOp(rect=" << ToString(op.rect)
- << ", flags=" << ToString(op.flags) << ")";
+ str << "rect=" << ToString(op.rect) << ", flags=" << ToString(op.flags);
break;
}
- case PaintOpType::kDrawline: {
+ case PaintOpType::kDrawLine: {
const auto& op = static_cast<const DrawLineOp&>(base_op);
- str << "DrawLineOp(x0=" << ToString(op.x0) << ", y0=" << ToString(op.y0)
+ str << "x0=" << ToString(op.x0) << ", y0=" << ToString(op.y0)
<< ", x1=" << ToString(op.x1) << ", y1=" << ToString(op.y1)
- << ", flags=" << ToString(op.flags) << ")";
+ << ", flags=" << ToString(op.flags);
break;
}
- case PaintOpType::kDrawoval: {
+ case PaintOpType::kDrawOval: {
const auto& op = static_cast<const DrawOvalOp&>(base_op);
- str << "DrawOvalOp(oval=" << ToString(op.oval)
- << ", flags=" << ToString(op.flags) << ")";
+ str << "oval=" << ToString(op.oval) << ", flags=" << ToString(op.flags);
break;
}
- case PaintOpType::kDrawpath: {
+ case PaintOpType::kDrawPath: {
const auto& op = static_cast<const DrawPathOp&>(base_op);
- str << "DrawPathOp(path=" << ToString(op.path)
- << ", flags=" << ToString(op.flags)
- << ", use_cache=" << (op.use_cache == UsePaintCache::kEnabled)
- << ")";
+ str << "path=" << ToString(op.path) << ", flags=" << ToString(op.flags)
+ << ", use_cache=" << (op.use_cache == UsePaintCache::kEnabled);
break;
}
- case PaintOpType::kDrawrecord: {
+ case PaintOpType::kDrawRecord: {
const auto& op = static_cast<const DrawRecordOp&>(base_op);
- str << "DrawRecordOp(record=" << ToString(op.record) << ")";
+ str << "record=" << ToString(op.record);
break;
}
- case PaintOpType::kDrawrect: {
+ case PaintOpType::kDrawRect: {
const auto& op = static_cast<const DrawRectOp&>(base_op);
- str << "DrawRectOp(rect=" << ToString(op.rect)
- << ", flags=" << ToString(op.flags) << ")";
+ str << "rect=" << ToString(op.rect) << ", flags=" << ToString(op.flags);
break;
}
- case PaintOpType::kDrawrrect: {
+ case PaintOpType::kDrawRRect: {
const auto& op = static_cast<const DrawRRectOp&>(base_op);
- str << "DrawRRectOp(rrect=" << ToString(op.rrect)
- << ", flags=" << ToString(op.flags) << ")";
+ str << "rrect=" << ToString(op.rrect)
+ << ", flags=" << ToString(op.flags);
break;
}
- case PaintOpType::kDrawskottie: {
+ case PaintOpType::kDrawSkottie: {
const auto& op = static_cast<const DrawSkottieOp&>(base_op);
- str << "DrawSkottieOp("
- << "skottie=" << ToString(op.skottie)
- << ", dst=" << ToString(op.dst) << ", t=" << op.t << ")";
+ str << "skottie=" << ToString(op.skottie)
+ << ", dst=" << ToString(op.dst) << ", t=" << op.t;
break;
}
- case PaintOpType::kDrawtextblob: {
+ case PaintOpType::kDrawTextBlob: {
const auto& op = static_cast<const DrawTextBlobOp&>(base_op);
- str << "DrawTextBlobOp(blob=" << ToString(op.blob)
- << ", x=" << ToString(op.x) << ", y=" << ToString(op.y)
- << ", flags=" << ToString(op.flags) << ")";
+ str << "blob=" << ToString(op.blob) << ", x=" << ToString(op.x)
+ << ", y=" << ToString(op.y) << ", flags=" << ToString(op.flags);
break;
}
- case PaintOpType::kDrawslug: {
+ case PaintOpType::kDrawSlug: {
const auto& op = static_cast<const DrawSlugOp&>(base_op);
- str << "DrawSlugOp(flags=" << ToString(op.flags) << ")";
+ str << "flags=" << ToString(op.flags);
break;
}
- case PaintOpType::kNoop: {
- str << "NoopOp()";
+ case PaintOpType::kNoop:
break;
- }
- case PaintOpType::kRestore: {
- str << "RestoreOp()";
+ case PaintOpType::kRestore:
break;
- }
case PaintOpType::kRotate: {
const auto& op = static_cast<const RotateOp&>(base_op);
- str << "RotateOp(degrees=" << ToString(op.degrees) << ")";
+ str << "degrees=" << ToString(op.degrees);
break;
}
- case PaintOpType::kSave: {
- str << "SaveOp()";
+ case PaintOpType::kSave:
break;
- }
- case PaintOpType::kSavelayer: {
+ case PaintOpType::kSaveLayer: {
const auto& op = static_cast<const SaveLayerOp&>(base_op);
- str << "SaveLayerOp(bounds=" << ToString(op.bounds)
- << ", flags=" << ToString(op.flags) << ")";
+ str << "bounds=" << ToString(op.bounds)
+ << ", flags=" << ToString(op.flags);
break;
}
- case PaintOpType::kSavelayeralpha: {
+ case PaintOpType::kSaveLayerAlpha: {
const auto& op = static_cast<const SaveLayerAlphaOp&>(base_op);
- str << "SaveLayerAlphaOp(bounds=" << ToString(op.bounds)
- << ", alpha=" << ToString(op.alpha) << ")";
+ str << "bounds=" << ToString(op.bounds)
+ << ", alpha=" << ToString(op.alpha);
break;
}
case PaintOpType::kScale: {
const auto& op = static_cast<const ScaleOp&>(base_op);
- str << "ScaleOp(sx=" << ToString(op.sx) << ", sy=" << ToString(op.sy)
- << ")";
+ str << "sx=" << ToString(op.sx) << ", sy=" << ToString(op.sy);
break;
}
- case PaintOpType::kSetmatrix: {
+ case PaintOpType::kSetMatrix: {
const auto& op = static_cast<const SetMatrixOp&>(base_op);
- str << "SetMatrixOp(matrix=" << ToString(op.matrix) << ")";
+ str << "matrix=" << ToString(op.matrix);
break;
}
case PaintOpType::kTranslate: {
const auto& op = static_cast<const TranslateOp&>(base_op);
- str << "TranslateOp(dx=" << ToString(op.dx)
- << ", dy=" << ToString(op.dy) << ")";
+ str << "dx=" << ToString(op.dx) << ", dy=" << ToString(op.dy);
break;
}
- case PaintOpType::kSetnodeid: {
+ case PaintOpType::kSetNodeId: {
const auto& op = static_cast<const SetNodeIdOp&>(base_op);
- str << "SetNodeIdOp(id=" << op.node_id << ")";
+ str << "id=" << op.node_id;
break;
}
}
+ str << ")";
return str.str();
}
diff --git a/components/paint_preview/renderer/paint_preview_recorder_utils.cc b/components/paint_preview/renderer/paint_preview_recorder_utils.cc
index 357c2c42..1e7a7cd0 100644
--- a/components/paint_preview/renderer/paint_preview_recorder_utils.cc
+++ b/components/paint_preview/renderer/paint_preview_recorder_utils.cc
@@ -60,7 +60,7 @@
const cc::PaintOp* ConvertAndTrack(const cc::PaintOp& op) {
converted_op_.emplace<absl::monostate>();
switch (op.GetType()) {
- case cc::PaintOpType::kDrawtextblob: {
+ case cc::PaintOpType::kDrawTextBlob: {
const auto& text_blob_op = static_cast<const cc::DrawTextBlobOp&>(op);
tracker_->AddGlyphs(text_blob_op.blob.get());
break;
@@ -74,7 +74,7 @@
// Delete the op. We no longer need it.
return nullptr;
}
- case cc::PaintOpType::kCustomdata: {
+ case cc::PaintOpType::kCustomData: {
const auto& custom_op = static_cast<const cc::CustomDataOp&>(op);
tracker_->TransformClipForFrame(custom_op.id);
break;
@@ -83,11 +83,11 @@
tracker_->Save();
break;
}
- case cc::PaintOpType::kSavelayer: {
+ case cc::PaintOpType::kSaveLayer: {
tracker_->Save();
break;
}
- case cc::PaintOpType::kSavelayeralpha: {
+ case cc::PaintOpType::kSaveLayerAlpha: {
tracker_->Save();
break;
}
@@ -95,7 +95,7 @@
tracker_->Restore();
break;
}
- case cc::PaintOpType::kSetmatrix: {
+ case cc::PaintOpType::kSetMatrix: {
const auto& matrix_op = static_cast<const cc::SetMatrixOp&>(op);
tracker_->SetMatrix(matrix_op.matrix.asM33());
break;
@@ -120,7 +120,7 @@
tracker_->Translate(translate_op.dx, translate_op.dy);
break;
}
- case cc::PaintOpType::kDrawimage: {
+ case cc::PaintOpType::kDrawImage: {
const auto& image_op = static_cast<const cc::DrawImageOp&>(op);
if (image_op.image.IsTextureBacked()) {
converted_op_.emplace<cc::DrawImageOp>(
@@ -130,7 +130,7 @@
}
break;
}
- case cc::PaintOpType::kDrawimagerect: {
+ case cc::PaintOpType::kDrawImageRect: {
const auto& image_op = static_cast<const cc::DrawImageRectOp&>(op);
if (image_op.image.IsTextureBacked()) {
converted_op_.emplace<cc::DrawImageRectOp>(
diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc
index fb98382..0c89407 100644
--- a/third_party/blink/renderer/core/frame/web_frame_test.cc
+++ b/third_party/blink/renderer/core/frame/web_frame_test.cc
@@ -13593,14 +13593,14 @@
DOMNodeId dom_node_id,
std::vector<TextRunDOMNodeIdInfo>* text_runs) {
for (const cc::PaintOp& op : paint_record) {
- if (op.GetType() == cc::PaintOpType::kDrawrecord) {
+ if (op.GetType() == cc::PaintOpType::kDrawRecord) {
const auto& draw_record_op = static_cast<const cc::DrawRecordOp&>(op);
RecursiveCollectTextRunDOMNodeIds(draw_record_op.record, dom_node_id,
text_runs);
- } else if (op.GetType() == cc::PaintOpType::kSetnodeid) {
+ } else if (op.GetType() == cc::PaintOpType::kSetNodeId) {
const auto& set_node_id_op = static_cast<const cc::SetNodeIdOp&>(op);
dom_node_id = set_node_id_op.node_id;
- } else if (op.GetType() == cc::PaintOpType::kDrawtextblob) {
+ } else if (op.GetType() == cc::PaintOpType::kDrawTextBlob) {
const auto& draw_text_op = static_cast<const cc::DrawTextBlobOp&>(op);
SkTextBlob::Iter iter(*draw_text_op.blob);
SkTextBlob::Iter::Run run;
diff --git a/third_party/blink/renderer/core/paint/box_painter_test.cc b/third_party/blink/renderer/core/paint/box_painter_test.cc
index c90a342..981599b 100644
--- a/third_party/blink/renderer/core/paint/box_painter_test.cc
+++ b/third_party/blink/renderer/core/paint/box_painter_test.cc
@@ -279,11 +279,11 @@
SkCanvas::SrcRectConstraint constraint) {
size_t count = 0;
for (const cc::PaintOp& op : record) {
- if (op.GetType() == cc::PaintOpType::kDrawimagerect) {
+ if (op.GetType() == cc::PaintOpType::kDrawImageRect) {
const auto& image_op = static_cast<const cc::DrawImageRectOp&>(op);
if (image_op.constraint == constraint)
++count;
- } else if (op.GetType() == cc::PaintOpType::kDrawrecord) {
+ } else if (op.GetType() == cc::PaintOpType::kDrawRecord) {
const auto& record_op = static_cast<const cc::DrawRecordOp&>(op);
count += CountDrawImagesWithConstraint(record_op.record, constraint);
}
diff --git a/third_party/blink/renderer/core/paint/image_painter_test.cc b/third_party/blink/renderer/core/paint/image_painter_test.cc
index b0f64e15..4e4050e 100644
--- a/third_party/blink/renderer/core/paint/image_painter_test.cc
+++ b/third_party/blink/renderer/core/paint/image_painter_test.cc
@@ -15,10 +15,10 @@
const cc::DrawImageRectOp* FirstDrawImageRectOp(const cc::PaintRecord& record) {
for (const cc::PaintOp& op : record) {
- if (op.GetType() == cc::PaintOpType::kDrawimagerect) {
+ if (op.GetType() == cc::PaintOpType::kDrawImageRect) {
const auto& image_op = static_cast<const cc::DrawImageRectOp&>(op);
return &image_op;
- } else if (op.GetType() == cc::PaintOpType::kDrawrecord) {
+ } else if (op.GetType() == cc::PaintOpType::kDrawRecord) {
const auto& record_op = static_cast<const cc::DrawRecordOp&>(op);
if (const auto* image_op = FirstDrawImageRectOp(record_op.record)) {
return image_op;
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter_test.cc b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter_test.cc
index 970301b..5610292 100644
--- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter_test.cc
+++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter_test.cc
@@ -27,7 +27,7 @@
links->push_back(GURL(
std::string(reinterpret_cast<const char*>(annotate_op.data->data()),
annotate_op.data->size())));
- } else if (op.GetType() == cc::PaintOpType::kDrawrecord) {
+ } else if (op.GetType() == cc::PaintOpType::kDrawRecord) {
const auto& record_op = static_cast<const cc::DrawRecordOp&>(op);
ExtractLinks(record_op.record, links);
}
diff --git a/third_party/blink/renderer/core/paint/text_painter_base_test.cc b/third_party/blink/renderer/core/paint/text_painter_base_test.cc
index a758d6a..5d5436e 100644
--- a/third_party/blink/renderer/core/paint/text_painter_base_test.cc
+++ b/third_party/blink/renderer/core/paint/text_painter_base_test.cc
@@ -187,7 +187,7 @@
ASSERT_TRUE(item);
auto* op = static_cast<const cc::DrawTextBlobOp*>(
&item->GetPaintRecord().GetFirstOp());
- ASSERT_EQ(cc::PaintOpType::kDrawtextblob, op->GetType());
+ ASSERT_EQ(cc::PaintOpType::kDrawTextBlob, op->GetType());
cc::PaintFlags flags = op->flags;
sk_sp<SkTextBlob> blob = op->blob;
@@ -199,7 +199,7 @@
ASSERT_TRUE(item);
op = static_cast<const cc::DrawTextBlobOp*>(
&item->GetPaintRecord().GetFirstOp());
- ASSERT_EQ(cc::PaintOpType::kDrawtextblob, op->GetType());
+ ASSERT_EQ(cc::PaintOpType::kDrawTextBlob, op->GetType());
EXPECT_FALSE(flags.EqualsForTesting(op->flags));
flags = op->flags;
EXPECT_EQ(blob, op->blob);
@@ -213,7 +213,7 @@
ASSERT_TRUE(item);
op = static_cast<const cc::DrawTextBlobOp*>(
&item->GetPaintRecord().GetFirstOp());
- ASSERT_EQ(cc::PaintOpType::kDrawtextblob, op->GetType());
+ ASSERT_EQ(cc::PaintOpType::kDrawTextBlob, op->GetType());
EXPECT_TRUE(flags.EqualsForTesting(op->flags));
EXPECT_NE(blob, op->blob);
blob = op->blob;
@@ -226,7 +226,7 @@
ASSERT_TRUE(item);
op = static_cast<const cc::DrawTextBlobOp*>(
&item->GetPaintRecord().GetFirstOp());
- ASSERT_EQ(cc::PaintOpType::kDrawtextblob, op->GetType());
+ ASSERT_EQ(cc::PaintOpType::kDrawTextBlob, op->GetType());
EXPECT_TRUE(flags.EqualsForTesting(op->flags));
EXPECT_NE(blob, op->blob);
@@ -238,7 +238,7 @@
ASSERT_TRUE(item);
op = static_cast<const cc::DrawTextBlobOp*>(
&item->GetPaintRecord().GetFirstOp());
- ASSERT_EQ(cc::PaintOpType::kDrawtextblob, op->GetType());
+ ASSERT_EQ(cc::PaintOpType::kDrawTextBlob, op->GetType());
EXPECT_FALSE(flags.EqualsForTesting(op->flags));
}
diff --git a/third_party/blink/renderer/core/paint/video_painter_test.cc b/third_party/blink/renderer/core/paint/video_painter_test.cc
index b23c10ce..86d4dcf9 100644
--- a/third_party/blink/renderer/core/paint/video_painter_test.cc
+++ b/third_party/blink/renderer/core/paint/video_painter_test.cc
@@ -31,7 +31,7 @@
reinterpret_cast<const char*>(annotate_op.data->data()),
annotate_op.data->size())),
annotate_op.rect));
- } else if (op.GetType() == cc::PaintOpType::kDrawrecord) {
+ } else if (op.GetType() == cc::PaintOpType::kDrawRecord) {
const auto& record_op = static_cast<const cc::DrawRecordOp&>(op);
ExtractLinks(record_op.record, links);
}
@@ -41,17 +41,17 @@
size_t CountImagesOfType(const PaintRecord& record, cc::ImageType image_type) {
size_t count = 0;
for (const cc::PaintOp& op : record) {
- if (op.GetType() == cc::PaintOpType::kDrawimage) {
+ if (op.GetType() == cc::PaintOpType::kDrawImage) {
const auto& image_op = static_cast<const cc::DrawImageOp&>(op);
if (image_op.image.GetImageHeaderMetadata()->image_type == image_type) {
++count;
}
- } else if (op.GetType() == cc::PaintOpType::kDrawimagerect) {
+ } else if (op.GetType() == cc::PaintOpType::kDrawImageRect) {
const auto& image_op = static_cast<const cc::DrawImageRectOp&>(op);
if (image_op.image.GetImageHeaderMetadata()->image_type == image_type) {
++count;
}
- } else if (op.GetType() == cc::PaintOpType::kDrawrecord) {
+ } else if (op.GetType() == cc::PaintOpType::kDrawRecord) {
const auto& record_op = static_cast<const cc::DrawRecordOp&>(op);
count += CountImagesOfType(record_op.record, image_type);
}
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc b/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc
index 90d584e..174554c 100644
--- a/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc
+++ b/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc
@@ -506,7 +506,7 @@
}
if (op.GetType() == type) {
++count;
- } else if (op.GetType() == cc::PaintOpType::kDrawrecord) {
+ } else if (op.GetType() == cc::PaintOpType::kDrawRecord) {
const auto& record_op = static_cast<const cc::DrawRecordOp&>(op);
count += CountPaintOpType(record_op.record, type);
}
@@ -545,7 +545,7 @@
// Initially, only the green circle should be recorded.
PaintRecord record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
// Adjust the height so one green circle and three blue circles are visible,
// and ensure four circles are recorded.
@@ -553,7 +553,7 @@
div->setAttribute(html_names::kStyleAttr, AtomicString("height: 200px;"));
Compositor().BeginFrame();
record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
// Adjust the background position so only the three blue circles are visible,
// and ensure three circles are recorded.
@@ -562,7 +562,7 @@
AtomicString("height: 200px; background-position-y: -200px;"));
Compositor().BeginFrame();
record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(3U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(3U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
}
// Tests the culling of invisible sprites from a larger sprite sheet where the
@@ -597,8 +597,8 @@
// Initially, only the green circle should be recorded.
PaintRecord record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawrrect));
- EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawRRect));
+ EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
// Adjust the height so one green circle and three blue circles are visible,
// and ensure four circles are recorded.
@@ -606,8 +606,8 @@
div->setAttribute(html_names::kStyleAttr, AtomicString("height: 200px;"));
Compositor().BeginFrame();
record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawrrect));
- EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawRRect));
+ EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
}
// Similar to `SpriteSheetCulling` but using a full-sized sprite sheet <img>
@@ -649,7 +649,7 @@
// Initially, only the green circle should be recorded.
PaintRecord record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
// Adjust the div's height so one green circle and three blue circles are
// visible, and ensure four circles are recorded.
@@ -658,7 +658,7 @@
AtomicString("height: 200px;"));
Compositor().BeginFrame();
record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
// Adjust the image's position so only the three blue circles are visible,
// and ensure three circles are recorded.
@@ -667,7 +667,7 @@
AtomicString("top: -200px;"));
Compositor().BeginFrame();
record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(3U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(3U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
}
// Similar to `SpriteSheetCulling` but using a full-sized sprite sheet <img>
@@ -708,7 +708,7 @@
// Initially, only the green circle should be recorded.
PaintRecord record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
// Adjust the div's height so one green circle and three blue circles are
// visible, and ensure four circles are recorded.
@@ -717,7 +717,7 @@
AtomicString("height: 200px;"));
Compositor().BeginFrame();
record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
// Adjust the image's position so only the three blue circles are visible,
// and ensure three circles are recorded.
@@ -726,7 +726,7 @@
AtomicString("margin-top: -200px;"));
Compositor().BeginFrame();
record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(3U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(3U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
// Adjust the div's position to be fractional and ensure only three blue
// circles are still recorded.
@@ -734,7 +734,7 @@
AtomicString("margin-left: 0.5px; height: 200px;"));
Compositor().BeginFrame();
record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(3U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(3U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
}
// Similar to `SpriteSheetCulling` but using a regular scrolling interest rect
@@ -778,7 +778,7 @@
// apply because the scrolling interest rect is not for a specific sprite
// within the image, and all circles should be recorded.
PaintRecord record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
// Adjust the div's width and height so that it creates a cull rect that clips
// to just a single circle, and ensure just one circle is recorded.
@@ -787,7 +787,7 @@
AtomicString("width: 100px; height: 200px;"));
Compositor().BeginFrame();
record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
// Adjust the div's width and height so that it no longer creates a cull rect
// that clips to a sprite within the image, so the optimization in
@@ -796,7 +796,7 @@
div_element->removeAttribute(html_names::kStyleAttr);
Compositor().BeginFrame();
record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(4U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
}
// Tests the culling of non-drawing items from a larger sprite sheet.
@@ -844,7 +844,7 @@
// translation paint ops from the <g> elements used to position the red
// circles.
PaintRecord record = GetDocument().View()->GetPaintRecord();
- EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawoval));
+ EXPECT_EQ(1U, CountPaintOpType(record, cc::PaintOpType::kDrawOval));
EXPECT_EQ(0U, CountPaintOpType(record, cc::PaintOpType::kTranslate));
}
diff --git a/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.cc b/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.cc
index a9c7261a..a7977cac 100644
--- a/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.cc
+++ b/third_party/blink/renderer/platform/graphics/paint/drawing_display_item.cc
@@ -135,13 +135,13 @@
}
SkRect item_rect;
switch (op.GetType()) {
- case cc::PaintOpType::kDrawrect:
+ case cc::PaintOpType::kDrawRect:
item_rect = static_cast<const cc::DrawRectOp&>(op).rect;
break;
- case cc::PaintOpType::kDrawirect:
+ case cc::PaintOpType::kDrawIRect:
item_rect = SkRect::Make(static_cast<const cc::DrawIRectOp&>(op).rect);
break;
- case cc::PaintOpType::kDrawrrect:
+ case cc::PaintOpType::kDrawRRect:
item_rect = static_cast<const cc::DrawRRectOp&>(op).rrect.rect();
may_be_solid_color = false;
break;
@@ -189,11 +189,11 @@
break;
// Deal with the common pattern of clipped bleed avoiding images like:
- // kSave, kCliprect, kDraw..., kRestore.
+ // kSave, kClipRect, kDraw..., kRestore.
if (op.GetType() == cc::PaintOpType::kSave) {
continue;
}
- if (op.GetType() == cc::PaintOpType::kCliprect) {
+ if (op.GetType() == cc::PaintOpType::kClipRect) {
clip_rect.Intersect(gfx::ToEnclosedRect(
gfx::SkRectToRectF(static_cast<const cc::ClipRectOp&>(op).rect)));
continue;
@@ -203,7 +203,7 @@
break;
gfx::Rect op_opaque_rect;
- if (op.GetType() == cc::PaintOpType::kDrawrecord) {
+ if (op.GetType() == cc::PaintOpType::kDrawRecord) {
op_opaque_rect = CalculateRectKnownToBeOpaqueForRecord(
static_cast<const cc::DrawRecordOp&>(op).record);
} else {
@@ -218,11 +218,11 @@
}
switch (op.GetType()) {
- case cc::PaintOpType::kDrawrect:
+ case cc::PaintOpType::kDrawRect:
op_opaque_rect = gfx::ToEnclosedRect(
gfx::SkRectToRectF(static_cast<const cc::DrawRectOp&>(op).rect));
break;
- case cc::PaintOpType::kDrawrrect: {
+ case cc::PaintOpType::kDrawRRect: {
const SkRRect& rrect = static_cast<const cc::DrawRRectOp&>(op).rrect;
SkVector top_left = rrect.radii(SkRRect::kUpperLeft_Corner);
SkVector top_right = rrect.radii(SkRRect::kUpperRight_Corner);
@@ -243,11 +243,11 @@
op_opaque_rect = ToEnclosedRect(contained);
break;
}
- case cc::PaintOpType::kDrawirect:
+ case cc::PaintOpType::kDrawIRect:
op_opaque_rect =
gfx::SkIRectToRect(static_cast<const cc::DrawIRectOp&>(op).rect);
break;
- case cc::PaintOpType::kDrawimage: {
+ case cc::PaintOpType::kDrawImage: {
const auto& draw_image_op = static_cast<const cc::DrawImageOp&>(op);
const auto& image = draw_image_op.image;
if (!image.IsOpaque())
@@ -256,7 +256,7 @@
image.width(), image.height());
break;
}
- case cc::PaintOpType::kDrawimagerect: {
+ case cc::PaintOpType::kDrawImageRect: {
const auto& draw_image_rect_op =
static_cast<const cc::DrawImageRectOp&>(op);
const auto& image = draw_image_rect_op.image;
@@ -296,19 +296,19 @@
gfx::Rect item_rect;
switch (op.GetType()) {
- case cc::PaintOpType::kDrawrect:
+ case cc::PaintOpType::kDrawRect:
item_rect = gfx::ToEnclosingRect(
gfx::SkRectToRectF(static_cast<const cc::DrawRectOp&>(op).rect));
break;
- case cc::PaintOpType::kDrawirect:
+ case cc::PaintOpType::kDrawIRect:
item_rect =
gfx::SkIRectToRect(static_cast<const cc::DrawIRectOp&>(op).rect);
break;
- case cc::PaintOpType::kDrawrrect:
+ case cc::PaintOpType::kDrawRRect:
item_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(
static_cast<const cc::DrawRRectOp&>(op).rrect.rect()));
break;
- // TODO(pdr): Support image PaintOpTypes such as kDrawimage{rect}.
+ // TODO(pdr): Support image PaintOpTypes such as kDrawImage{rect}.
// TODO(pdr): Consider checking PaintOpType::kDrawtextblob too.
default:
return visual_rect;
diff --git a/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc b/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc
index af6bb5e8..0046c48 100644
--- a/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc
+++ b/third_party/blink/renderer/platform/graphics/paint/paint_controller.cc
@@ -214,7 +214,7 @@
return nullptr;
}
const cc::PaintOp& op = record.GetFirstOp();
- if (op.GetType() != cc::PaintOpType::kDrawtextblob) {
+ if (op.GetType() != cc::PaintOpType::kDrawTextBlob) {
return nullptr;
}
return static_cast<const cc::DrawTextBlobOp&>(op).blob;
diff --git a/ui/views/controls/animated_image_view_unittest.cc b/ui/views/controls/animated_image_view_unittest.cc
index 20eb0b43..41a0b24 100644
--- a/ui/views/controls/animated_image_view_unittest.cc
+++ b/ui/views/controls/animated_image_view_unittest.cc
@@ -34,7 +34,7 @@
if (op.GetType() == paint_op_type)
return static_cast<const T*>(&op);
- if (op.GetType() == cc::PaintOpType::kDrawrecord) {
+ if (op.GetType() == cc::PaintOpType::kDrawRecord) {
const T* record_op_result = FindPaintOp<T>(
static_cast<const cc::DrawRecordOp&>(op).record, paint_op_type);
if (record_op_result)