OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 struct PaintInvalidationInfo { | 74 struct PaintInvalidationInfo { |
75 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 75 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
76 // This is for comparison only. Don't dereference because the client may hav
e died. | 76 // This is for comparison only. Don't dereference because the client may hav
e died. |
77 const DisplayItemClient* client; | 77 const DisplayItemClient* client; |
78 String clientDebugName; | 78 String clientDebugName; |
79 IntRect rect; | 79 IntRect rect; |
80 PaintInvalidationReason reason; | 80 PaintInvalidationReason reason; |
81 }; | 81 }; |
82 | 82 |
83 #if DCHECK_IS_ON() | |
84 struct UnderPaintInvalidation { | 83 struct UnderPaintInvalidation { |
85 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 84 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
86 int x; | 85 int x; |
87 int y; | 86 int y; |
88 SkColor oldPixel; | 87 SkColor oldPixel; |
89 SkColor newPixel; | 88 SkColor newPixel; |
90 }; | 89 }; |
91 #endif | |
92 | 90 |
93 struct PaintInvalidationTracking { | 91 struct PaintInvalidationTracking { |
94 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 92 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
95 Vector<PaintInvalidationInfo> trackedPaintInvalidations; | 93 Vector<PaintInvalidationInfo> trackedPaintInvalidations; |
96 #if DCHECK_IS_ON() | |
97 RefPtr<SkPicture> lastPaintedPicture; | 94 RefPtr<SkPicture> lastPaintedPicture; |
98 Region paintInvalidationRegionSinceLastPaint; | 95 Region paintInvalidationRegionSinceLastPaint; |
99 Vector<UnderPaintInvalidation> underPaintInvalidations; | 96 Vector<UnderPaintInvalidation> underPaintInvalidations; |
100 #endif | |
101 }; | 97 }; |
102 | 98 |
103 typedef HashMap<const GraphicsLayer*, PaintInvalidationTracking> PaintInvalidati
onTrackingMap; | 99 typedef HashMap<const GraphicsLayer*, PaintInvalidationTracking> PaintInvalidati
onTrackingMap; |
104 static PaintInvalidationTrackingMap& paintInvalidationTrackingMap() | 100 static PaintInvalidationTrackingMap& paintInvalidationTrackingMap() |
105 { | 101 { |
106 DEFINE_STATIC_LOCAL(PaintInvalidationTrackingMap, map, ()); | 102 DEFINE_STATIC_LOCAL(PaintInvalidationTrackingMap, map, ()); |
107 return map; | 103 return map; |
108 } | 104 } |
109 | 105 |
110 std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client
) | 106 std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client
) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 325 |
330 IntRect GraphicsLayer::interestRect() | 326 IntRect GraphicsLayer::interestRect() |
331 { | 327 { |
332 return m_previousInterestRect; | 328 return m_previousInterestRect; |
333 } | 329 } |
334 | 330 |
335 void GraphicsLayer::paint(const IntRect* interestRect, GraphicsContext::Disabled
Mode disabledMode) | 331 void GraphicsLayer::paint(const IntRect* interestRect, GraphicsContext::Disabled
Mode disabledMode) |
336 { | 332 { |
337 if (paintWithoutCommit(interestRect, disabledMode)) { | 333 if (paintWithoutCommit(interestRect, disabledMode)) { |
338 getPaintController().commitNewDisplayItems(offsetFromLayoutObjectWithSub
pixelAccumulation()); | 334 getPaintController().commitNewDisplayItems(offsetFromLayoutObjectWithSub
pixelAccumulation()); |
339 #if DCHECK_IS_ON() | 335 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
340 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnable
d()) { | |
341 RefPtr<SkPicture> newPicture = capturePicture(); | 336 RefPtr<SkPicture> newPicture = capturePicture(); |
342 checkPaintUnderInvalidations(*newPicture); | 337 checkPaintUnderInvalidations(*newPicture); |
343 PaintInvalidationTracking& tracking = paintInvalidationTrackingMap()
.add(this, PaintInvalidationTracking()).storedValue->value; | 338 PaintInvalidationTracking& tracking = paintInvalidationTrackingMap()
.add(this, PaintInvalidationTracking()).storedValue->value; |
344 tracking.lastPaintedPicture = newPicture; | 339 tracking.lastPaintedPicture = newPicture; |
345 tracking.paintInvalidationRegionSinceLastPaint = Region(); | 340 tracking.paintInvalidationRegionSinceLastPaint = Region(); |
346 } | 341 } |
347 #endif | |
348 } | 342 } |
349 } | 343 } |
350 | 344 |
351 bool GraphicsLayer::paintWithoutCommit(const IntRect* interestRect, GraphicsCont
ext::DisabledMode disabledMode) | 345 bool GraphicsLayer::paintWithoutCommit(const IntRect* interestRect, GraphicsCont
ext::DisabledMode disabledMode) |
352 { | 346 { |
353 ASSERT(drawsContent()); | 347 ASSERT(drawsContent()); |
354 | 348 |
355 if (!m_client) | 349 if (!m_client) |
356 return false; | 350 return false; |
357 if (firstPaintInvalidationTrackingEnabled()) | 351 if (firstPaintInvalidationTrackingEnabled()) |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 resetTrackedPaintInvalidations(); | 541 resetTrackedPaintInvalidations(); |
548 m_isTrackingPaintInvalidations = tracksPaintInvalidations; | 542 m_isTrackingPaintInvalidations = tracksPaintInvalidations; |
549 } | 543 } |
550 | 544 |
551 void GraphicsLayer::resetTrackedPaintInvalidations() | 545 void GraphicsLayer::resetTrackedPaintInvalidations() |
552 { | 546 { |
553 auto it = paintInvalidationTrackingMap().find(this); | 547 auto it = paintInvalidationTrackingMap().find(this); |
554 if (it == paintInvalidationTrackingMap().end()) | 548 if (it == paintInvalidationTrackingMap().end()) |
555 return; | 549 return; |
556 | 550 |
557 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) | 551 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) |
558 it->value.trackedPaintInvalidations.clear(); | 552 it->value.trackedPaintInvalidations.clear(); |
559 else | 553 else |
560 paintInvalidationTrackingMap().remove(it); | 554 paintInvalidationTrackingMap().remove(it); |
561 } | 555 } |
562 | 556 |
563 bool GraphicsLayer::hasTrackedPaintInvalidations() const | 557 bool GraphicsLayer::hasTrackedPaintInvalidations() const |
564 { | 558 { |
565 PaintInvalidationTrackingMap::iterator it = paintInvalidationTrackingMap().f
ind(this); | 559 PaintInvalidationTrackingMap::iterator it = paintInvalidationTrackingMap().f
ind(this); |
566 if (it != paintInvalidationTrackingMap().end()) | 560 if (it != paintInvalidationTrackingMap().end()) |
567 return !it->value.trackedPaintInvalidations.isEmpty(); | 561 return !it->value.trackedPaintInvalidations.isEmpty(); |
568 return false; | 562 return false; |
569 } | 563 } |
570 | 564 |
571 void GraphicsLayer::trackPaintInvalidation(const DisplayItemClient& client, cons
t IntRect& rect, PaintInvalidationReason reason) | 565 void GraphicsLayer::trackPaintInvalidation(const DisplayItemClient& client, cons
t IntRect& rect, PaintInvalidationReason reason) |
572 { | 566 { |
573 if (!isTrackingOrCheckingPaintInvalidations() || rect.isEmpty()) | 567 if (!isTrackingOrCheckingPaintInvalidations() || rect.isEmpty()) |
574 return; | 568 return; |
575 | 569 |
576 PaintInvalidationTracking& tracking = paintInvalidationTrackingMap().add(thi
s, PaintInvalidationTracking()).storedValue->value; | 570 PaintInvalidationTracking& tracking = paintInvalidationTrackingMap().add(thi
s, PaintInvalidationTracking()).storedValue->value; |
577 | 571 |
578 if (m_isTrackingPaintInvalidations) { | 572 if (m_isTrackingPaintInvalidations) { |
579 PaintInvalidationInfo info = { &client, client.debugName(), rect, reason
}; | 573 PaintInvalidationInfo info = { &client, client.debugName(), rect, reason
}; |
580 tracking.trackedPaintInvalidations.append(info); | 574 tracking.trackedPaintInvalidations.append(info); |
581 } | 575 } |
582 | 576 |
583 #if DCHECK_IS_ON() | 577 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
584 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled())
{ | |
585 // TODO(crbug.com/496260): Some antialiasing effects overflows the paint
invalidation rect. | 578 // TODO(crbug.com/496260): Some antialiasing effects overflows the paint
invalidation rect. |
586 IntRect r = rect; | 579 IntRect r = rect; |
587 r.inflate(1); | 580 r.inflate(1); |
588 tracking.paintInvalidationRegionSinceLastPaint.unite(r); | 581 tracking.paintInvalidationRegionSinceLastPaint.unite(r); |
589 } | 582 } |
590 #endif | |
591 } | 583 } |
592 | 584 |
593 static bool comparePaintInvalidationInfo(const PaintInvalidationInfo& a, const P
aintInvalidationInfo& b) | 585 static bool comparePaintInvalidationInfo(const PaintInvalidationInfo& a, const P
aintInvalidationInfo& b) |
594 { | 586 { |
595 // Sort by rect first, bigger rects before smaller ones. | 587 // Sort by rect first, bigger rects before smaller ones. |
596 if (a.rect.width() != b.rect.width()) | 588 if (a.rect.width() != b.rect.width()) |
597 return a.rect.width() > b.rect.width(); | 589 return a.rect.width() > b.rect.width(); |
598 if (a.rect.height() != b.rect.height()) | 590 if (a.rect.height() != b.rect.height()) |
599 return a.rect.height() > b.rect.height(); | 591 return a.rect.height() > b.rect.height(); |
600 if (a.rect.x() != b.rect.x()) | 592 if (a.rect.x() != b.rect.x()) |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 for (auto& info : infos) { | 765 for (auto& info : infos) { |
774 std::unique_ptr<JSONObject> infoJSON = JSONObject::create(); | 766 std::unique_ptr<JSONObject> infoJSON = JSONObject::create(); |
775 infoJSON->setString("object", info.clientDebugName); | 767 infoJSON->setString("object", info.clientDebugName); |
776 if (!info.rect.isEmpty()) | 768 if (!info.rect.isEmpty()) |
777 infoJSON->setArray("rect", rectAsJSONArray(info.rect)); | 769 infoJSON->setArray("rect", rectAsJSONArray(info.rect)); |
778 infoJSON->setString("reason", paintInvalidationReasonToStrin
g(info.reason)); | 770 infoJSON->setString("reason", paintInvalidationReasonToStrin
g(info.reason)); |
779 paintInvalidationsJSON->pushObject(std::move(infoJSON)); | 771 paintInvalidationsJSON->pushObject(std::move(infoJSON)); |
780 } | 772 } |
781 json->setArray("paintInvalidations", std::move(paintInvalidation
sJSON)); | 773 json->setArray("paintInvalidations", std::move(paintInvalidation
sJSON)); |
782 } | 774 } |
783 #if DCHECK_IS_ON() | 775 |
784 Vector<UnderPaintInvalidation>& underPaintInvalidations = it->value.
underPaintInvalidations; | 776 Vector<UnderPaintInvalidation>& underPaintInvalidations = it->value.
underPaintInvalidations; |
785 if (!underPaintInvalidations.isEmpty()) { | 777 if (!underPaintInvalidations.isEmpty()) { |
786 std::unique_ptr<JSONArray> underPaintInvalidationsJSON = JSONArr
ay::create(); | 778 std::unique_ptr<JSONArray> underPaintInvalidationsJSON = JSONArr
ay::create(); |
787 for (auto& underPaintInvalidation : underPaintInvalidations) { | 779 for (auto& underPaintInvalidation : underPaintInvalidations) { |
788 std::unique_ptr<JSONObject> underPaintInvalidationJSON = JSO
NObject::create(); | 780 std::unique_ptr<JSONObject> underPaintInvalidationJSON = JSO
NObject::create(); |
789 underPaintInvalidationJSON->setDouble("x", underPaintInvalid
ation.x); | 781 underPaintInvalidationJSON->setDouble("x", underPaintInvalid
ation.x); |
790 underPaintInvalidationJSON->setDouble("y", underPaintInvalid
ation.x); | 782 underPaintInvalidationJSON->setDouble("y", underPaintInvalid
ation.x); |
791 underPaintInvalidationJSON->setString("oldPixel", Color(unde
rPaintInvalidation.oldPixel).nameForLayoutTreeAsText()); | 783 underPaintInvalidationJSON->setString("oldPixel", Color(unde
rPaintInvalidation.oldPixel).nameForLayoutTreeAsText()); |
792 underPaintInvalidationJSON->setString("newPixel", Color(unde
rPaintInvalidation.newPixel).nameForLayoutTreeAsText()); | 784 underPaintInvalidationJSON->setString("newPixel", Color(unde
rPaintInvalidation.newPixel).nameForLayoutTreeAsText()); |
793 underPaintInvalidationsJSON->pushObject(std::move(underPaint
InvalidationJSON)); | 785 underPaintInvalidationsJSON->pushObject(std::move(underPaint
InvalidationJSON)); |
794 } | 786 } |
795 json->setArray("underPaintInvalidations", std::move(underPaintIn
validationsJSON)); | 787 json->setArray("underPaintInvalidations", std::move(underPaintIn
validationsJSON)); |
796 } | 788 } |
797 #endif | |
798 } | 789 } |
799 } | 790 } |
800 | 791 |
801 if ((flags & LayerTreeIncludesPaintingPhases) && m_paintingPhase) { | 792 if ((flags & LayerTreeIncludesPaintingPhases) && m_paintingPhase) { |
802 std::unique_ptr<JSONArray> paintingPhasesJSON = JSONArray::create(); | 793 std::unique_ptr<JSONArray> paintingPhasesJSON = JSONArray::create(); |
803 if (m_paintingPhase & GraphicsLayerPaintBackground) | 794 if (m_paintingPhase & GraphicsLayerPaintBackground) |
804 paintingPhasesJSON->pushString("GraphicsLayerPaintBackground"); | 795 paintingPhasesJSON->pushString("GraphicsLayerPaintBackground"); |
805 if (m_paintingPhase & GraphicsLayerPaintForeground) | 796 if (m_paintingPhase & GraphicsLayerPaintForeground) |
806 paintingPhasesJSON->pushString("GraphicsLayerPaintForeground"); | 797 paintingPhasesJSON->pushString("GraphicsLayerPaintForeground"); |
807 if (m_paintingPhase & GraphicsLayerPaintMask) | 798 if (m_paintingPhase & GraphicsLayerPaintMask) |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 if (WebLayer* layer = platformLayer()) | 1237 if (WebLayer* layer = platformLayer()) |
1247 layer->setElementId(id); | 1238 layer->setElementId(id); |
1248 } | 1239 } |
1249 | 1240 |
1250 void GraphicsLayer::setCompositorMutableProperties(uint32_t properties) | 1241 void GraphicsLayer::setCompositorMutableProperties(uint32_t properties) |
1251 { | 1242 { |
1252 if (WebLayer* layer = platformLayer()) | 1243 if (WebLayer* layer = platformLayer()) |
1253 layer->setCompositorMutableProperties(properties); | 1244 layer->setCompositorMutableProperties(properties); |
1254 } | 1245 } |
1255 | 1246 |
1256 #if DCHECK_IS_ON() | |
1257 | |
1258 PassRefPtr<SkPicture> GraphicsLayer::capturePicture() | 1247 PassRefPtr<SkPicture> GraphicsLayer::capturePicture() |
1259 { | 1248 { |
1260 if (!drawsContent()) | 1249 if (!drawsContent()) |
1261 return nullptr; | 1250 return nullptr; |
1262 | 1251 |
1263 IntSize intSize = expandedIntSize(size()); | 1252 IntSize intSize = expandedIntSize(size()); |
1264 GraphicsContext graphicsContext(getPaintController()); | 1253 GraphicsContext graphicsContext(getPaintController()); |
1265 graphicsContext.beginRecording(IntRect(IntPoint(0, 0), intSize)); | 1254 graphicsContext.beginRecording(IntRect(IntPoint(0, 0), intSize)); |
1266 getPaintController().paintArtifact().replay(graphicsContext); | 1255 getPaintController().paintArtifact().replay(graphicsContext); |
1267 return graphicsContext.endRecording(); | 1256 return graphicsContext.endRecording(); |
(...skipping 25 matching lines...) Expand all Loading... |
1293 if (it == paintInvalidationTrackingMap().end()) | 1282 if (it == paintInvalidationTrackingMap().end()) |
1294 return; | 1283 return; |
1295 PaintInvalidationTracking& tracking = it->value; | 1284 PaintInvalidationTracking& tracking = it->value; |
1296 if (!tracking.lastPaintedPicture) | 1285 if (!tracking.lastPaintedPicture) |
1297 return; | 1286 return; |
1298 | 1287 |
1299 SkBitmap oldBitmap; | 1288 SkBitmap oldBitmap; |
1300 int width = static_cast<int>(ceilf(std::min(tracking.lastPaintedPicture->cul
lRect().width(), newPicture.cullRect().width()))); | 1289 int width = static_cast<int>(ceilf(std::min(tracking.lastPaintedPicture->cul
lRect().width(), newPicture.cullRect().width()))); |
1301 int height = static_cast<int>(ceilf(std::min(tracking.lastPaintedPicture->cu
llRect().height(), newPicture.cullRect().height()))); | 1290 int height = static_cast<int>(ceilf(std::min(tracking.lastPaintedPicture->cu
llRect().height(), newPicture.cullRect().height()))); |
1302 oldBitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height)); | 1291 oldBitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height)); |
1303 SkCanvas(oldBitmap).drawPicture(tracking.lastPaintedPicture.get()); | 1292 { |
| 1293 SkCanvas canvas(oldBitmap); |
| 1294 canvas.clear(SK_ColorTRANSPARENT); |
| 1295 canvas.drawPicture(tracking.lastPaintedPicture.get()); |
| 1296 } |
1304 | 1297 |
1305 SkBitmap newBitmap; | 1298 SkBitmap newBitmap; |
1306 newBitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height)); | 1299 newBitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height)); |
1307 SkCanvas(newBitmap).drawPicture(&newPicture); | 1300 { |
| 1301 SkCanvas canvas(newBitmap); |
| 1302 canvas.clear(SK_ColorTRANSPARENT); |
| 1303 canvas.drawPicture(&newPicture); |
| 1304 } |
1308 | 1305 |
1309 oldBitmap.lockPixels(); | 1306 oldBitmap.lockPixels(); |
1310 newBitmap.lockPixels(); | 1307 newBitmap.lockPixels(); |
1311 int mismatchingPixels = 0; | 1308 int mismatchingPixels = 0; |
1312 static const int maxMismatchesToReport = 50; | 1309 static const int maxMismatchesToReport = 50; |
1313 for (int y = 0; y < height; ++y) { | 1310 for (int y = 0; y < height; ++y) { |
1314 for (int x = 0; x < width; ++x) { | 1311 for (int x = 0; x < width; ++x) { |
1315 SkColor oldPixel = oldBitmap.getColor(x, y); | 1312 SkColor oldPixel = oldBitmap.getColor(x, y); |
1316 SkColor newPixel = newBitmap.getColor(x, y); | 1313 SkColor newPixel = newBitmap.getColor(x, y); |
1317 if (pixelsDiffer(oldPixel, newPixel) && !tracking.paintInvalidationR
egionSinceLastPaint.contains(IntPoint(x, y))) { | 1314 if (pixelsDiffer(oldPixel, newPixel) && !tracking.paintInvalidationR
egionSinceLastPaint.contains(IntPoint(x, y))) { |
1318 if (mismatchingPixels < maxMismatchesToReport) { | 1315 if (mismatchingPixels < maxMismatchesToReport) { |
1319 UnderPaintInvalidation underPaintInvalidation = { x, y, oldP
ixel, newPixel }; | 1316 UnderPaintInvalidation underPaintInvalidation = { x, y, oldP
ixel, newPixel }; |
1320 tracking.underPaintInvalidations.append(underPaintInvalidati
on); | 1317 tracking.underPaintInvalidations.append(underPaintInvalidati
on); |
1321 LOG(ERROR) << debugName() << " Uninvalidated old/new pixels
mismatch at " << x << "," << y << " old:" << std::hex << oldPixel << " new:" <<
newPixel; | 1318 LOG(ERROR) << debugName() << " Uninvalidated old/new pixels
mismatch at " << x << "," << y << " old:" << std::hex << oldPixel << " new:" <<
newPixel; |
1322 } else if (mismatchingPixels == maxMismatchesToReport) { | 1319 } else if (mismatchingPixels == maxMismatchesToReport) { |
1323 LOG(ERROR) << "and more..."; | 1320 LOG(ERROR) << "and more..."; |
1324 } | 1321 } |
1325 ++mismatchingPixels; | 1322 ++mismatchingPixels; |
1326 *newBitmap.getAddr32(x, y) = SK_ColorRED; | 1323 *newBitmap.getAddr32(x, y) = SkColorSetARGB(0x80, 0xFF, 0, 0xFF)
; // Half translucent magenta. |
1327 } else { | 1324 } else { |
1328 *newBitmap.getAddr32(x, y) = SK_ColorTRANSPARENT; | 1325 *newBitmap.getAddr32(x, y) = SK_ColorTRANSPARENT; |
1329 } | 1326 } |
1330 } | 1327 } |
1331 } | 1328 } |
1332 | 1329 |
1333 oldBitmap.unlockPixels(); | 1330 oldBitmap.unlockPixels(); |
1334 newBitmap.unlockPixels(); | 1331 newBitmap.unlockPixels(); |
1335 | 1332 |
1336 // Visualize under-invalidations by overlaying the new bitmap (containing re
d pixels indicating under-invalidations, | 1333 // Visualize under-invalidations by overlaying the new bitmap (containing re
d pixels indicating under-invalidations, |
1337 // and transparent pixels otherwise) onto the painting. | 1334 // and transparent pixels otherwise) onto the painting. |
1338 SkPictureRecorder recorder; | 1335 SkPictureRecorder recorder; |
1339 recorder.beginRecording(width, height); | 1336 recorder.beginRecording(width, height); |
1340 recorder.getRecordingCanvas()->drawBitmap(newBitmap, 0, 0); | 1337 recorder.getRecordingCanvas()->drawBitmap(newBitmap, 0, 0); |
1341 RefPtr<SkPicture> picture = fromSkSp(recorder.finishRecordingAsPicture()); | 1338 RefPtr<SkPicture> picture = fromSkSp(recorder.finishRecordingAsPicture()); |
1342 getPaintController().appendDebugDrawingAfterCommit(*this, picture, offsetFro
mLayoutObjectWithSubpixelAccumulation()); | 1339 getPaintController().appendDebugDrawingAfterCommit(*this, picture, offsetFro
mLayoutObjectWithSubpixelAccumulation()); |
1343 } | 1340 } |
1344 | 1341 |
1345 #endif // DCHECK_IS_ON() | |
1346 | |
1347 } // namespace blink | 1342 } // namespace blink |
1348 | 1343 |
1349 #ifndef NDEBUG | 1344 #ifndef NDEBUG |
1350 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) | 1345 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) |
1351 { | 1346 { |
1352 if (!layer) { | 1347 if (!layer) { |
1353 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); | 1348 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); |
1354 return; | 1349 return; |
1355 } | 1350 } |
1356 | 1351 |
1357 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1352 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
1358 fprintf(stderr, "%s\n", output.utf8().data()); | 1353 fprintf(stderr, "%s\n", output.utf8().data()); |
1359 } | 1354 } |
1360 #endif | 1355 #endif |
OLD | NEW |