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

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

Issue 322963002: hide SkBitmap::setConfig (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
« no previous file with comments | « src/images/SkImageDecoder_libwebp.cpp ('k') | src/images/SkImageDecoder_wbmp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 29 matching lines...) Expand all
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 // should we allow the Chooser (if present) to pick a config for us??? 49 // should we allow the Chooser (if present) to pick a config for us???
50 if (!this->chooseFromOneChoice(SkBitmap::kARGB_8888_Config, width, height)) { 50 if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) {
51 return false; 51 return false;
52 } 52 }
53 53
54 // Setup the sampler... 54 // Setup the sampler...
55 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); 55 SkScaledBitmapSampler sampler(width, height, this->getSampleSize());
56 56
57 // Set the config... 57 // Set the config...
58 bm->setConfig(SkBitmap::kARGB_8888_Config, sampler.scaledWidth(), sampler.sc aledHeight(), 58 bm->setInfo(SkImageInfo::MakeN32(sampler.scaledWidth(), sampler.scaledHeight (),
59 0, kOpaque_SkAlphaType); 59 kOpaque_SkAlphaType));
60 if (SkImageDecoder::kDecodeBounds_Mode == mode) { 60 if (SkImageDecoder::kDecodeBounds_Mode == mode) {
61 return true; 61 return true;
62 } 62 }
63 63
64 if (!this->allocPixelRef(bm, NULL)) { 64 if (!this->allocPixelRef(bm, NULL)) {
65 return false; 65 return false;
66 } 66 }
67 67
68 // Lock the pixels, since we're about to write to them... 68 // Lock the pixels, since we're about to write to them...
69 SkAutoLockPixels alp(*bm); 69 SkAutoLockPixels alp(*bm);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 static SkImageDecoder_DecodeReg gReg(sk_libpkm_dfactory); 122 static SkImageDecoder_DecodeReg gReg(sk_libpkm_dfactory);
123 123
124 static SkImageDecoder::Format get_format_pkm(SkStreamRewindable* stream) { 124 static SkImageDecoder::Format get_format_pkm(SkStreamRewindable* stream) {
125 if (is_pkm(stream)) { 125 if (is_pkm(stream)) {
126 return SkImageDecoder::kPKM_Format; 126 return SkImageDecoder::kPKM_Format;
127 } 127 }
128 return SkImageDecoder::kUnknown_Format; 128 return SkImageDecoder::kUnknown_Format;
129 } 129 }
130 130
131 static SkImageDecoder_FormatReg gFormatReg(get_format_pkm); 131 static SkImageDecoder_FormatReg gFormatReg(get_format_pkm);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libwebp.cpp ('k') | src/images/SkImageDecoder_wbmp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698