OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "skia/ext/bitmap_platform_device.h" | 8 #include "skia/ext/bitmap_platform_device.h" |
9 | 9 |
10 // TODO(reveman): a lot of unnecessary duplication of code from | 10 // TODO(reveman): a lot of unnecessary duplication of code from |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 PlatformCanvas::~PlatformCanvas() { | 62 PlatformCanvas::~PlatformCanvas() { |
63 } | 63 } |
64 | 64 |
65 #if defined(WIN32) | 65 #if defined(WIN32) |
66 bool PlatformCanvas::initialize(int width, | 66 bool PlatformCanvas::initialize(int width, |
67 int height, | 67 int height, |
68 bool is_opaque, | 68 bool is_opaque, |
69 HANDLE shared_section) { | 69 HANDLE shared_section) { |
70 // Use platform specific device for shared_section. | 70 // Use platform specific device for shared_section. |
71 if (shared_section) { | 71 if (shared_section) |
72 if (initializeWithDevice(BitmapPlatformDevice::Create(width, | 72 return initializeWithDevice(BitmapPlatformDevice::Create( |
73 height, | 73 width, height, is_opaque, shared_section)); |
74 is_opaque, | |
75 shared_section))) | |
76 return true; | |
77 | |
78 // TODO(reveman): move the failure investigation from | |
79 // platform_canvas_win.cc to bitmap_platform_device_win.cc. | |
80 return false; | |
81 } | |
82 | 74 |
83 return initializeWithDevice(new SkDevice( | 75 return initializeWithDevice(new SkDevice( |
84 SkBitmap::kARGB_8888_Config, width, height, is_opaque)); | 76 SkBitmap::kARGB_8888_Config, width, height, is_opaque)); |
85 } | 77 } |
86 #elif defined(__APPLE__) | 78 #elif defined(__APPLE__) |
87 bool PlatformCanvas::initialize(int width, | 79 bool PlatformCanvas::initialize(int width, |
88 int height, | 80 int height, |
89 bool is_opaque, | 81 bool is_opaque, |
90 uint8_t* data) { | 82 uint8_t* data) { |
91 // Use platform specific device for data. | 83 // Use platform specific device for data. |
(...skipping 20 matching lines...) Expand all Loading... |
112 if (data) | 104 if (data) |
113 return initializeWithDevice(BitmapPlatformDevice::Create( | 105 return initializeWithDevice(BitmapPlatformDevice::Create( |
114 width, height, is_opaque, data)); | 106 width, height, is_opaque, data)); |
115 | 107 |
116 return initializeWithDevice(new SkDevice( | 108 return initializeWithDevice(new SkDevice( |
117 SkBitmap::kARGB_8888_Config, width, height, is_opaque)); | 109 SkBitmap::kARGB_8888_Config, width, height, is_opaque)); |
118 } | 110 } |
119 #endif | 111 #endif |
120 | 112 |
121 } // namespace skia | 113 } // namespace skia |
OLD | NEW |