| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 return chooser->choose() == 0; | 136 return chooser->choose() == 0; |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap, | 139 bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap, |
| 140 SkColorTable* ctable) const { | 140 SkColorTable* ctable) const { |
| 141 return bitmap->allocPixels(fAllocator, ctable); | 141 return bitmap->allocPixels(fAllocator, ctable); |
| 142 } | 142 } |
| 143 | 143 |
| 144 /////////////////////////////////////////////////////////////////////////////// | 144 /////////////////////////////////////////////////////////////////////////////// |
| 145 | 145 |
| 146 void SkImageDecoder::setPrefConfigTable(const SkBitmap::Config pref[6]) { | |
| 147 if (NULL == pref) { | |
| 148 fUsePrefTable = false; | |
| 149 } else { | |
| 150 fUsePrefTable = true; | |
| 151 fPrefTable.fPrefFor_8Index_NoAlpha_src = pref[0]; | |
| 152 fPrefTable.fPrefFor_8Index_YesAlpha_src = pref[1]; | |
| 153 fPrefTable.fPrefFor_8Gray_src = SkBitmap::kNo_Config; | |
| 154 fPrefTable.fPrefFor_8bpc_NoAlpha_src = pref[4]; | |
| 155 fPrefTable.fPrefFor_8bpc_YesAlpha_src = pref[5]; | |
| 156 } | |
| 157 } | |
| 158 | |
| 159 void SkImageDecoder::setPrefConfigTable(const PrefConfigTable& prefTable) { | 146 void SkImageDecoder::setPrefConfigTable(const PrefConfigTable& prefTable) { |
| 160 fUsePrefTable = true; | 147 fUsePrefTable = true; |
| 161 fPrefTable = prefTable; | 148 fPrefTable = prefTable; |
| 162 } | 149 } |
| 163 | 150 |
| 164 SkBitmap::Config SkImageDecoder::getPrefConfig(SrcDepth srcDepth, | 151 SkBitmap::Config SkImageDecoder::getPrefConfig(SrcDepth srcDepth, |
| 165 bool srcHasAlpha) const { | 152 bool srcHasAlpha) const { |
| 166 SkBitmap::Config config = SkBitmap::kNo_Config; | 153 SkBitmap::Config config = SkBitmap::kNo_Config; |
| 167 | 154 |
| 168 if (fUsePrefTable) { | 155 if (fUsePrefTable) { |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 if (kUnknown_Format == *format) { | 449 if (kUnknown_Format == *format) { |
| 463 if (stream->rewind()) { | 450 if (stream->rewind()) { |
| 464 *format = GetStreamFormat(stream); | 451 *format = GetStreamFormat(stream); |
| 465 } | 452 } |
| 466 } | 453 } |
| 467 } | 454 } |
| 468 delete codec; | 455 delete codec; |
| 469 } | 456 } |
| 470 return success; | 457 return success; |
| 471 } | 458 } |
| OLD | NEW |