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 "SkSurface_Base.h" | 8 #include "SkSurface_Base.h" |
9 #include "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 static const size_t kMaxTotalSize = SK_MaxS32; | 40 static const size_t kMaxTotalSize = SK_MaxS32; |
41 | 41 |
42 int shift = 0; | 42 int shift = 0; |
43 switch (info.fColorType) { | 43 switch (info.fColorType) { |
44 case kAlpha_8_SkColorType: | 44 case kAlpha_8_SkColorType: |
45 shift = 0; | 45 shift = 0; |
46 break; | 46 break; |
47 case kRGB_565_SkColorType: | 47 case kRGB_565_SkColorType: |
48 shift = 1; | 48 shift = 1; |
49 break; | 49 break; |
50 case kPMColor_SkColorType: | 50 case kN32_SkColorType: |
51 shift = 2; | 51 shift = 2; |
52 break; | 52 break; |
53 default: | 53 default: |
54 return false; | 54 return false; |
55 } | 55 } |
56 | 56 |
57 if (kIgnoreRowBytesValue == rowBytes) { | 57 if (kIgnoreRowBytesValue == rowBytes) { |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (!SkSurface_Raster::Valid(info)) { | 152 if (!SkSurface_Raster::Valid(info)) { |
153 return NULL; | 153 return NULL; |
154 } | 154 } |
155 | 155 |
156 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, NULL)); | 156 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, NULL)); |
157 if (NULL == pr.get()) { | 157 if (NULL == pr.get()) { |
158 return NULL; | 158 return NULL; |
159 } | 159 } |
160 return SkNEW_ARGS(SkSurface_Raster, (pr)); | 160 return SkNEW_ARGS(SkSurface_Raster, (pr)); |
161 } | 161 } |
OLD | NEW |