Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: src/image/SkImage_Raster.cpp

Issue 1264773004: fix empty image constructor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698