diff options
author | pkasting <pkasting@chromium.org> | 2014-10-09 14:30:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-09 21:30:15 +0000 |
commit | 46a6291e7b4e7c7367daf4e5fb1a33537f776813 (patch) | |
tree | 308d85c00a1076c0c12fcf8d306630ef39e47929 /printing | |
parent | 7cc29ce343a235f9067545ddd19ba2d982c4595f (diff) | |
download | chromium_src-46a6291e7b4e7c7367daf4e5fb1a33537f776813.zip chromium_src-46a6291e7b4e7c7367daf4e5fb1a33537f776813.tar.gz chromium_src-46a6291e7b4e7c7367daf4e5fb1a33537f776813.tar.bz2 |
Change PDF scaling factor from double to float.
This ultimate consumers of this want a float anyway, so changing to be a float
all the way through is less misleading. This also avoids some "value possibly
truncated" warnings (currently disabled) on MSVC.
This also removes a couple of scale-related functions in metafile_skia_wrapper.*
that seem to be entirely unused.
BUG=none
TEST=none
Review URL: https://codereview.chromium.org/641923002
Cr-Commit-Position: refs/heads/master@{#298980}
Diffstat (limited to 'printing')
-rw-r--r-- | printing/metafile_skia_wrapper.cc | 20 | ||||
-rw-r--r-- | printing/metafile_skia_wrapper.h | 4 | ||||
-rw-r--r-- | printing/printed_document.cc | 2 | ||||
-rw-r--r-- | printing/printed_document.h | 2 | ||||
-rw-r--r-- | printing/printed_document_win.cc | 4 | ||||
-rw-r--r-- | printing/printed_page.h | 6 |
6 files changed, 7 insertions, 31 deletions
diff --git a/printing/metafile_skia_wrapper.cc b/printing/metafile_skia_wrapper.cc index 3657bc1..90a9c7c 100644 --- a/printing/metafile_skia_wrapper.cc +++ b/printing/metafile_skia_wrapper.cc @@ -14,7 +14,6 @@ namespace printing { namespace { const char* kMetafileKey = "CrMetafile"; -const char* kCustomScaleKey = "CrCustomScale"; } // namespace @@ -40,25 +39,6 @@ PdfMetafileSkia* MetafileSkiaWrapper::GetMetafileFromCanvas( return static_cast<MetafileSkiaWrapper*>(value)->metafile_; } -// static -void MetafileSkiaWrapper::SetCustomScaleOnCanvas(const SkCanvas& canvas, - double scale) { - SkMetaData& meta = skia::getMetaData(canvas); - meta.setScalar(kCustomScaleKey, SkFloatToScalar(scale)); -} - -// static -bool MetafileSkiaWrapper::GetCustomScaleOnCanvas(const SkCanvas& canvas, - double* scale) { - SkMetaData& meta = skia::getMetaData(canvas); - SkScalar value; - if (!meta.findScalar(kCustomScaleKey, &value)) - return false; - - *scale = SkScalarToFloat(value); - return true; -} - MetafileSkiaWrapper::MetafileSkiaWrapper(PdfMetafileSkia* metafile) : metafile_(metafile) { } diff --git a/printing/metafile_skia_wrapper.h b/printing/metafile_skia_wrapper.h index fdf5f75..6236e85 100644 --- a/printing/metafile_skia_wrapper.h +++ b/printing/metafile_skia_wrapper.h @@ -25,10 +25,6 @@ class PRINTING_EXPORT MetafileSkiaWrapper : public SkRefCnt { static PdfMetafileSkia* GetMetafileFromCanvas(const SkCanvas& canvas); - // Methods to set and retrieve custom scale factor for metafile from canvas. - static void SetCustomScaleOnCanvas(const SkCanvas& canvas, double scale); - static bool GetCustomScaleOnCanvas(const SkCanvas& canvas, double* scale); - private: explicit MetafileSkiaWrapper(PdfMetafileSkia* metafile); diff --git a/printing/printed_document.cc b/printing/printed_document.cc index 63fce8f..62fbef8 100644 --- a/printing/printed_document.cc +++ b/printing/printed_document.cc @@ -113,7 +113,7 @@ PrintedDocument::~PrintedDocument() { void PrintedDocument::SetPage(int page_number, scoped_ptr<MetafilePlayer> metafile, #if defined(OS_WIN) - double shrink, + float shrink, #endif // OS_WIN const gfx::Size& paper_size, const gfx::Rect& page_rect) { diff --git a/printing/printed_document.h b/printing/printed_document.h index 47c9ec7..d309cc8 100644 --- a/printing/printed_document.h +++ b/printing/printed_document.h @@ -48,7 +48,7 @@ class PRINTING_EXPORT PrintedDocument void SetPage(int page_number, scoped_ptr<MetafilePlayer> metafile, #if defined(OS_WIN) - double shrink, + float shrink, #endif // OS_WIN const gfx::Size& paper_size, const gfx::Rect& page_rect); diff --git a/printing/printed_document_win.cc b/printing/printed_document_win.cc index 5da1151..3c6b715 100644 --- a/printing/printed_document_win.cc +++ b/printing/printed_document_win.cc @@ -16,11 +16,11 @@ namespace { void SimpleModifyWorldTransform(HDC context, int offset_x, int offset_y, - double shrink_factor) { + float shrink_factor) { XFORM xform = { 0 }; xform.eDx = static_cast<float>(offset_x); xform.eDy = static_cast<float>(offset_y); - xform.eM11 = xform.eM22 = static_cast<float>(1. / shrink_factor); + xform.eM11 = xform.eM22 = 1.f / shrink_factor; BOOL res = ModifyWorldTransform(context, &xform, MWT_LEFTMULTIPLY); DCHECK_NE(res, 0); } diff --git a/printing/printed_page.h b/printing/printed_page.h index 0859502..de0395b 100644 --- a/printing/printed_page.h +++ b/printing/printed_page.h @@ -33,10 +33,10 @@ class PRINTING_EXPORT PrintedPage const gfx::Size& page_size() const { return page_size_; } const gfx::Rect& page_content_rect() const { return page_content_rect_; } #if defined(OS_WIN) - void set_shrink_factor(double shrink_factor) { + void set_shrink_factor(float shrink_factor) { shrink_factor_ = shrink_factor; } - double shrink_factor() const { return shrink_factor_; } + float shrink_factor() const { return shrink_factor_; } #endif // OS_WIN // Get page content rect adjusted based on @@ -57,7 +57,7 @@ class PRINTING_EXPORT PrintedPage #if defined(OS_WIN) // Shrink done in comparison to desired_dpi. - double shrink_factor_; + float shrink_factor_; #endif // OS_WIN // The physical page size. To support multiple page formats inside on print |