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

Unified 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) 17:29:58 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/image-bitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Raster.cpp
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 764d5eb2906cc9f64e2ff4cb2baac4c5ea61cec6..59760c7aee394aacda8a0eb5e3618740323e9dfa 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -20,6 +20,14 @@
#include "SkGrPriv.h"
#endif
+// fixes https://bug.skia.org/5096
+static bool is_not_subset(const SkBitmap& bm) {
+ SkASSERT(bm.pixelRef());
+ SkISize dim = bm.pixelRef()->info().dimensions();
+ SkASSERT(dim != bm.dimensions() || bm.pixelRefOrigin().isZero());
+ return dim == bm.dimensions();
+}
+
class SkImage_Raster : public SkImage_Base {
public:
static bool ValidArgs(const Info& info, size_t rowBytes, bool hasColorTable,
@@ -82,7 +90,9 @@ public:
bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const override;
SkImage_Raster(const SkBitmap& bm)
- : INHERITED(bm.width(), bm.height(), bm.getGenerationID())
+ : INHERITED(bm.width(), bm.height(),
+ is_not_subset(bm) ? bm.getGenerationID()
+ : (uint32_t)kNeedNewImageUniqueID)
, fBitmap(bm)
{
if (bm.pixelRef()->isPreLocked()) {
« no previous file with comments | « no previous file | tests/image-bitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698