Chromium Code Reviews| 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 "SkAndroidCodec.h" | 10 #include "SkAndroidCodec.h" |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 622 int subsetHeight = height / divisor; | 622 int subsetHeight = height / divisor; |
| 623 const int left = x * subsetWidth; | 623 const int left = x * subsetWidth; |
| 624 const int top = y * subsetHeight; | 624 const int top = y * subsetHeight; |
| 625 | 625 |
| 626 // Increase the size of the last subset in each row or colum n, when the | 626 // Increase the size of the last subset in each row or colum n, when the |
| 627 // divisor does not divide evenly into the image dimensions | 627 // divisor does not divide evenly into the image dimensions |
| 628 subsetWidth += (x + 1 == divisor) ? (width % divisor) : 0; | 628 subsetWidth += (x + 1 == divisor) ? (width % divisor) : 0; |
| 629 subsetHeight += (y + 1 == divisor) ? (height % divisor) : 0; | 629 subsetHeight += (y + 1 == divisor) ? (height % divisor) : 0; |
| 630 SkIRect subset = SkIRect::MakeXYWH(left, top, subsetWidth, s ubsetHeight); | 630 SkIRect subset = SkIRect::MakeXYWH(left, top, subsetWidth, s ubsetHeight); |
| 631 if (!codec->getSupportedSubset(&subset)) { | 631 if (!codec->getSupportedSubset(&subset)) { |
| 632 return "Could not get supported subset to decode."; | 632 return Error::Nonfatal("Could not get supported subset t o decode.\n"); |
|
scroggo
2015/12/18 15:56:26
Actually, this is a real error. The subsets reques
yujieqin
2016/01/06 18:47:18
Done.
| |
| 633 } | 633 } |
| 634 options.fSubset = ⊂ | 634 options.fSubset = ⊂ |
| 635 const int scaledWidthOffset = subset.left() / fSampleSize; | 635 const int scaledWidthOffset = subset.left() / fSampleSize; |
| 636 const int scaledHeightOffset = subset.top() / fSampleSize; | 636 const int scaledHeightOffset = subset.top() / fSampleSize; |
| 637 void* pixels = bitmap.getAddr(scaledWidthOffset, scaledHeigh tOffset); | 637 void* pixels = bitmap.getAddr(scaledWidthOffset, scaledHeigh tOffset); |
| 638 SkISize scaledSubsetSize = codec->getSampledSubsetDimensions (fSampleSize, | 638 SkISize scaledSubsetSize = codec->getSampledSubsetDimensions (fSampleSize, |
| 639 subset); | 639 subset); |
| 640 SkImageInfo subsetDecodeInfo = decodeInfo.makeWH(scaledSubse tSize.width(), | 640 SkImageInfo subsetDecodeInfo = decodeInfo.makeWH(scaledSubse tSize.width(), |
| 641 scaledSubsetSize.height()); | 641 scaledSubsetSize.height()); |
| 642 | 642 |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1268 skr.visit<void>(i, drawsAsSingletonPictures); | 1268 skr.visit<void>(i, drawsAsSingletonPictures); |
| 1269 } | 1269 } |
| 1270 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1270 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
| 1271 | 1271 |
| 1272 canvas->drawPicture(macroPic); | 1272 canvas->drawPicture(macroPic); |
| 1273 return ""; | 1273 return ""; |
| 1274 }); | 1274 }); |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 } // namespace DM | 1277 } // namespace DM |
| OLD | NEW |