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

Side by Side Diff: src/images/SkImageDecoder_pkm.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 "SkScaledBitmapSampler.h" 10 #include "SkScaledBitmapSampler.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 unsigned char* buf = (unsigned char*)autoMal.get(); 41 unsigned char* buf = (unsigned char*)autoMal.get();
42 42
43 // Make sure original PKM header is there... 43 // Make sure original PKM header is there...
44 SkASSERT(etc1_pkm_is_valid(buf)); 44 SkASSERT(etc1_pkm_is_valid(buf));
45 45
46 const unsigned short width = etc1_pkm_get_width(buf); 46 const unsigned short width = etc1_pkm_get_width(buf);
47 const unsigned short height = etc1_pkm_get_height(buf); 47 const unsigned short height = etc1_pkm_get_height(buf);
48 48
49 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
49 // should we allow the Chooser (if present) to pick a config for us??? 50 // should we allow the Chooser (if present) to pick a config for us???
50 if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) { 51 if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) {
51 return false; 52 return false;
52 } 53 }
54 #endif
53 55
54 // Setup the sampler... 56 // Setup the sampler...
55 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); 57 SkScaledBitmapSampler sampler(width, height, this->getSampleSize());
56 58
57 // Set the config... 59 // Set the config...
58 bm->setInfo(SkImageInfo::MakeN32(sampler.scaledWidth(), sampler.scaledHeight (), 60 bm->setInfo(SkImageInfo::MakeN32(sampler.scaledWidth(), sampler.scaledHeight (),
59 kOpaque_SkAlphaType)); 61 kOpaque_SkAlphaType));
60 if (SkImageDecoder::kDecodeBounds_Mode == mode) { 62 if (SkImageDecoder::kDecodeBounds_Mode == mode) {
61 return true; 63 return true;
62 } 64 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 static SkImageDecoder_DecodeReg gReg(sk_libpkm_dfactory); 124 static SkImageDecoder_DecodeReg gReg(sk_libpkm_dfactory);
123 125
124 static SkImageDecoder::Format get_format_pkm(SkStreamRewindable* stream) { 126 static SkImageDecoder::Format get_format_pkm(SkStreamRewindable* stream) {
125 if (is_pkm(stream)) { 127 if (is_pkm(stream)) {
126 return SkImageDecoder::kPKM_Format; 128 return SkImageDecoder::kPKM_Format;
127 } 129 }
128 return SkImageDecoder::kUnknown_Format; 130 return SkImageDecoder::kUnknown_Format;
129 } 131 }
130 132
131 static SkImageDecoder_FormatReg gFormatReg(get_format_pkm); 133 static SkImageDecoder_FormatReg gFormatReg(get_format_pkm);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698