| 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. | |
| 1215 void GraphicsLayer::CheckPaintUnderInvalidations( | 1210 void GraphicsLayer::CheckPaintUnderInvalidations( |
| 1216 sk_sp<PaintRecord> new_record) { | 1211 sk_sp<PaintRecord> new_record) { |
| 1217 if (!DrawsContent()) | 1212 if (!DrawsContent()) |
| 1218 return; | 1213 return; |
| 1219 | 1214 |
| 1220 RasterInvalidationTracking* tracking = | 1215 RasterInvalidationTracking* tracking = |
| 1221 GetRasterInvalidationTrackingMap().Find(this); | 1216 GetRasterInvalidationTrackingMap().Find(this); |
| 1222 if (!tracking) | 1217 if (!tracking) |
| 1223 return; | 1218 return; |
| 1224 | 1219 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 } | 1276 } |
| 1282 | 1277 |
| 1283 // Visualize under-invalidations by overlaying the new bitmap (containing red | 1278 // Visualize under-invalidations by overlaying the new bitmap (containing red |
| 1284 // pixels indicating under-invalidations, and transparent pixels otherwise) | 1279 // pixels indicating under-invalidations, and transparent pixels otherwise) |
| 1285 // onto the painting. | 1280 // onto the painting. |
| 1286 PaintRecorder recorder; | 1281 PaintRecorder recorder; |
| 1287 recorder.beginRecording(rect); | 1282 recorder.beginRecording(rect); |
| 1288 recorder.getRecordingCanvas()->drawBitmap(new_bitmap, rect.X(), rect.Y()); | 1283 recorder.getRecordingCanvas()->drawBitmap(new_bitmap, rect.X(), rect.Y()); |
| 1289 sk_sp<PaintRecord> record = recorder.finishRecordingAsPicture(); | 1284 sk_sp<PaintRecord> record = recorder.finishRecordingAsPicture(); |
| 1290 GetPaintController().AppendDebugDrawingAfterCommit( | 1285 GetPaintController().AppendDebugDrawingAfterCommit( |
| 1291 *this, record, rect, OffsetFromLayoutObjectWithSubpixelAccumulation()); | 1286 *this, record, OffsetFromLayoutObjectWithSubpixelAccumulation()); |
| 1292 } | 1287 } |
| 1293 | 1288 |
| 1294 } // namespace blink | 1289 } // namespace blink |
| 1295 | 1290 |
| 1296 #ifndef NDEBUG | 1291 #ifndef NDEBUG |
| 1297 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { | 1292 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { |
| 1298 if (!layer) { | 1293 if (!layer) { |
| 1299 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; | 1294 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; |
| 1300 return; | 1295 return; |
| 1301 } | 1296 } |
| 1302 | 1297 |
| 1303 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo); | 1298 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo); |
| 1304 LOG(INFO) << output.Utf8().data(); | 1299 LOG(INFO) << output.Utf8().data(); |
| 1305 } | 1300 } |
| 1306 #endif | 1301 #endif |
| OLD | NEW |