OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/codec/jpeg_codec.h" | 5 #include "ui/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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
12 #include "third_party/skia/include/core/SkColorPriv.h" | 12 #include "third_party/skia/include/core/SkColorPriv.h" |
13 | 13 |
14 extern "C" { | 14 extern "C" { |
15 #if defined(USE_SYSTEM_LIBJPEG) | 15 #if defined(USE_SYSTEM_LIBJPEG) |
16 #include <jpeglib.h> | 16 #include <jpeglib.h> |
17 #elif defined(USE_LIBJPEG_TURBO) | 17 #elif defined(USE_LIBJPEG_TURBO) && !defined(OS_CHROMEOS) |
sky
2014/09/18 22:19:37
Why is SE_LIBJPEG_TURBO set for chromeos if we're
Ed Baker
2014/09/18 23:07:35
Chrome OS uses both IJG libjpeg and libjpeg_turbo.
| |
18 #include "third_party/libjpeg_turbo/jpeglib.h" | 18 #include "third_party/libjpeg_turbo/jpeglib.h" |
19 #else | 19 #else |
20 #include "third_party/libjpeg/jpeglib.h" | 20 #include "third_party/libjpeg/jpeglib.h" |
21 #endif | 21 #endif |
22 } | 22 } |
23 | 23 |
24 namespace gfx { | 24 namespace gfx { |
25 | 25 |
26 // Encoder/decoder shared stuff ------------------------------------------------ | 26 // Encoder/decoder shared stuff ------------------------------------------------ |
27 | 27 |
(...skipping 11 matching lines...) Expand all Loading... | |
39 // Return control to the setjmp point. | 39 // Return control to the setjmp point. |
40 longjmp(err->setjmp_buffer, false); | 40 longjmp(err->setjmp_buffer, false); |
41 } | 41 } |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 // This method helps identify at run time which library chromium is using. | 45 // This method helps identify at run time which library chromium is using. |
46 JPEGCodec::LibraryVariant JPEGCodec::JpegLibraryVariant() { | 46 JPEGCodec::LibraryVariant JPEGCodec::JpegLibraryVariant() { |
47 #if defined(USE_SYSTEM_LIBJPEG) | 47 #if defined(USE_SYSTEM_LIBJPEG) |
48 return SYSTEM_LIBJPEG; | 48 return SYSTEM_LIBJPEG; |
49 #elif defined(USE_LIBJPEG_TURBO) | 49 #elif defined(USE_LIBJPEG_TURBO) && !defined(OS_CHROMEOS) |
50 return LIBJPEG_TURBO; | 50 return LIBJPEG_TURBO; |
51 #else | 51 #else |
52 return IJG_LIBJPEG; | 52 return IJG_LIBJPEG; |
53 #endif | 53 #endif |
54 } | 54 } |
55 | 55 |
56 // Encoder --------------------------------------------------------------------- | 56 // Encoder --------------------------------------------------------------------- |
57 // | 57 // |
58 // This code is based on nsJPEGEncoder from Mozilla. | 58 // This code is based on nsJPEGEncoder from Mozilla. |
59 // Copyright 2005 Google Inc. (Brett Wilson, contributor) | 59 // Copyright 2005 Google Inc. (Brett Wilson, contributor) |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
613 int data_length = w * h * 4; | 613 int data_length = w * h * 4; |
614 | 614 |
615 SkBitmap* bitmap = new SkBitmap(); | 615 SkBitmap* bitmap = new SkBitmap(); |
616 bitmap->allocN32Pixels(w, h); | 616 bitmap->allocN32Pixels(w, h); |
617 memcpy(bitmap->getAddr32(0, 0), &data_vector[0], data_length); | 617 memcpy(bitmap->getAddr32(0, 0), &data_vector[0], data_length); |
618 | 618 |
619 return bitmap; | 619 return bitmap; |
620 } | 620 } |
621 | 621 |
622 } // namespace gfx | 622 } // namespace gfx |
OLD | NEW |