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

Unified Diff: printing/metafile_skia_wrapper.cc

Issue 10387022: A better fix for scaling issue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | « printing/metafile_skia_wrapper.h ('k') | printing/printing.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/metafile_skia_wrapper.cc
===================================================================
--- printing/metafile_skia_wrapper.cc (revision 135774)
+++ printing/metafile_skia_wrapper.cc (working copy)
@@ -13,6 +13,7 @@
namespace {
const char* kMetafileKey = "CrMetafile";
+const char* kCustomScaleKey = "CrCustomScale";
} // namespace
@@ -38,6 +39,25 @@
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(Metafile* metafile)
: metafile_(metafile) {
}
« no previous file with comments | « printing/metafile_skia_wrapper.h ('k') | printing/printing.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698