| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 SkData* encoded = NULL; | 189 SkData* encoded = NULL; |
| 190 if (SkImageEncoder::kJPEG_Type == gTypes[j]) { | 190 if (SkImageEncoder::kJPEG_Type == gTypes[j]) { |
| 191 encoded = fEncodedJPEGs[i].get(); | 191 encoded = fEncodedJPEGs[i].get(); |
| 192 } else if (SkImageEncoder::kPNG_Type == gTypes[j]) { | 192 } else if (SkImageEncoder::kPNG_Type == gTypes[j]) { |
| 193 encoded = fEncodedPNGs[i].get(); | 193 encoded = fEncodedPNGs[i].get(); |
| 194 } | 194 } |
| 195 if (encoded) { | 195 if (encoded) { |
| 196 if (!SkInstallDiscardablePixelRef( | 196 if (!SkInstallDiscardablePixelRef( |
| 197 SkDecodingImageGenerator::Create(encoded, | 197 SkDecodingImageGenerator::Create(encoded, |
| 198 SkDecodingImageGenerator::Options()), | 198 SkDecodingImageGenerator::Options()), |
| 199 &bm, NULL)) { | 199 &bm)) { |
| 200 SkDebugf("[%s:%d] failed to decode %s%s\n", | 200 SkDebugf("[%s:%d] failed to decode %s%s\n", |
| 201 __FILE__, __LINE__,gConfigLabels[i], gExt[j]); | 201 __FILE__, __LINE__,gConfigLabels[i], gExt[j]); |
| 202 } | 202 } |
| 203 canvas->drawBitmap(bm, x, yy); | 203 canvas->drawBitmap(bm, x, yy); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 x += SkIntToScalar(fBitmaps[i].width() + SPACER); | 207 x += SkIntToScalar(fBitmaps[i].width() + SPACER); |
| 208 if (x > maxX) { | 208 if (x > maxX) { |
| 209 maxX = x; | 209 maxX = x; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 227 } | 227 } |
| 228 | 228 |
| 229 private: | 229 private: |
| 230 typedef SampleView INHERITED; | 230 typedef SampleView INHERITED; |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 ////////////////////////////////////////////////////////////////////////////// | 233 ////////////////////////////////////////////////////////////////////////////// |
| 234 | 234 |
| 235 static SkView* MyFactory() { return new EncodeView; } | 235 static SkView* MyFactory() { return new EncodeView; } |
| 236 static SkViewRegister reg(MyFactory); | 236 static SkViewRegister reg(MyFactory); |
| OLD | NEW |