Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1282)

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp

Issue 2743363006: Clean up cc/paint interfaces (Closed)
Patch Set: Fix PaintControllerTest v2 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp
index c319de5e2da6716fb75b8ca5a9bf571e36b09629..ea592959ec6e6dab80ceeb29bdce79ee0de97b0e 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp
@@ -16,7 +16,7 @@ namespace blink {
void DrawingDisplayItem::replay(GraphicsContext& context) const {
if (m_record)
- context.drawRecord(m_record.get());
+ context.drawRecord(m_record);
}
void DrawingDisplayItem::appendToWebDisplayItemList(
@@ -64,19 +64,19 @@ static bool recordsEqual(const PaintRecord* record1,
return data1->equals(data2.get());
}
-static SkBitmap recordToBitmap(const PaintRecord* record) {
+static SkBitmap recordToBitmap(sk_sp<const PaintRecord> record) {
SkBitmap bitmap;
SkRect rect = record->cullRect();
bitmap.allocPixels(SkImageInfo::MakeN32Premul(rect.width(), rect.height()));
SkiaPaintCanvas canvas(bitmap);
canvas.clear(SK_ColorTRANSPARENT);
canvas.translate(-rect.x(), -rect.y());
- canvas.drawPicture(record);
+ canvas.drawPicture(std::move(record));
return bitmap;
}
-static bool bitmapsEqual(const PaintRecord* record1,
- const PaintRecord* record2) {
+static bool bitmapsEqual(sk_sp<const PaintRecord> record1,
+ sk_sp<const PaintRecord> record2) {
SkRect rect = record1->cullRect();
if (rect != record2->cullRect())
return false;
@@ -107,8 +107,8 @@ bool DrawingDisplayItem::equals(const DisplayItem& other) const {
if (!DisplayItem::equals(other))
return false;
- const PaintRecord* record = this->GetPaintRecord();
- const PaintRecord* otherRecord =
+ const sk_sp<const PaintRecord>& record = this->GetPaintRecord();
+ const sk_sp<const PaintRecord>& otherRecord =
static_cast<const DrawingDisplayItem&>(other).GetPaintRecord();
if (!record && !otherRecord)
@@ -116,12 +116,12 @@ bool DrawingDisplayItem::equals(const DisplayItem& other) const {
if (!record || !otherRecord)
return false;
- if (recordsEqual(record, otherRecord))
+ if (recordsEqual(record.get(), otherRecord.get()))
return true;
// Sometimes the client may produce different records for the same visual
// result, which should be treated as equal.
- return bitmapsEqual(record, otherRecord);
+ return bitmapsEqual(std::move(record), std::move(otherRecord));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698