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 "SkImage_Base.h" | 8 #include "SkImage_Base.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 if (kUnknown_SkColorType == info.colorType()) { | 42 if (kUnknown_SkColorType == info.colorType()) { |
43 return false; | 43 return false; |
44 } | 44 } |
45 | 45 |
46 const bool needsCT = kIndex_8_SkColorType == info.colorType(); | 46 const bool needsCT = kIndex_8_SkColorType == info.colorType(); |
47 if (needsCT != hasColorTable) { | 47 if (needsCT != hasColorTable) { |
48 return false; | 48 return false; |
49 } | 49 } |
50 | 50 |
51 if (rowBytes < SkImageMinRowBytes(info)) { | 51 if (rowBytes < info.minRowBytes()) { |
52 return false; | 52 return false; |
53 } | 53 } |
54 | 54 |
55 size_t size = info.getSafeSize(rowBytes); | 55 size_t size = info.getSafeSize(rowBytes); |
56 if (0 == size) { | 56 if (0 == size) { |
57 return false; | 57 return false; |
58 } | 58 } |
59 | 59 |
60 if (minSize) { | 60 if (minSize) { |
61 *minSize = size; | 61 *minSize = size; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // pixelref since the caller might call setImmutable() themselves | 285 // pixelref since the caller might call setImmutable() themselves |
286 // (thus changing our state). | 286 // (thus changing our state). |
287 if (fBitmap.isImmutable()) { | 287 if (fBitmap.isImmutable()) { |
288 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); | 288 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); |
289 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); | 289 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); |
290 return true; | 290 return true; |
291 } | 291 } |
292 } | 292 } |
293 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); | 293 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); |
294 } | 294 } |
OLD | NEW |