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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 return abs(c1 - c2) > 2; | 1200 return abs(c1 - c2) > 2; |
1201 } | 1201 } |
1202 | 1202 |
1203 static bool PixelsDiffer(SkColor p1, SkColor p2) { | 1203 static bool PixelsDiffer(SkColor p1, SkColor p2) { |
1204 return PixelComponentsDiffer(SkColorGetA(p1), SkColorGetA(p2)) || | 1204 return PixelComponentsDiffer(SkColorGetA(p1), SkColorGetA(p2)) || |
1205 PixelComponentsDiffer(SkColorGetR(p1), SkColorGetR(p2)) || | 1205 PixelComponentsDiffer(SkColorGetR(p1), SkColorGetR(p2)) || |
1206 PixelComponentsDiffer(SkColorGetG(p1), SkColorGetG(p2)) || | 1206 PixelComponentsDiffer(SkColorGetG(p1), SkColorGetG(p2)) || |
1207 PixelComponentsDiffer(SkColorGetB(p1), SkColorGetB(p2)); | 1207 PixelComponentsDiffer(SkColorGetB(p1), SkColorGetB(p2)); |
1208 } | 1208 } |
1209 | 1209 |
| 1210 // This method is used to graphically verify any under invalidation when |
| 1211 // RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled is being |
| 1212 // used. It compares the last recording made by GraphicsLayer::Paint against |
| 1213 // |new_record|, by rastering both into bitmaps. Any differences are colored |
| 1214 // as dark red. |
1210 void GraphicsLayer::CheckPaintUnderInvalidations( | 1215 void GraphicsLayer::CheckPaintUnderInvalidations( |
1211 sk_sp<PaintRecord> new_record) { | 1216 sk_sp<PaintRecord> new_record) { |
1212 if (!DrawsContent()) | 1217 if (!DrawsContent()) |
1213 return; | 1218 return; |
1214 | 1219 |
1215 RasterInvalidationTracking* tracking = | 1220 RasterInvalidationTracking* tracking = |
1216 GetRasterInvalidationTrackingMap().Find(this); | 1221 GetRasterInvalidationTrackingMap().Find(this); |
1217 if (!tracking) | 1222 if (!tracking) |
1218 return; | 1223 return; |
1219 | 1224 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 } | 1281 } |
1277 | 1282 |
1278 // Visualize under-invalidations by overlaying the new bitmap (containing red | 1283 // Visualize under-invalidations by overlaying the new bitmap (containing red |
1279 // pixels indicating under-invalidations, and transparent pixels otherwise) | 1284 // pixels indicating under-invalidations, and transparent pixels otherwise) |
1280 // onto the painting. | 1285 // onto the painting. |
1281 PaintRecorder recorder; | 1286 PaintRecorder recorder; |
1282 recorder.beginRecording(rect); | 1287 recorder.beginRecording(rect); |
1283 recorder.getRecordingCanvas()->drawBitmap(new_bitmap, rect.X(), rect.Y()); | 1288 recorder.getRecordingCanvas()->drawBitmap(new_bitmap, rect.X(), rect.Y()); |
1284 sk_sp<PaintRecord> record = recorder.finishRecordingAsPicture(); | 1289 sk_sp<PaintRecord> record = recorder.finishRecordingAsPicture(); |
1285 GetPaintController().AppendDebugDrawingAfterCommit( | 1290 GetPaintController().AppendDebugDrawingAfterCommit( |
1286 *this, record, OffsetFromLayoutObjectWithSubpixelAccumulation()); | 1291 *this, record, rect, OffsetFromLayoutObjectWithSubpixelAccumulation()); |
1287 } | 1292 } |
1288 | 1293 |
1289 } // namespace blink | 1294 } // namespace blink |
1290 | 1295 |
1291 #ifndef NDEBUG | 1296 #ifndef NDEBUG |
1292 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { | 1297 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { |
1293 if (!layer) { | 1298 if (!layer) { |
1294 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; | 1299 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; |
1295 return; | 1300 return; |
1296 } | 1301 } |
1297 | 1302 |
1298 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo); | 1303 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo); |
1299 LOG(INFO) << output.Utf8().data(); | 1304 LOG(INFO) << output.Utf8().data(); |
1300 } | 1305 } |
1301 #endif | 1306 #endif |
OLD | NEW |