OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "SkImageInfo.h" | 8 #include "SkImageInfo.h" |
9 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
10 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // fall-through | 59 // fall-through |
60 case kIndex_8_SkColorType: | 60 case kIndex_8_SkColorType: |
61 case kARGB_4444_SkColorType: | 61 case kARGB_4444_SkColorType: |
62 case kRGBA_8888_SkColorType: | 62 case kRGBA_8888_SkColorType: |
63 case kBGRA_8888_SkColorType: | 63 case kBGRA_8888_SkColorType: |
64 if (kUnknown_SkAlphaType == alphaType) { | 64 if (kUnknown_SkAlphaType == alphaType) { |
65 return false; | 65 return false; |
66 } | 66 } |
67 break; | 67 break; |
68 case kRGB_565_SkColorType: | 68 case kRGB_565_SkColorType: |
| 69 case kGray_8_SkColorType: |
69 alphaType = kOpaque_SkAlphaType; | 70 alphaType = kOpaque_SkAlphaType; |
70 break; | 71 break; |
71 default: | 72 default: |
72 return false; | 73 return false; |
73 } | 74 } |
74 if (canonical) { | 75 if (canonical) { |
75 *canonical = alphaType; | 76 *canonical = alphaType; |
76 } | 77 } |
77 return true; | 78 return true; |
78 } | 79 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // here x,y are either 0 or negative | 114 // here x,y are either 0 or negative |
114 fPixels = ((char*)fPixels - y * fRowBytes - x * fInfo.bytesPerPixel()); | 115 fPixels = ((char*)fPixels - y * fRowBytes - x * fInfo.bytesPerPixel()); |
115 // the intersect may have shrunk info's logical size | 116 // the intersect may have shrunk info's logical size |
116 fInfo = fInfo.makeWH(srcR.width(), srcR.height()); | 117 fInfo = fInfo.makeWH(srcR.width(), srcR.height()); |
117 fX = srcR.x(); | 118 fX = srcR.x(); |
118 fY = srcR.y(); | 119 fY = srcR.y(); |
119 | 120 |
120 return true; | 121 return true; |
121 } | 122 } |
122 | 123 |
OLD | NEW |