Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: src/images/SkImageDecoder_ktx.cpp

Issue 331433003: hide SkImageDecoder::Chooser (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 SkKTXFile ktxFile(data); 57 SkKTXFile ktxFile(data);
58 if (!ktxFile.valid()) { 58 if (!ktxFile.valid()) {
59 return false; 59 return false;
60 } 60 }
61 61
62 const unsigned short width = ktxFile.width(); 62 const unsigned short width = ktxFile.width();
63 const unsigned short height = ktxFile.height(); 63 const unsigned short height = ktxFile.height();
64 64
65 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
65 // should we allow the Chooser (if present) to pick a config for us??? 66 // should we allow the Chooser (if present) to pick a config for us???
66 if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) { 67 if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) {
67 return false; 68 return false;
68 } 69 }
70 #endif
69 71
70 // Set a flag if our source is premultiplied alpha 72 // Set a flag if our source is premultiplied alpha
71 const SkString premulKey("KTXPremultipliedAlpha"); 73 const SkString premulKey("KTXPremultipliedAlpha");
72 const bool bSrcIsPremul = ktxFile.getValueForKey(premulKey) == SkString("Tru e"); 74 const bool bSrcIsPremul = ktxFile.getValueForKey(premulKey) == SkString("Tru e");
73 75
74 // Setup the sampler... 76 // Setup the sampler...
75 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); 77 SkScaledBitmapSampler sampler(width, height, this->getSampleSize());
76 78
77 // Determine the alpha of the bitmap... 79 // Determine the alpha of the bitmap...
78 SkAlphaType alphaType = kOpaque_SkAlphaType; 80 SkAlphaType alphaType = kOpaque_SkAlphaType;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 return SkImageDecoder::kUnknown_Format; 268 return SkImageDecoder::kUnknown_Format;
267 } 269 }
268 270
269 SkImageEncoder* sk_libktx_efactory(SkImageEncoder::Type t) { 271 SkImageEncoder* sk_libktx_efactory(SkImageEncoder::Type t) {
270 return (SkImageEncoder::kKTX_Type == t) ? SkNEW(SkKTXImageEncoder) : NULL; 272 return (SkImageEncoder::kKTX_Type == t) ? SkNEW(SkKTXImageEncoder) : NULL;
271 } 273 }
272 274
273 static SkImageDecoder_DecodeReg gReg(sk_libktx_dfactory); 275 static SkImageDecoder_DecodeReg gReg(sk_libktx_dfactory);
274 static SkImageDecoder_FormatReg gFormatReg(get_format_ktx); 276 static SkImageDecoder_FormatReg gFormatReg(get_format_ktx);
275 static SkImageEncoder_EncodeReg gEReg(sk_libktx_efactory); 277 static SkImageEncoder_EncodeReg gEReg(sk_libktx_efactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698