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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 return fBitmap.isOpaque(); | 263 return fBitmap.isOpaque(); |
264 } | 264 } |
265 | 265 |
266 bool SkImage_Raster::onAsLegacyBitmap(SkBitmap* bitmap, LegacyBitmapMode mode) c
onst { | 266 bool SkImage_Raster::onAsLegacyBitmap(SkBitmap* bitmap, LegacyBitmapMode mode) c
onst { |
267 if (kRO_LegacyBitmapMode == mode) { | 267 if (kRO_LegacyBitmapMode == mode) { |
268 // When we're a snapshot from a surface, our bitmap may not be marked im
mutable | 268 // When we're a snapshot from a surface, our bitmap may not be marked im
mutable |
269 // even though logically always we are, but in that case we can't physic
ally share our | 269 // even though logically always we are, but in that case we can't physic
ally share our |
270 // pixelref since the caller might call setImmutable() themselves | 270 // pixelref since the caller might call setImmutable() themselves |
271 // (thus changing our state). | 271 // (thus changing our state). |
272 if (fBitmap.isImmutable()) { | 272 if (fBitmap.isImmutable()) { |
273 bitmap->setInfo(fBitmap.info()); | 273 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); |
274 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); | 274 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); |
275 return true; | 275 return true; |
276 } | 276 } |
277 } | 277 } |
278 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); | 278 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); |
279 } | 279 } |
OLD | NEW |