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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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 05f254c6f2397c7cd71053b4a4fc33aec3eb0757..e692878fefbf940c54173c8e14dfb900ca9d7816 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp
@@ -6,6 +6,7 @@
#include "platform/graphics/GraphicsContext.h"
#include "public/platform/WebDisplayItemList.h"
+#include "skia/ext/cdl_canvas.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkData.h"
@@ -31,7 +32,8 @@ bool DrawingDisplayItem::drawsContent() const {
void DrawingDisplayItem::analyzeForGpuRasterization(
SkPictureGpuAnalyzer& analyzer) const {
- analyzer.analyzePicture(m_picture.get());
+ // TODO(cdl): Need drawable analyzer.
+ // analyzer.analyzePicture(m_picture.get());
}
#ifndef NDEBUG
@@ -47,28 +49,30 @@ void DrawingDisplayItem::dumpPropertiesAsDebugString(
}
#endif
-static bool picturesEqual(const SkPicture* picture1,
- const SkPicture* picture2) {
+static bool picturesEqual(const CdlPicture* picture1,
+ const CdlPicture* picture2) {
if (picture1->approximateOpCount() != picture2->approximateOpCount())
return false;
- sk_sp<SkData> data1 = picture1->serialize();
- sk_sp<SkData> data2 = picture2->serialize();
+ sk_sp<SkData> data1 = ToSkPicture(picture1)->serialize();
+ sk_sp<SkData> data2 = ToSkPicture(picture2)->serialize();
return data1->equals(data2.get());
}
-static SkBitmap pictureToBitmap(const SkPicture* picture) {
+static SkBitmap pictureToBitmap(const CdlPicture* picture) {
SkBitmap bitmap;
SkRect rect = picture->cullRect();
bitmap.allocPixels(SkImageInfo::MakeN32Premul(rect.width(), rect.height()));
- SkCanvas canvas(bitmap);
+ SkCanvas sk_canvas(bitmap);
+ CdlPassThroughCanvas canvas(&sk_canvas);
canvas.clear(SK_ColorTRANSPARENT);
canvas.translate(-rect.x(), -rect.y());
canvas.drawPicture(picture);
return bitmap;
}
-static bool bitmapsEqual(const SkPicture* picture1, const SkPicture* picture2) {
+static bool bitmapsEqual(const CdlPicture* picture1,
+ const CdlPicture* picture2) {
SkRect rect = picture1->cullRect();
if (rect != picture2->cullRect())
return false;
@@ -99,8 +103,8 @@ bool DrawingDisplayItem::equals(const DisplayItem& other) const {
if (!DisplayItem::equals(other))
return false;
- const SkPicture* picture = this->picture();
- const SkPicture* otherPicture =
+ const CdlPicture* picture = this->picture();
+ const CdlPicture* otherPicture =
static_cast<const DrawingDisplayItem&>(other).picture();
if (!picture && !otherPicture)

Powered by Google App Engine
This is Rietveld 408576698