diff options
author | twiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 15:53:12 +0000 |
---|---|---|
committer | twiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 15:53:12 +0000 |
commit | e414727ea30e03a5d4582bdbba42d67327605273 (patch) | |
tree | 58746c063aea418e36d5a618c67bdf1bec9e7409 /printing | |
parent | 33986d3ecde79d6a1bdf2b0edd17fc13bc2cc78b (diff) | |
download | chromium_src-e414727ea30e03a5d4582bdbba42d67327605273.zip chromium_src-e414727ea30e03a5d4582bdbba42d67327605273.tar.gz chromium_src-e414727ea30e03a5d4582bdbba42d67327605273.tar.bz2 |
This change implements a first pass in the effort to remove the dependency of PlatformDevice within Chrome. The Skia library now provides multiple back-ends for the SkDevice class, so PlatformDevice's inheritance of SkDevice, and the assumption of instances of PlatformDevice limits the use of these new back-ends.
A new set of helper functions is provided for the PlatformDevice entry points. Upon construction of a PlatformDevice, a pointer to the interface is cached in the parent SkDevice's SkMetaData. The new helper functions forward calls to the interface cached in the metadata.
BUG=NONE
TEST=NONE
Review URL: http://codereview.chromium.org/7019013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86625 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r-- | printing/emf_win.cc | 2 | ||||
-rw-r--r-- | printing/emf_win.h | 2 | ||||
-rw-r--r-- | printing/image_win.cc | 2 | ||||
-rw-r--r-- | printing/metafile.h | 6 | ||||
-rw-r--r-- | printing/pdf_metafile_cairo_linux.cc | 2 | ||||
-rw-r--r-- | printing/pdf_metafile_cairo_linux.h | 3 | ||||
-rw-r--r-- | printing/pdf_metafile_cg_mac.cc | 2 | ||||
-rw-r--r-- | printing/pdf_metafile_cg_mac.h | 2 | ||||
-rw-r--r-- | printing/pdf_metafile_skia.cc | 2 | ||||
-rw-r--r-- | printing/pdf_metafile_skia.h | 3 | ||||
-rw-r--r-- | printing/printed_document_win.cc | 2 | ||||
-rw-r--r-- | printing/printing_context_win.cc | 4 |
12 files changed, 16 insertions, 16 deletions
diff --git a/printing/emf_win.cc b/printing/emf_win.cc index 40f4dc8..0f40496 100644 --- a/printing/emf_win.cc +++ b/printing/emf_win.cc @@ -403,7 +403,7 @@ bool Emf::Record::SafePlayback(const XFORM* base_matrix) const { return res; } -skia::PlatformDevice* Emf::StartPageForVectorCanvas( +SkDevice* Emf::StartPageForVectorCanvas( const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor) { if (!StartPage(page_size, content_area, scale_factor)) diff --git a/printing/emf_win.h b/printing/emf_win.h index 02a1958..f7e0ed5 100644 --- a/printing/emf_win.h +++ b/printing/emf_win.h @@ -45,7 +45,7 @@ class Emf : public Metafile { virtual bool Init(); virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size); - virtual skia::PlatformDevice* StartPageForVectorCanvas( + virtual SkDevice* StartPageForVectorCanvas( const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor); // Inserts a custom GDICOMMENT records indicating StartPage/EndPage calls diff --git a/printing/image_win.cc b/printing/image_win.cc index c9ad1fe..de731e0 100644 --- a/printing/image_win.cc +++ b/printing/image_win.cc @@ -69,7 +69,7 @@ bool Image::LoadMetafile(const Metafile& metafile) { DCHECK(bitmap); DCHECK(SelectObject(hdc, bitmap)); - skia::PlatformDevice::InitializeDC(hdc); + skia::InitializeDC(hdc); bool success = metafile.Playback(hdc, NULL); diff --git a/printing/metafile.h b/printing/metafile.h index c155fbc..84c0556 100644 --- a/printing/metafile.h +++ b/printing/metafile.h @@ -25,9 +25,7 @@ class Rect; class Size; } -namespace skia { -class PlatformDevice; -} +class SkDevice; #if defined(OS_CHROMEOS) namespace base { @@ -56,7 +54,7 @@ class Metafile { // This method calls StartPage and then returns an appropriate // VectorPlatformDevice implementation bound to the context created by // StartPage or NULL on error. - virtual skia::PlatformDevice* StartPageForVectorCanvas( + virtual SkDevice* StartPageForVectorCanvas( const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor) = 0; diff --git a/printing/pdf_metafile_cairo_linux.cc b/printing/pdf_metafile_cairo_linux.cc index 435a33c..5102a78 100644 --- a/printing/pdf_metafile_cairo_linux.cc +++ b/printing/pdf_metafile_cairo_linux.cc @@ -118,7 +118,7 @@ bool PdfMetafileCairo::InitFromData(const void* src_buffer, return true; } -skia::PlatformDevice* PdfMetafileCairo::StartPageForVectorCanvas( +SkDevice* PdfMetafileCairo::StartPageForVectorCanvas( const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor) { if (!StartPage(page_size, content_area, scale_factor)) diff --git a/printing/pdf_metafile_cairo_linux.h b/printing/pdf_metafile_cairo_linux.h index 8badf5c..6f07ae0 100644 --- a/printing/pdf_metafile_cairo_linux.h +++ b/printing/pdf_metafile_cairo_linux.h @@ -36,9 +36,10 @@ class PdfMetafileCairo : public Metafile { // continues on the surface returned by a previous call to Init(). virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size); - virtual skia::PlatformDevice* StartPageForVectorCanvas( + virtual SkDevice* StartPageForVectorCanvas( const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor); + virtual bool StartPage(const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor); diff --git a/printing/pdf_metafile_cg_mac.cc b/printing/pdf_metafile_cg_mac.cc index 9320b9e..4668b2d 100644 --- a/printing/pdf_metafile_cg_mac.cc +++ b/printing/pdf_metafile_cg_mac.cc @@ -118,7 +118,7 @@ bool PdfMetafileCg::InitFromData(const void* src_buffer, return true; } -skia::PlatformDevice* PdfMetafileCg::StartPageForVectorCanvas( +SkDevice* PdfMetafileCg::StartPageForVectorCanvas( const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor) { NOTIMPLEMENTED(); diff --git a/printing/pdf_metafile_cg_mac.h b/printing/pdf_metafile_cg_mac.h index bffbce5..5a7f56d 100644 --- a/printing/pdf_metafile_cg_mac.h +++ b/printing/pdf_metafile_cg_mac.h @@ -35,7 +35,7 @@ class PdfMetafileCg : public Metafile, public base::ThreadChecker { virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size); // Not implemented on mac. - virtual skia::PlatformDevice* StartPageForVectorCanvas( + virtual SkDevice* StartPageForVectorCanvas( const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor); virtual bool StartPage(const gfx::Size& page_size, diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc index 80d4931..f76eb70 100644 --- a/printing/pdf_metafile_skia.cc +++ b/printing/pdf_metafile_skia.cc @@ -36,7 +36,7 @@ bool PdfMetafileSkia::InitFromData(const void* src_buffer, return data_->pdf_stream_.write(src_buffer, src_buffer_size); } -skia::PlatformDevice* PdfMetafileSkia::StartPageForVectorCanvas( +SkDevice* PdfMetafileSkia::StartPageForVectorCanvas( const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor) { DCHECK(data_->current_page_.get() == NULL); diff --git a/printing/pdf_metafile_skia.h b/printing/pdf_metafile_skia.h index 3138114..0ad2afb 100644 --- a/printing/pdf_metafile_skia.h +++ b/printing/pdf_metafile_skia.h @@ -29,10 +29,11 @@ class PdfMetafileSkia : public Metafile { virtual bool Init(); virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size); - virtual skia::PlatformDevice* StartPageForVectorCanvas( + virtual SkDevice* StartPageForVectorCanvas( const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor); + virtual bool StartPage(const gfx::Size& page_size, const gfx::Rect& content_area, const float& scale_factor); diff --git a/printing/printed_document_win.cc b/printing/printed_document_win.cc index cb25fdef..ef0c686 100644 --- a/printing/printed_document_win.cc +++ b/printing/printed_document_win.cc @@ -98,7 +98,7 @@ void PrintedDocument::RenderPrintedPage( // the device context. int saved_state = SaveDC(context); DCHECK_NE(saved_state, 0); - skia::PlatformDevice::InitializeDC(context); + skia::InitializeDC(context); { // Save the state (again) to apply the necessary world transformation. int saved_state = SaveDC(context); diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc index fd0be8c..07ac20b 100644 --- a/printing/printing_context_win.cc +++ b/printing/printing_context_win.cc @@ -17,7 +17,7 @@ #include "printing/print_job_constants.h" #include "printing/print_settings_initializer_win.h" #include "printing/printed_document.h" -#include "skia/ext/platform_device_win.h" +#include "skia/ext/platform_device.h" using base::Time; @@ -549,7 +549,7 @@ bool PrintingContextWin::InitializeSettings(const DEVMODE& dev_mode, const PRINTPAGERANGE* ranges, int number_ranges, bool selection_only) { - skia::PlatformDevice::InitializeDC(context_); + skia::InitializeDC(context_); DCHECK(GetDeviceCaps(context_, CLIPCAPS)); DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_STRETCHDIB); DCHECK(GetDeviceCaps(context_, RASTERCAPS) & RC_BITMAP64); |