OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkImageDecoder.h" | 8 #include "SkImageDecoder.h" |
9 #include "SkImage_Base.h" | 9 #include "SkImage_Base.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkData.h" | 12 #include "SkData.h" |
13 | 13 |
14 class SkImage_Codec : public SkImage_Base { | 14 class SkImage_Codec : public SkImage_Base { |
15 public: | 15 public: |
16 static SkImage* NewEmpty(); | 16 static SkImage* NewEmpty(); |
17 | 17 |
18 SkImage_Codec(SkData* encodedData, int width, int height); | 18 SkImage_Codec(SkData* encodedData, int width, int height); |
19 virtual ~SkImage_Codec(); | 19 virtual ~SkImage_Codec(); |
20 | 20 |
21 virtual void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) SK_OVERRI DE; | 21 virtual void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) SK_OVERRI DE; |
22 virtual void onDrawRectToRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) SK_OVERRIDE; | 22 virtual void onDrawRectToRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) SK_OVERRIDE; |
23 | |
Justin Novosad
2014/07/11 15:13:55
Revert this whitespace change please
Rémi Piotaix
2014/07/11 15:33:51
Done.
| |
24 private: | 23 private: |
25 SkData* fEncodedData; | 24 SkData* fEncodedData; |
26 SkBitmap fBitmap; | 25 SkBitmap fBitmap; |
27 | 26 |
28 typedef SkImage_Base INHERITED; | 27 typedef SkImage_Base INHERITED; |
29 }; | 28 }; |
30 | 29 |
31 /////////////////////////////////////////////////////////////////////////////// | 30 /////////////////////////////////////////////////////////////////////////////// |
32 | 31 |
33 SkImage_Codec::SkImage_Codec(SkData* data, int width, int height) : INHERITED(wi dth, height) { | 32 SkImage_Codec::SkImage_Codec(SkData* data, int width, int height) : INHERITED(wi dth, height) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 } | 65 } |
67 | 66 |
68 SkBitmap bitmap; | 67 SkBitmap bitmap; |
69 if (!SkImageDecoder::DecodeMemory(data->bytes(), data->size(), &bitmap, kUnk nown_SkColorType, | 68 if (!SkImageDecoder::DecodeMemory(data->bytes(), data->size(), &bitmap, kUnk nown_SkColorType, |
70 SkImageDecoder::kDecodeBounds_Mode)) { | 69 SkImageDecoder::kDecodeBounds_Mode)) { |
71 return NULL; | 70 return NULL; |
72 } | 71 } |
73 | 72 |
74 return SkNEW_ARGS(SkImage_Codec, (data, bitmap.width(), bitmap.height())); | 73 return SkNEW_ARGS(SkImage_Codec, (data, bitmap.width(), bitmap.height())); |
75 } | 74 } |
OLD | NEW |