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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 SkImage_Raster(const SkBitmap& bm, const SkSurfaceProps* props, bool lockPix
els = false) | 84 SkImage_Raster(const SkBitmap& bm, const SkSurfaceProps* props, bool lockPix
els = false) |
85 : INHERITED(bm.width(), bm.height(), bm.getGenerationID(), props) | 85 : INHERITED(bm.width(), bm.height(), bm.getGenerationID(), props) |
86 , fBitmap(bm) { | 86 , fBitmap(bm) { |
87 if (lockPixels) { | 87 if (lockPixels) { |
88 fBitmap.lockPixels(); | 88 fBitmap.lockPixels(); |
89 } | 89 } |
90 SkASSERT(fBitmap.isImmutable()); | 90 SkASSERT(fBitmap.isImmutable()); |
91 } | 91 } |
92 | 92 |
93 private: | 93 private: |
94 SkImage_Raster() : INHERITED(0, 0, fBitmap.getGenerationID(), NULL) { | 94 SkImage_Raster() : INHERITED(0, 0, kNeedNewImageUniqueID, NULL) { |
95 fBitmap.setImmutable(); | 95 fBitmap.setImmutable(); |
96 } | 96 } |
97 | 97 |
98 SkBitmap fBitmap; | 98 SkBitmap fBitmap; |
99 | 99 |
100 typedef SkImage_Base INHERITED; | 100 typedef SkImage_Base INHERITED; |
101 }; | 101 }; |
102 | 102 |
103 /////////////////////////////////////////////////////////////////////////////// | 103 /////////////////////////////////////////////////////////////////////////////// |
104 | 104 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // pixelref since the caller might call setImmutable() themselves | 278 // pixelref since the caller might call setImmutable() themselves |
279 // (thus changing our state). | 279 // (thus changing our state). |
280 if (fBitmap.isImmutable()) { | 280 if (fBitmap.isImmutable()) { |
281 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); | 281 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); |
282 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); | 282 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); |
283 return true; | 283 return true; |
284 } | 284 } |
285 } | 285 } |
286 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); | 286 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); |
287 } | 287 } |
OLD | NEW |