OLD | NEW |
1 #include "DMWriteTask.h" | 1 #include "DMWriteTask.h" |
2 | 2 |
3 #include "DMUtil.h" | 3 #include "DMUtil.h" |
4 #include "SkColorPriv.h" | 4 #include "SkColorPriv.h" |
5 #include "SkCommandLineFlags.h" | 5 #include "SkCommandLineFlags.h" |
6 #include "SkImageEncoder.h" | 6 #include "SkImageEncoder.h" |
7 #include "SkMallocPixelRef.h" | 7 #include "SkMallocPixelRef.h" |
8 #include "SkStream.h" | 8 #include "SkStream.h" |
9 #include "SkString.h" | 9 #include "SkString.h" |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 const size_t offset = data->size() - bitmapBytes; | 92 const size_t offset = data->size() - bitmapBytes; |
93 SkAutoTUnref<SkData> subset( | 93 SkAutoTUnref<SkData> subset( |
94 SkData::NewSubset(data, offset, bitmapBytes)); | 94 SkData::NewSubset(data, offset, bitmapBytes)); |
95 SkAutoTUnref<SkPixelRef> pixels( | 95 SkAutoTUnref<SkPixelRef> pixels( |
96 SkMallocPixelRef::NewWithData( | 96 SkMallocPixelRef::NewWithData( |
97 info, rowBytes, NULL/*ctable*/, subset)); | 97 info, rowBytes, NULL/*ctable*/, subset)); |
98 SkASSERT(pixels); | 98 SkASSERT(pixels); |
99 | 99 |
100 bitmap->setInfo(info, rowBytes); | 100 bitmap->setConfig(info, rowBytes); |
101 bitmap->setPixelRef(pixels); | 101 bitmap->setPixelRef(pixels); |
102 return true; | 102 return true; |
103 } | 103 } |
104 }; | 104 }; |
105 | 105 |
106 } // namespace | 106 } // namespace |
107 | 107 |
108 void WriteTask::draw() { | 108 void WriteTask::draw() { |
109 SkString dir(FLAGS_writePath[0]); | 109 SkString dir(FLAGS_writePath[0]); |
110 this->makeDirOrFail(dir); | 110 this->makeDirOrFail(dir); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 const SkString path = path_to_expected_image(fRoot, task); | 160 const SkString path = path_to_expected_image(fRoot, task); |
161 SkBitmap expected; | 161 SkBitmap expected; |
162 if (!PngAndRaw::Decode(path.c_str(), bitmap.info(), &expected)) { | 162 if (!PngAndRaw::Decode(path.c_str(), bitmap.info(), &expected)) { |
163 return false; | 163 return false; |
164 } | 164 } |
165 | 165 |
166 return BitmapsEqual(expected, bitmap); | 166 return BitmapsEqual(expected, bitmap); |
167 } | 167 } |
168 | 168 |
169 } // namespace DM | 169 } // namespace DM |
OLD | NEW |