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

Unified Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.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/GraphicsLayer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
index db81304fab7f368b78f89c864302c78a8960453c..8793234d5f0e1d4e202c003de6058ee172952e31 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -53,6 +53,7 @@
#include "public/platform/WebLayer.h"
#include "public/platform/WebPoint.h"
#include "public/platform/WebSize.h"
+#include "skia/ext/cdl_canvas.h"
#include "wtf/CurrentTime.h"
#include "wtf/HashMap.h"
#include "wtf/HashSet.h"
@@ -292,7 +293,7 @@ void GraphicsLayer::paint(const IntRect* interestRect,
getPaintController().commitNewDisplayItems(
offsetFromLayoutObjectWithSubpixelAccumulation());
if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) {
- sk_sp<SkPicture> newPicture = capturePicture();
+ sk_sp<CdlPicture> newPicture = capturePicture();
checkPaintUnderInvalidations(*newPicture);
RasterInvalidationTracking& tracking =
rasterInvalidationTrackingMap().add(this);
@@ -1205,7 +1206,7 @@ void GraphicsLayer::setCompositorMutableProperties(uint32_t properties) {
layer->setCompositorMutableProperties(properties);
}
-sk_sp<SkPicture> GraphicsLayer::capturePicture() {
+sk_sp<CdlPicture> GraphicsLayer::capturePicture() {
if (!drawsContent())
return nullptr;
@@ -1231,7 +1232,7 @@ static bool pixelsDiffer(SkColor p1, SkColor p2) {
pixelComponentsDiffer(SkColorGetB(p1), SkColorGetB(p2));
}
-void GraphicsLayer::checkPaintUnderInvalidations(const SkPicture& newPicture) {
+void GraphicsLayer::checkPaintUnderInvalidations(const CdlPicture& newPicture) {
if (!drawsContent())
return;
@@ -1251,7 +1252,8 @@ void GraphicsLayer::checkPaintUnderInvalidations(const SkPicture& newPicture) {
oldBitmap.allocPixels(
SkImageInfo::MakeN32Premul(rect.width(), rect.height()));
{
- SkCanvas canvas(oldBitmap);
+ SkCanvas sk_canvas(oldBitmap);
+ CdlPassThroughCanvas canvas(&sk_canvas);
canvas.clear(SK_ColorTRANSPARENT);
canvas.translate(-rect.x(), -rect.y());
canvas.drawPicture(tracking->lastPaintedPicture.get());
@@ -1261,7 +1263,8 @@ void GraphicsLayer::checkPaintUnderInvalidations(const SkPicture& newPicture) {
newBitmap.allocPixels(
SkImageInfo::MakeN32Premul(rect.width(), rect.height()));
{
- SkCanvas canvas(newBitmap);
+ SkCanvas sk_canvas(newBitmap);
+ CdlPassThroughCanvas canvas(&sk_canvas);
canvas.clear(SK_ColorTRANSPARENT);
canvas.translate(-rect.x(), -rect.y());
canvas.drawPicture(&newPicture);
@@ -1305,10 +1308,10 @@ void GraphicsLayer::checkPaintUnderInvalidations(const SkPicture& newPicture) {
// Visualize under-invalidations by overlaying the new bitmap (containing red
// pixels indicating under-invalidations, and transparent pixels otherwise)
// onto the painting.
- SkPictureRecorder recorder;
+ CdlPictureRecorder recorder;
recorder.beginRecording(rect);
recorder.getRecordingCanvas()->drawBitmap(newBitmap, rect.x(), rect.y());
- sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
+ sk_sp<CdlPicture> picture = recorder.finishRecordingAsPicture();
getPaintController().appendDebugDrawingAfterCommit(
*this, picture, offsetFromLayoutObjectWithSubpixelAccumulation());
}

Powered by Google App Engine
This is Rietveld 408576698