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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 980333002: DM: support non-fatal errors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 | « dm/DMSrcSink.h ('k') | 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 "DMSrcSink.h" 1 #include "DMSrcSink.h"
2 #include "SamplePipeControllers.h" 2 #include "SamplePipeControllers.h"
3 #include "SkCommonFlags.h" 3 #include "SkCommonFlags.h"
4 #include "SkCodec.h" 4 #include "SkCodec.h"
5 #include "SkDocument.h" 5 #include "SkDocument.h"
6 #include "SkError.h" 6 #include "SkError.h"
7 #include "SkMultiPictureDraw.h" 7 #include "SkMultiPictureDraw.h"
8 #include "SkNullCanvas.h" 8 #include "SkNullCanvas.h"
9 #include "SkOSFile.h" 9 #include "SkOSFile.h"
10 #include "SkPictureRecorder.h" 10 #include "SkPictureRecorder.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 // Decode subsets. This is a little involved. 86 // Decode subsets. This is a little involved.
87 SkAutoTDelete<SkMemoryStream> stream(new SkMemoryStream(encoded)); 87 SkAutoTDelete<SkMemoryStream> stream(new SkMemoryStream(encoded));
88 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream.get())) ; 88 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream.get())) ;
89 if (!decoder) { 89 if (!decoder) {
90 return SkStringPrintf("Can't find a good decoder for %s.", fPath.c_str() ); 90 return SkStringPrintf("Can't find a good decoder for %s.", fPath.c_str() );
91 } 91 }
92 stream->rewind(); 92 stream->rewind();
93 int w,h; 93 int w,h;
94 if (!decoder->buildTileIndex(stream.detach(), &w, &h) || w*h == 1) { 94 if (!decoder->buildTileIndex(stream.detach(), &w, &h) || w*h == 1) {
95 return ""; // Not an error. Subset decoding is not always supported. 95 return Error::Nonfatal("Subset decoding not supported.");
96 } 96 }
97 97
98 // Divide the image into subsets that cover the entire image. 98 // Divide the image into subsets that cover the entire image.
99 if (fDivisor > w || fDivisor > h) { 99 if (fDivisor > w || fDivisor > h) {
100 return SkStringPrintf("divisor %d is too big for %s with dimensions (%d x %d)", 100 return SkStringPrintf("divisor %d is too big for %s with dimensions (%d x %d)",
101 fDivisor, fPath.c_str(), w, h); 101 fDivisor, fPath.c_str(), w, h);
102 } 102 }
103 const int subsetWidth = w / fDivisor, 103 const int subsetWidth = w / fDivisor,
104 subsetHeight = h / fDivisor; 104 subsetHeight = h / fDivisor;
105 for (int y = 0; y < h; y += subsetHeight) { 105 for (int y = 0; y < h; y += subsetHeight) {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 surfaces.unrefAll(); 511 surfaces.unrefAll();
512 return ""; 512 return "";
513 } 513 }
514 SkISize size() const SK_OVERRIDE { return fSize; } 514 SkISize size() const SK_OVERRIDE { return fSize; }
515 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. 515 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this.
516 } proxy(fW, fH, pic, src.size()); 516 } proxy(fW, fH, pic, src.size());
517 return fSink->draw(proxy, bitmap, stream, log); 517 return fSink->draw(proxy, bitmap, stream, log);
518 } 518 }
519 519
520 } // namespace DM 520 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMSrcSink.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698