OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 7 |
8 #include "DMSrcSink.h" | 8 #include "DMSrcSink.h" |
9 #include "SamplePipeControllers.h" | 9 #include "SamplePipeControllers.h" |
10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 linesToRead, bitmap.rowBytes()); | 324 linesToRead, bitmap.rowBytes()); |
325 switch (result) { | 325 switch (result) { |
326 case SkImageGenerator::kSuccess: | 326 case SkImageGenerator::kSuccess: |
327 case SkImageGenerator::kIncompleteInput: | 327 case SkImageGenerator::kIncompleteInput: |
328 break; | 328 break; |
329 default: | 329 default: |
330 return SkStringPrintf("Cannot get scanlines for %s.", fP
ath.c_str()); | 330 return SkStringPrintf("Cannot get scanlines for %s.", fP
ath.c_str()); |
331 } | 331 } |
332 | 332 |
333 // Skip a stripe | 333 // Skip a stripe |
334 const int linesToSkip = SkTMax(0, SkTMin(stripeHeight, | 334 const int linesToSkip = SkTMin(stripeHeight, height - (i + 1) *
stripeHeight); |
335 height - (i + 1) * stripeHeight)); | 335 if (linesToSkip > 0) { |
336 result = decoder->skipScanlines(linesToSkip); | 336 result = decoder->skipScanlines(linesToSkip); |
337 switch (result) { | 337 switch (result) { |
338 case SkImageGenerator::kSuccess: | 338 case SkImageGenerator::kSuccess: |
339 case SkImageGenerator::kIncompleteInput: | 339 case SkImageGenerator::kIncompleteInput: |
340 break; | 340 break; |
341 default: | 341 default: |
342 return SkStringPrintf("Cannot skip scanlines for %s.", f
Path.c_str()); | 342 return SkStringPrintf("Cannot skip scanlines for %s.
", fPath.c_str()); |
| 343 } |
343 } | 344 } |
344 } | 345 } |
345 canvas->drawBitmap(bitmap, 0, 0); | 346 canvas->drawBitmap(bitmap, 0, 0); |
346 } | 347 } |
347 } | 348 } |
348 return ""; | 349 return ""; |
349 } | 350 } |
350 | 351 |
351 SkISize CodecSrc::size() const { | 352 SkISize CodecSrc::size() const { |
352 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); | 353 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 skr.visit<void>(i, drawsAsSingletonPictures); | 970 skr.visit<void>(i, drawsAsSingletonPictures); |
970 } | 971 } |
971 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 972 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
972 | 973 |
973 canvas->drawPicture(macroPic); | 974 canvas->drawPicture(macroPic); |
974 return ""; | 975 return ""; |
975 }); | 976 }); |
976 } | 977 } |
977 | 978 |
978 } // namespace DM | 979 } // namespace DM |
OLD | NEW |