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

Unified Diff: src/pdf/SkPDFShader.cpp

Issue 1848383002: SkPDF: properly dedup bitmaps in shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-01 (Friday) 14:35:15 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 | « src/pdf/SkBitmapKey.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFShader.cpp
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index 5dd94e2c68138317b90527b0642aece103d158ac..d6ed6632b5c23117f7e7e69f8b6f0dd2ff4140f8 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -430,7 +430,7 @@ public:
SkIRect fBBox;
SkBitmap fImage;
- uint32_t fPixelGeneration;
+ SkBitmapKey fBitmapKey;
SkShader::TileMode fImageTileModes[2];
State(SkShader* shader, const SkMatrix& canvasTransform,
@@ -1046,8 +1046,8 @@ bool SkPDFShader::State::operator==(const SkPDFShader::State& b) const {
}
if (fType == SkShader::kNone_GradientType) {
- if (fPixelGeneration != b.fPixelGeneration ||
- fPixelGeneration == 0 ||
+ if (fBitmapKey != b.fBitmapKey ||
+ fBitmapKey.id() == 0 ||
fImageTileModes[0] != b.fImageTileModes[0] ||
fImageTileModes[1] != b.fImageTileModes[1]) {
return false;
@@ -1093,8 +1093,7 @@ bool SkPDFShader::State::operator==(const SkPDFShader::State& b) const {
SkPDFShader::State::State(SkShader* shader, const SkMatrix& canvasTransform,
const SkIRect& bbox, SkScalar rasterScale)
: fCanvasTransform(canvasTransform),
- fBBox(bbox),
- fPixelGeneration(0) {
+ fBBox(bbox) {
fInfo.fColorCount = 0;
fInfo.fColors = nullptr;
fInfo.fColorOffsets = nullptr;
@@ -1148,7 +1147,7 @@ SkPDFShader::State::State(SkShader* shader, const SkMatrix& canvasTransform,
fShaderTransform.setTranslate(shaderRect.x(), shaderRect.y());
fShaderTransform.preScale(1 / scale.width(), 1 / scale.height());
}
- fPixelGeneration = fImage.getGenerationID();
+ fBitmapKey = SkBitmapKey(fImage);
} else {
AllocateGradientInfoStorage();
shader->asAGradient(&fInfo);
« no previous file with comments | « src/pdf/SkBitmapKey.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698