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

Unified Diff: src/pdf/SkPDFCanon.cpp

Issue 918813002: PDF: Add (low-memory) SkPDFBitmap class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: mutable bitmaps get copied Created 5 years, 10 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/SkPDFCanon.h ('k') | src/pdf/SkPDFImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFCanon.cpp
diff --git a/src/pdf/SkPDFCanon.cpp b/src/pdf/SkPDFCanon.cpp
index 6b52018ce41e81ae08c6b8688f43b6846def3d19..268a53a897ab8a5cdf7b321bf2faddca9fad6c2f 100644
--- a/src/pdf/SkPDFCanon.cpp
+++ b/src/pdf/SkPDFCanon.cpp
@@ -6,6 +6,7 @@
*/
#include "SkLazyPtr.h"
+#include "SkPDFBitmap.h"
#include "SkPDFCanon.h"
#include "SkPDFFont.h"
#include "SkPDFGraphicState.h"
@@ -16,10 +17,12 @@
SK_DECLARE_STATIC_MUTEX(gSkPDFCanonFontMutex);
SK_DECLARE_STATIC_MUTEX(gSkPDFCanonShaderMutex);
SK_DECLARE_STATIC_MUTEX(gSkPDFCanonPaintMutex);
+SK_DECLARE_STATIC_MUTEX(gSkPDFCanonBitmapMutex);
SkBaseMutex& SkPDFCanon::GetFontMutex() { return gSkPDFCanonFontMutex; }
SkBaseMutex& SkPDFCanon::GetShaderMutex() { return gSkPDFCanonShaderMutex; }
SkBaseMutex& SkPDFCanon::GetPaintMutex() { return gSkPDFCanonPaintMutex; }
+SkBaseMutex& SkPDFCanon::GetBitmapMutex() { return gSkPDFCanonBitmapMutex; }
SkPDFCanon::SkPDFCanon() {}
@@ -168,3 +171,20 @@ void SkPDFCanon::removeGraphicState(SkPDFGraphicState* pdfGraphicState) {
assert_mutex_held(this, gSkPDFCanonPaintMutex);
SkAssertResult(remove_item(&fGraphicStateRecords, pdfGraphicState));
}
+
+////////////////////////////////////////////////////////////////////////////////
+
+SkPDFBitmap* SkPDFCanon::findBitmap(const SkBitmap& bm) const {
+ assert_mutex_held(this, gSkPDFCanonBitmapMutex);
+ return find_item(fBitmapRecords, bm);
+}
+
+void SkPDFCanon::addBitmap(SkPDFBitmap* pdfBitmap) {
+ assert_mutex_held(this, gSkPDFCanonBitmapMutex);
+ fBitmapRecords.push(assert_ptr(pdfBitmap));
+}
+
+void SkPDFCanon::removeBitmap(SkPDFBitmap* pdfBitmap) {
+ assert_mutex_held(this, gSkPDFCanonBitmapMutex);
+ SkAssertResult(remove_item(&fBitmapRecords, pdfBitmap));
+}
« no previous file with comments | « src/pdf/SkPDFCanon.h ('k') | src/pdf/SkPDFImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698