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

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

Issue 1813793002: images with offset bitmap don't share genid (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-03-17 (Thursday) 12:13:54 EDT Created 4 years, 9 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 | tests/image-bitmap.cpp » ('j') | tests/image-bitmap.cpp » ('J')
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 // exposed for SkSurface_Raster via SkNewImageFromPixelRef 76 // exposed for SkSurface_Raster via SkNewImageFromPixelRef
77 SkImage_Raster(const SkImageInfo&, SkPixelRef*, const SkIPoint& origin, size _t rowBytes); 77 SkImage_Raster(const SkImageInfo&, SkPixelRef*, const SkIPoint& origin, size _t rowBytes);
78 78
79 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } 79 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); }
80 80
81 bool isOpaque() const override; 81 bool isOpaque() const override;
82 bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const override; 82 bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const override;
83 83
84 SkImage_Raster(const SkBitmap& bm) 84 SkImage_Raster(const SkBitmap& bm)
85 : INHERITED(bm.width(), bm.height(), bm.getGenerationID()) 85 : INHERITED(bm.width(), bm.height(),
86 bm.pixelRefOrigin().isZero()
87 ? bm.getGenerationID()
88 : (uint32_t)kNeedNewImageUniqueID)
86 , fBitmap(bm) 89 , fBitmap(bm)
87 { 90 {
88 if (bm.pixelRef()->isPreLocked()) { 91 if (bm.pixelRef()->isPreLocked()) {
89 // we only preemptively lock if there is no chance of triggering som ething expensive 92 // we only preemptively lock if there is no chance of triggering som ething expensive
90 // like a lazy decode or imagegenerator. PreLocked means it is flat pixels already. 93 // like a lazy decode or imagegenerator. PreLocked means it is flat pixels already.
91 fBitmap.lockPixels(); 94 fBitmap.lockPixels();
92 } 95 }
93 SkASSERT(fBitmap.isImmutable()); 96 SkASSERT(fBitmap.isImmutable());
94 } 97 }
95 98
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // pixelref since the caller might call setImmutable() themselves 281 // pixelref since the caller might call setImmutable() themselves
279 // (thus changing our state). 282 // (thus changing our state).
280 if (fBitmap.isImmutable()) { 283 if (fBitmap.isImmutable()) {
281 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); 284 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes());
282 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); 285 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin());
283 return true; 286 return true;
284 } 287 }
285 } 288 }
286 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); 289 return this->INHERITED::onAsLegacyBitmap(bitmap, mode);
287 } 290 }
OLDNEW
« no previous file with comments | « no previous file | tests/image-bitmap.cpp » ('j') | tests/image-bitmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698