| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/gfx/jpeg_codec.h" | 5 #include "app/gfx/codec/jpeg_codec.h" |
| 6 | 6 |
| 7 #include <setjmp.h> | 7 #include <setjmp.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
| 12 | 12 |
| 13 extern "C" { | 13 extern "C" { |
| 14 #if defined(USE_SYSTEM_LIBJPEG) | 14 #if defined(USE_SYSTEM_LIBJPEG) |
| 15 #include <jpeglib.h> | 15 #include <jpeglib.h> |
| 16 #else | 16 #else |
| 17 #include "third_party/libjpeg/jpeglib.h" | 17 #include "third_party/libjpeg/jpeglib.h" |
| 18 #endif | 18 #endif |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace gfx { |
| 22 |
| 21 // Encoder/decoder shared stuff ------------------------------------------------ | 23 // Encoder/decoder shared stuff ------------------------------------------------ |
| 22 | 24 |
| 23 namespace { | 25 namespace { |
| 24 | 26 |
| 25 // used to pass error info through the JPEG library | 27 // used to pass error info through the JPEG library |
| 26 struct CoderErrorMgr { | 28 struct CoderErrorMgr { |
| 27 jpeg_error_mgr pub; | 29 jpeg_error_mgr pub; |
| 28 jmp_buf setjmp_buffer; | 30 jmp_buf setjmp_buffer; |
| 29 }; | 31 }; |
| 30 | 32 |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // Skia only handles 32 bit images. | 520 // Skia only handles 32 bit images. |
| 519 int data_length = w * h * 4; | 521 int data_length = w * h * 4; |
| 520 | 522 |
| 521 SkBitmap* bitmap = new SkBitmap(); | 523 SkBitmap* bitmap = new SkBitmap(); |
| 522 bitmap->setConfig(SkBitmap::kARGB_8888_Config, w, h); | 524 bitmap->setConfig(SkBitmap::kARGB_8888_Config, w, h); |
| 523 bitmap->allocPixels(); | 525 bitmap->allocPixels(); |
| 524 memcpy(bitmap->getAddr32(0, 0), &data_vector[0], data_length); | 526 memcpy(bitmap->getAddr32(0, 0), &data_vector[0], data_length); |
| 525 | 527 |
| 526 return bitmap; | 528 return bitmap; |
| 527 } | 529 } |
| 530 |
| 531 } // namespace gfx |
| OLD | NEW |