| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "skia/ext/platform_canvas.h" | 5 #include "skia/ext/platform_canvas.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "skia/ext/bitmap_platform_device.h" | 8 #include "skia/ext/bitmap_platform_device.h" |
| 9 #include "skia/ext/platform_device.h" | 9 #include "skia/ext/platform_device.h" |
| 10 #include "third_party/skia/include/core/SkMetaData.h" | 10 #include "third_party/skia/include/core/SkMetaData.h" |
| 11 #include "third_party/skia/include/core/SkTypes.h" | 11 #include "third_party/skia/include/core/SkTypes.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 #if defined(OS_MACOSX) | 15 #if defined(OS_MACOSX) |
| 16 const char kIsPreviewMetafileKey[] = "CrIsPreviewMetafile"; | 16 const char kIsPreviewMetafileKey[] = "CrIsPreviewMetafile"; |
| 17 #endif | |
| 18 | 17 |
| 19 void SetBoolMetaData(const SkCanvas& canvas, const char* key, bool value) { | 18 void SetBoolMetaData(const SkCanvas& canvas, const char* key, bool value) { |
| 20 SkMetaData& meta = skia::GetMetaData(canvas); | 19 SkMetaData& meta = skia::GetMetaData(canvas); |
| 21 meta.setBool(key, value); | 20 meta.setBool(key, value); |
| 22 } | 21 } |
| 23 | 22 |
| 24 bool GetBoolMetaData(const SkCanvas& canvas, const char* key) { | 23 bool GetBoolMetaData(const SkCanvas& canvas, const char* key) { |
| 25 bool value; | 24 bool value; |
| 26 SkMetaData& meta = skia::GetMetaData(canvas); | 25 SkMetaData& meta = skia::GetMetaData(canvas); |
| 27 if (!meta.findBool(key, &value)) | 26 if (!meta.findBool(key, &value)) |
| 28 value = false; | 27 value = false; |
| 29 return value; | 28 return value; |
| 30 } | 29 } |
| 30 #endif |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 namespace skia { | 34 namespace skia { |
| 35 | 35 |
| 36 SkBaseDevice* GetTopDevice(const SkCanvas& canvas) { | 36 SkBaseDevice* GetTopDevice(const SkCanvas& canvas) { |
| 37 return canvas.getTopDevice(true); | 37 return canvas.getTopDevice(true); |
| 38 } | 38 } |
| 39 | 39 |
| 40 SkBitmap ReadPixels(SkCanvas* canvas) { | 40 SkBitmap ReadPixels(SkCanvas* canvas) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 SkBaseDevice* device = GetTopDevice(canvas); | 125 SkBaseDevice* device = GetTopDevice(canvas); |
| 126 PlatformDevice* platform_device = GetPlatformDevice(device); | 126 PlatformDevice* platform_device = GetPlatformDevice(device); |
| 127 return platform_device ? platform_device->GetBitmapContext() : | 127 return platform_device ? platform_device->GetBitmapContext() : |
| 128 nullptr; | 128 nullptr; |
| 129 } | 129 } |
| 130 | 130 |
| 131 #endif | 131 #endif |
| 132 | 132 |
| 133 | 133 |
| 134 } // namespace skia | 134 } // namespace skia |
| OLD | NEW |