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

Side by Side Diff: tools/skdiff_utils.cpp

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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 | « tools/skdiff_utils.h ('k') | tools/skiaserve/Request.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "skdiff.h" 7 #include "skdiff.h"
8 #include "skdiff_utils.h" 8 #include "skdiff_utils.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 27
28 sk_sp<SkData> read_file(const char* file_path) { 28 sk_sp<SkData> read_file(const char* file_path) {
29 sk_sp<SkData> data(SkData::MakeFromFileName(file_path)); 29 sk_sp<SkData> data(SkData::MakeFromFileName(file_path));
30 if (!data) { 30 if (!data) {
31 SkDebugf("WARNING: could not open file <%s> for reading\n", file_path); 31 SkDebugf("WARNING: could not open file <%s> for reading\n", file_path);
32 } 32 }
33 return data; 33 return data;
34 } 34 }
35 35
36 bool get_bitmap(SkData* fileBits, DiffResource& resource, bool sizeOnly) { 36 bool get_bitmap(sk_sp<SkData> fileBits, DiffResource& resource, bool sizeOnly) {
37 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fileBits)); 37 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fileBits));
38 if (!codec) { 38 if (!codec) {
39 SkDebugf("ERROR: could not create codec for <%s>\n", resource.fFullPath. c_str()); 39 SkDebugf("ERROR: could not create codec for <%s>\n", resource.fFullPath. c_str());
40 resource.fStatus = DiffResource::kCouldNotDecode_Status; 40 resource.fStatus = DiffResource::kCouldNotDecode_Status;
41 return false; 41 return false;
42 } 42 }
43 43
44 if (!resource.fBitmap.setInfo(codec->getInfo().makeColorType(kN32_SkColorTyp e))) { 44 if (!resource.fBitmap.setInfo(codec->getInfo().makeColorType(kN32_SkColorTyp e))) {
45 SkDebugf("ERROR: could not set bitmap info for <%s>\n", resource.fFullPa th.c_str()); 45 SkDebugf("ERROR: could not set bitmap info for <%s>\n", resource.fFullPa th.c_str());
46 resource.fStatus = DiffResource::kCouldNotDecode_Status; 46 resource.fStatus = DiffResource::kCouldNotDecode_Status;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 drp->fDifference.fStatus = DiffResource::kDoesNotExist_Status; 170 drp->fDifference.fStatus = DiffResource::kDoesNotExist_Status;
171 } 171 }
172 if (write_bitmap(drp->fWhite.fFullPath, drp->fWhite.fBitmap)) { 172 if (write_bitmap(drp->fWhite.fFullPath, drp->fWhite.fBitmap)) {
173 drp->fWhite.fStatus = DiffResource::kExists_Status; 173 drp->fWhite.fStatus = DiffResource::kExists_Status;
174 } else { 174 } else {
175 drp->fWhite.fStatus = DiffResource::kDoesNotExist_Status; 175 drp->fWhite.fStatus = DiffResource::kDoesNotExist_Status;
176 } 176 }
177 } 177 }
178 } 178 }
179 } 179 }
OLDNEW
« no previous file with comments | « tools/skdiff_utils.h ('k') | tools/skiaserve/Request.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698