| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 switch (info.colorType()) { | 50 switch (info.colorType()) { |
| 51 case kAlpha_8_SkColorType: | 51 case kAlpha_8_SkColorType: |
| 52 shift = 0; | 52 shift = 0; |
| 53 break; | 53 break; |
| 54 case kRGB_565_SkColorType: | 54 case kRGB_565_SkColorType: |
| 55 shift = 1; | 55 shift = 1; |
| 56 break; | 56 break; |
| 57 case kN32_SkColorType: | 57 case kN32_SkColorType: |
| 58 shift = 2; | 58 shift = 2; |
| 59 break; | 59 break; |
| 60 case kRGBA_F16_SkColorType: |
| 61 shift = 3; |
| 62 break; |
| 60 default: | 63 default: |
| 61 return false; | 64 return false; |
| 62 } | 65 } |
| 63 | 66 |
| 64 if (kIgnoreRowBytesValue == rowBytes) { | 67 if (kIgnoreRowBytesValue == rowBytes) { |
| 65 return true; | 68 return true; |
| 66 } | 69 } |
| 67 | 70 |
| 68 uint64_t minRB = (uint64_t)info.width() << shift; | 71 uint64_t minRB = (uint64_t)info.width() << shift; |
| 69 if (minRB > rowBytes) { | 72 if (minRB > rowBytes) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 199 } |
| 197 if (rowBytes) { | 200 if (rowBytes) { |
| 198 SkASSERT(pr->rowBytes() == rowBytes); | 201 SkASSERT(pr->rowBytes() == rowBytes); |
| 199 } | 202 } |
| 200 return new SkSurface_Raster(pr, props); | 203 return new SkSurface_Raster(pr, props); |
| 201 } | 204 } |
| 202 | 205 |
| 203 SkSurface* SkSurface::NewRaster(const SkImageInfo& info, const SkSurfaceProps* p
rops) { | 206 SkSurface* SkSurface::NewRaster(const SkImageInfo& info, const SkSurfaceProps* p
rops) { |
| 204 return NewRaster(info, 0, props); | 207 return NewRaster(info, 0, props); |
| 205 } | 208 } |
| OLD | NEW |