OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkDrawBitmap.h" | 10 #include "SkDrawBitmap.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 case 2: formatName = "A8"; break; | 79 case 2: formatName = "A8"; break; |
80 case 3: formatName = "Index8"; break; | 80 case 3: formatName = "Index8"; break; |
81 case 4: formatName = "RGB16"; break; | 81 case 4: formatName = "RGB16"; break; |
82 case 5: formatName = "RGB32"; break; | 82 case 5: formatName = "RGB32"; break; |
83 } | 83 } |
84 SkDebugf("format=\"%s\" />\n", formatName); | 84 SkDebugf("format=\"%s\" />\n", formatName); |
85 } | 85 } |
86 #endif | 86 #endif |
87 | 87 |
88 void SkDrawBitmap::onEndElement(SkAnimateMaker&) { | 88 void SkDrawBitmap::onEndElement(SkAnimateMaker&) { |
89 SkASSERT(format != (SkBitmap::Config) -1); | |
90 SkASSERT(width != -1); | 89 SkASSERT(width != -1); |
91 SkASSERT(height != -1); | 90 SkASSERT(height != -1); |
92 SkASSERT(rowBytes >= 0); | 91 SkASSERT(rowBytes >= 0); |
93 fBitmap.setConfig((SkBitmap::Config) format, width, height, rowBytes); | 92 fBitmap.setConfig((SkBitmap::Config) format, width, height, rowBytes); |
94 fBitmap.allocPixels(); | 93 fBitmap.allocPixels(); |
95 if (fColorSet) | 94 if (fColorSet) |
96 fBitmap.eraseColor(fColor); | 95 fBitmap.eraseColor(fColor); |
97 } | 96 } |
98 | 97 |
99 bool SkDrawBitmap::setProperty(int index, SkScriptValue& value) | 98 bool SkDrawBitmap::setProperty(int index, SkScriptValue& value) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 fLast.set(src); | 188 fLast.set(src); |
190 fBitmap.reset(); | 189 fBitmap.reset(); |
191 | 190 |
192 //SkStream* stream = SkStream::GetURIStream(fUriBase, src.c_str()); | 191 //SkStream* stream = SkStream::GetURIStream(fUriBase, src.c_str()); |
193 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(src.c_str())); | 192 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(src.c_str())); |
194 if (stream.get()) { | 193 if (stream.get()) { |
195 SkImageDecoder::DecodeStream(stream, &fBitmap); | 194 SkImageDecoder::DecodeStream(stream, &fBitmap); |
196 } | 195 } |
197 } | 196 } |
198 } | 197 } |
OLD | NEW |