OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkImageEncoder.h" | 8 #include "SkImageEncoder.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
11 #include "SkStream.h" | 11 #include "SkStream.h" |
12 #include "SkTemplates.h" | 12 #include "SkTemplates.h" |
13 | 13 |
14 class SkARGBImageEncoder : public SkImageEncoder { | 14 class SkARGBImageEncoder : public SkImageEncoder { |
15 protected: | 15 protected: |
16 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) SK
_OVERRIDE; | 16 bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) SK_OVERRID
E; |
17 | 17 |
18 private: | 18 private: |
19 typedef SkImageEncoder INHERITED; | 19 typedef SkImageEncoder INHERITED; |
20 }; | 20 }; |
21 | 21 |
22 typedef void (*ScanlineImporter)(const uint8_t* in, uint8_t* argb, int width, | 22 typedef void (*ScanlineImporter)(const uint8_t* in, uint8_t* argb, int width, |
23 const SkPMColor* SK_RESTRICT ctable); | 23 const SkPMColor* SK_RESTRICT ctable); |
24 | 24 |
25 static void ARGB_8888_To_ARGB(const uint8_t* in, uint8_t* argb, int width, const
SkPMColor*) { | 25 static void ARGB_8888_To_ARGB(const uint8_t* in, uint8_t* argb, int width, const
SkPMColor*) { |
26 const uint32_t* SK_RESTRICT src = (const uint32_t*)in; | 26 const uint32_t* SK_RESTRICT src = (const uint32_t*)in; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 stream->write(argb, argbStride); | 108 stream->write(argb, argbStride); |
109 } | 109 } |
110 | 110 |
111 return true; | 111 return true; |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 /////////////////////////////////////////////////////////////////////////////// | 115 /////////////////////////////////////////////////////////////////////////////// |
116 DEFINE_ENCODER_CREATOR(ARGBImageEncoder); | 116 DEFINE_ENCODER_CREATOR(ARGBImageEncoder); |
117 /////////////////////////////////////////////////////////////////////////////// | 117 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |