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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 } | 257 } |
| 258 *decodeInfo = defaultInfo.makeColorType(kGray_8_SkColorType); | 258 *decodeInfo = defaultInfo.makeColorType(kGray_8_SkColorType); |
| 259 break; | 259 break; |
| 260 default: | 260 default: |
| 261 *decodeInfo = defaultInfo.makeColorType(canvasColorType); | 261 *decodeInfo = defaultInfo.makeColorType(canvasColorType); |
| 262 break; | 262 break; |
| 263 } | 263 } |
| 264 | 264 |
| 265 // FIXME: Currently we cannot draw unpremultiplied sources. | 265 // FIXME: Currently we cannot draw unpremultiplied sources. |
| 266 if (decodeInfo->alphaType() == kUnpremul_SkAlphaType) { | 266 if (decodeInfo->alphaType() == kUnpremul_SkAlphaType) { |
| 267 decodeInfo->makeAlphaType(kPremul_SkAlphaType); | 267 *decodeInfo = decodeInfo->makeAlphaType(kPremul_SkAlphaType); |
|
scroggo
2015/10/27 13:59:04
I wonder if makeAlphaType should be SK_WARN_UNUSED
| |
| 268 } | 268 } |
| 269 return true; | 269 return true; |
| 270 } | 270 } |
| 271 | 271 |
| 272 Error CodecSrc::draw(SkCanvas* canvas) const { | 272 Error CodecSrc::draw(SkCanvas* canvas) const { |
| 273 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); | 273 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); |
| 274 if (!encoded) { | 274 if (!encoded) { |
| 275 return SkStringPrintf("Couldn't read %s.", fPath.c_str()); | 275 return SkStringPrintf("Couldn't read %s.", fPath.c_str()); |
| 276 } | 276 } |
| 277 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); | 277 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1368 skr.visit<void>(i, drawsAsSingletonPictures); | 1368 skr.visit<void>(i, drawsAsSingletonPictures); |
| 1369 } | 1369 } |
| 1370 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1370 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
| 1371 | 1371 |
| 1372 canvas->drawPicture(macroPic); | 1372 canvas->drawPicture(macroPic); |
| 1373 return ""; | 1373 return ""; |
| 1374 }); | 1374 }); |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 } // namespace DM | 1377 } // namespace DM |
| OLD | NEW |