OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 | 8 |
9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 if (dst->width() < w || dst->height() < h) { | 199 if (dst->width() < w || dst->height() < h) { |
200 SkDEBUGF(("SkImageDecoder::cropBitmap does not have a large enough bitma
p.\n")); | 200 SkDEBUGF(("SkImageDecoder::cropBitmap does not have a large enough bitma
p.\n")); |
201 } | 201 } |
202 | 202 |
203 // Set the Src_Mode for the paint to prevent transparency issue in the | 203 // Set the Src_Mode for the paint to prevent transparency issue in the |
204 // dest in the event that the dest was being re-used. | 204 // dest in the event that the dest was being re-used. |
205 SkPaint paint; | 205 SkPaint paint; |
206 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 206 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
207 | 207 |
208 SkCanvas canvas(*dst); | 208 SkCanvas canvas(*dst); |
209 canvas.drawSprite(*src, (srcX - dstX) / sampleSize, | 209 canvas.drawBitmap(*src, SkIntToScalar((srcX - dstX) / sampleSize), |
210 (srcY - dstY) / sampleSize, | 210 SkIntToScalar((srcY - dstY) / sampleSize), |
211 &paint); | 211 &paint); |
212 return true; | 212 return true; |
213 } | 213 } |
214 | 214 |
215 /////////////////////////////////////////////////////////////////////////////// | 215 /////////////////////////////////////////////////////////////////////////////// |
216 | 216 |
217 bool SkImageDecoder::DecodeFile(const char file[], SkBitmap* bm, SkColorType pre
f, Mode mode, | 217 bool SkImageDecoder::DecodeFile(const char file[], SkBitmap* bm, SkColorType pre
f, Mode mode, |
218 Format* format) { | 218 Format* format) { |
219 SkASSERT(file); | 219 SkASSERT(file); |
220 SkASSERT(bm); | 220 SkASSERT(bm); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 return success; | 265 return success; |
266 } | 266 } |
267 | 267 |
268 bool SkImageDecoder::decodeYUV8Planes(SkStream* stream, SkISize componentSizes[3
], void* planes[3], | 268 bool SkImageDecoder::decodeYUV8Planes(SkStream* stream, SkISize componentSizes[3
], void* planes[3], |
269 size_t rowBytes[3], SkYUVColorSpace* color
Space) { | 269 size_t rowBytes[3], SkYUVColorSpace* color
Space) { |
270 // we reset this to false before calling onDecodeYUV8Planes | 270 // we reset this to false before calling onDecodeYUV8Planes |
271 fShouldCancelDecode = false; | 271 fShouldCancelDecode = false; |
272 | 272 |
273 return this->onDecodeYUV8Planes(stream, componentSizes, planes, rowBytes, co
lorSpace); | 273 return this->onDecodeYUV8Planes(stream, componentSizes, planes, rowBytes, co
lorSpace); |
274 } | 274 } |
OLD | NEW |