| 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 "SkAndroidCodec.h" | 8 #include "SkAndroidCodec.h" |
| 9 #include "SkBitmapRegionCodec.h" | 9 #include "SkBitmapRegionCodec.h" |
| 10 #include "SkBitmapRegionDecoderPriv.h" | 10 #include "SkBitmapRegionDecoderPriv.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 options.fZeroInitialized = zeroInit; | 122 options.fZeroInitialized = zeroInit; |
| 123 void* dst = bitmap->getAddr(scaledOutX, scaledOutY); | 123 void* dst = bitmap->getAddr(scaledOutX, scaledOutY); |
| 124 | 124 |
| 125 // FIXME: skbug.com/4538 | 125 // FIXME: skbug.com/4538 |
| 126 // It is important that we use the rowBytes on the pixelRef. They may not b
e | 126 // It is important that we use the rowBytes on the pixelRef. They may not b
e |
| 127 // set properly on the bitmap. | 127 // set properly on the bitmap. |
| 128 SkPixelRef* pr = SkRef(bitmap->pixelRef()); | 128 SkPixelRef* pr = SkRef(bitmap->pixelRef()); |
| 129 size_t rowBytes = pr->rowBytes(); | 129 size_t rowBytes = pr->rowBytes(); |
| 130 bitmap->setInfo(outInfo, rowBytes); | 130 bitmap->setInfo(outInfo, rowBytes); |
| 131 bitmap->setPixelRef(pr)->unref(); | 131 bitmap->setPixelRef(pr)->unref(); |
| 132 bitmap->lockPixels(); |
| 132 SkCodec::Result result = fCodec->getAndroidPixels(decodeInfo, dst, rowBytes,
&options); | 133 SkCodec::Result result = fCodec->getAndroidPixels(decodeInfo, dst, rowBytes,
&options); |
| 133 if (SkCodec::kSuccess != result && SkCodec::kIncompleteInput != result) { | 134 if (SkCodec::kSuccess != result && SkCodec::kIncompleteInput != result) { |
| 134 SkCodecPrintf("Error: Could not get pixels.\n"); | 135 SkCodecPrintf("Error: Could not get pixels.\n"); |
| 135 return false; | 136 return false; |
| 136 } | 137 } |
| 137 | 138 |
| 138 return true; | 139 return true; |
| 139 } | 140 } |
| 140 | 141 |
| 141 bool SkBitmapRegionCodec::conversionSupported(SkColorType colorType) { | 142 bool SkBitmapRegionCodec::conversionSupported(SkColorType colorType) { |
| 142 // FIXME: Call virtual function when it lands. | 143 // FIXME: Call virtual function when it lands. |
| 143 SkImageInfo info = SkImageInfo::Make(0, 0, colorType, fCodec->getInfo().alph
aType(), | 144 SkImageInfo info = SkImageInfo::Make(0, 0, colorType, fCodec->getInfo().alph
aType(), |
| 144 fCodec->getInfo().profileType()); | 145 fCodec->getInfo().profileType()); |
| 145 return conversion_possible(info, fCodec->getInfo()); | 146 return conversion_possible(info, fCodec->getInfo()); |
| 146 } | 147 } |
| OLD | NEW |