OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/graphics/paint/DrawingDisplayItem.h" | 5 #include "platform/graphics/paint/DrawingDisplayItem.h" |
6 | 6 |
7 #include "platform/graphics/GraphicsContext.h" | 7 #include "platform/graphics/GraphicsContext.h" |
8 #include "platform/graphics/paint/PaintCanvas.h" | 8 #include "platform/graphics/paint/PaintCanvas.h" |
9 #include "public/platform/WebDisplayItemList.h" | 9 #include "public/platform/WebDisplayItemList.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 string_builder.Append( | 41 string_builder.Append( |
42 String::Format(", rect: [%f,%f %fx%f]", record_->cullRect().x(), | 42 String::Format(", rect: [%f,%f %fx%f]", record_->cullRect().x(), |
43 record_->cullRect().y(), record_->cullRect().width(), | 43 record_->cullRect().y(), record_->cullRect().width(), |
44 record_->cullRect().height())); | 44 record_->cullRect().height())); |
45 } | 45 } |
46 } | 46 } |
47 #endif | 47 #endif |
48 | 48 |
49 static bool RecordsEqual(sk_sp<const PaintRecord> record1, | 49 static bool RecordsEqual(sk_sp<const PaintRecord> record1, |
50 sk_sp<const PaintRecord> record2) { | 50 sk_sp<const PaintRecord> record2) { |
51 if (record1->approximateOpCount() != record2->approximateOpCount()) | 51 if (record1->size() != record2->size()) |
52 return false; | 52 return false; |
53 | 53 |
54 // TODO(enne): PaintRecord should have an operator== | 54 // TODO(enne): PaintRecord should have an operator== |
55 sk_sp<SkData> data1 = ToSkPicture(record1)->serialize(); | 55 sk_sp<SkData> data1 = ToSkPicture(record1)->serialize(); |
56 sk_sp<SkData> data2 = ToSkPicture(record2)->serialize(); | 56 sk_sp<SkData> data2 = ToSkPicture(record2)->serialize(); |
57 return data1->equals(data2.get()); | 57 return data1->equals(data2.get()); |
58 } | 58 } |
59 | 59 |
60 static SkBitmap RecordToBitmap(sk_sp<const PaintRecord> record) { | 60 static SkBitmap RecordToBitmap(sk_sp<const PaintRecord> record) { |
61 SkBitmap bitmap; | 61 SkBitmap bitmap; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 if (RecordsEqual(record, other_record)) | 108 if (RecordsEqual(record, other_record)) |
109 return true; | 109 return true; |
110 | 110 |
111 // Sometimes the client may produce different records for the same visual | 111 // Sometimes the client may produce different records for the same visual |
112 // result, which should be treated as equal. | 112 // result, which should be treated as equal. |
113 return BitmapsEqual(std::move(record), std::move(other_record)); | 113 return BitmapsEqual(std::move(record), std::move(other_record)); |
114 } | 114 } |
115 | 115 |
116 } // namespace blink | 116 } // namespace blink |
OLD | NEW |