| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include "cc/paint/paint_canvas.h" |
| |
| #include "base/memory/ptr_util.h" |
| #include "cc/paint/paint_record.h" |
| #include "cc/paint/paint_recorder.h" |
| #include "third_party/skia/include/core/SkAnnotation.h" |
| #include "third_party/skia/include/core/SkMetaData.h" |
| |
| #if defined(OS_MACOSX) |
| namespace { |
| const char kIsPreviewMetafileKey[] = "CrIsPreviewMetafile"; |
| } |
| #endif |
| |
| namespace cc { |
| |
| bool ToPixmap(PaintCanvas* canvas, SkPixmap* output) { |
| return canvas->ToPixmap(output); |
| } |
| |
| #if defined(OS_MACOSX) |
| void SetIsPreviewMetafile(PaintCanvas* canvas, bool is_preview) { |
| SkMetaData& meta = canvas->getMetaData(); |
| meta.setBool(kIsPreviewMetafileKey, is_preview); |
| } |
| |
| bool IsPreviewMetafile(PaintCanvas* canvas) { |
| bool value; |
| SkMetaData& meta = canvas->getMetaData(); |
| if (!meta.findBool(kIsPreviewMetafileKey, &value)) |
| value = false; |
| return value; |
| } |
| #endif |
| |
| void PaintCanvasAnnotateRectWithURL(PaintCanvas* canvas, |
| const SkRect& rect, |
| SkData* data) { |
| canvas->AnnotateRectWithURL(rect, data); |
| } |
| |
| void PaintCanvasAnnotateNamedDestination(PaintCanvas* canvas, |
| const SkPoint& point, |
| SkData* data) { |
| canvas->AnnotateNamedDestination(point, data); |
| } |
| |
| void PaintCanvasAnnotateLinkToDestination(PaintCanvas* canvas, |
| const SkRect& rect, |
| SkData* data) { |
| canvas->AnnotateLinkToDestination(rect, data); |
| } |
| |
| } // namespace cc |