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

Side by Side Diff: dm/DMUtil.cpp

Issue 315743002: DM: go back to memcmp for BitmapsEqual (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "DMUtil.h" 1 #include "DMUtil.h"
2 2
3 #include "SkColorPriv.h" 3 #include "SkColorPriv.h"
4 #include "SkPicture.h" 4 #include "SkPicture.h"
5 #include "SkPictureRecorder.h" 5 #include "SkPictureRecorder.h"
6 6
7 namespace DM { 7 namespace DM {
8 8
9 SkString UnderJoin(const char* a, const char* b) { 9 SkString UnderJoin(const char* a, const char* b) {
10 SkString s; 10 SkString s;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 const uint8_t* bBytes = (const uint8_t*)b.getPixels(); 77 const uint8_t* bBytes = (const uint8_t*)b.getPixels();
78 for (size_t i = 0; i < a.getSize(); i++) { 78 for (size_t i = 0; i < a.getSize(); i++) {
79 max = SkTMax(max, abs_diff(aBytes[i], bBytes[i])); 79 max = SkTMax(max, abs_diff(aBytes[i], bBytes[i]));
80 } 80 }
81 } 81 }
82 82
83 return max; 83 return max;
84 } 84 }
85 85
86 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) { 86 bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b) {
87 return a.info() == b.info() && 0 == MaxComponentDifference(a, b); 87 if (a.info() != b.info()) {
88 return false;
89 }
90 const SkAutoLockPixels lockA(a), lockB(b);
91 return 0 == memcmp(a.getPixels(), b.getPixels(), a.getSize());
88 } 92 }
89 93
90 } // namespace DM 94 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698