diff options
author | alexandrec <alexandrec@chromium.org> | 2015-02-02 00:08:58 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-02 08:09:47 +0000 |
commit | 04594412237a169189b3bd2b2f35d51bab6a391d (patch) | |
tree | d5c5dffae92f6963f9034b1f5214d8f99f84768b /pdf/pdfium | |
parent | d4543dd10a297c4fb11c5a47d3e61701c7878918 (diff) | |
download | chromium_src-04594412237a169189b3bd2b2f35d51bab6a391d.zip chromium_src-04594412237a169189b3bd2b2f35d51bab6a391d.tar.gz chromium_src-04594412237a169189b3bd2b2f35d51bab6a391d.tar.bz2 |
Switch the background color in PDF Viewer when using Material Design
BUG=110020
Review URL: https://codereview.chromium.org/871403005
Cr-Commit-Position: refs/heads/master@{#314108}
Diffstat (limited to 'pdf/pdfium')
-rw-r--r-- | pdf/pdfium/pdfium_engine.cc | 17 | ||||
-rw-r--r-- | pdf/pdfium/pdfium_engine.h | 5 |
2 files changed, 18 insertions, 4 deletions
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc index 4c5ba21..81fa059 100644 --- a/pdf/pdfium/pdfium_engine.cc +++ b/pdf/pdfium/pdfium_engine.cc @@ -599,6 +599,7 @@ PDFiumEngine::PDFiumEngine(PDFEngine::Client* client) most_visible_page_(-1), called_do_document_action_(false), render_grayscale_(false), + background_color_(0), progressive_paint_timeout_(0), getting_password_(false) { find_factory_.Initialize(this); @@ -2366,6 +2367,14 @@ int PDFiumEngine::GetNumberOfPages() { return pages_.size(); } +uint32 PDFiumEngine::GetBackgroundColor() { + return background_color_; +} + +void PDFiumEngine::SetBackgroundColor(uint32 background_color) { + background_color_ = background_color; +} + pp::VarArray PDFiumEngine::GetBookmarks() { pp::VarDictionary dict = TraverseBookmarks(doc_, NULL); // The root bookmark contains no useful information. @@ -2937,7 +2946,7 @@ void PDFiumEngine::FillPageSides(int progressive_index) { FPDFBitmap_FillRect(bitmap, left.x() - dirty_in_screen.x(), left.y() - dirty_in_screen.y(), left.width(), - left.height(), kBackgroundColor); + left.height(), background_color_); } if (page_rect.right() < document_size_.width()) { @@ -2951,7 +2960,7 @@ void PDFiumEngine::FillPageSides(int progressive_index) { FPDFBitmap_FillRect(bitmap, right.x() - dirty_in_screen.x(), right.y() - dirty_in_screen.y(), right.width(), - right.height(), kBackgroundColor); + right.height(), background_color_); } // Paint separator. @@ -2963,7 +2972,7 @@ void PDFiumEngine::FillPageSides(int progressive_index) { FPDFBitmap_FillRect(bitmap, bottom.x() - dirty_in_screen.x(), bottom.y() - dirty_in_screen.y(), bottom.width(), - bottom.height(), kBackgroundColor); + bottom.height(), background_color_); } void PDFiumEngine::PaintPageShadow(int progressive_index, @@ -3415,7 +3424,7 @@ void PDFiumEngine::DrawPageShadow(const pp::Rect& page_rc, // We need to check depth only to verify our copy of shadow matrix is correct. if (!page_shadow_.get() || page_shadow_->depth() != depth) - page_shadow_.reset(new ShadowMatrix(depth, factor, kBackgroundColor)); + page_shadow_.reset(new ShadowMatrix(depth, factor, background_color_)); DCHECK(!image_data->is_null()); DrawShadow(image_data, shadow_rect, page_rect, clip_rect, *page_shadow_); diff --git a/pdf/pdfium/pdfium_engine.h b/pdf/pdfium/pdfium_engine.h index d7b4835..331d37b 100644 --- a/pdf/pdfium/pdfium_engine.h +++ b/pdf/pdfium/pdfium_engine.h @@ -80,6 +80,8 @@ class PDFiumEngine : public PDFEngine, virtual bool HasPermission(DocumentPermission permission) const; virtual void SelectAll(); virtual int GetNumberOfPages(); + virtual uint32 GetBackgroundColor(); + virtual void SetBackgroundColor(uint32 backgroundColor); virtual pp::VarArray GetBookmarks(); virtual int GetNamedDestinationPage(const std::string& destination); virtual pp::VarDictionary GetNamedDestinations(); @@ -681,6 +683,9 @@ class PDFiumEngine : public PDFEngine, // Whether to render in grayscale or in color. bool render_grayscale_; + // Background color of the PDF. + uint32 background_color_; + // The link currently under the cursor. std::string link_under_cursor_; |