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

Side by Side Diff: skia/ext/platform_canvas.h

Issue 2622713002: Remove bitmap_platform_device_skia (Closed)
Patch Set: Win build fix Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « skia/ext/bitmap_platform_device_win.cc ('k') | skia/ext/platform_canvas.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef SKIA_EXT_PLATFORM_CANVAS_H_ 5 #ifndef SKIA_EXT_PLATFORM_CANVAS_H_
6 #define SKIA_EXT_PLATFORM_CANVAS_H_ 6 #define SKIA_EXT_PLATFORM_CANVAS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 // The platform-specific device will include the necessary platform headers 11 // The platform-specific device will include the necessary platform headers
12 // to get the surface type. 12 // to get the surface type.
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "skia/ext/native_drawing_context.h" 14 #include "skia/ext/native_drawing_context.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 15 #include "third_party/skia/include/core/SkBitmap.h"
16 #include "third_party/skia/include/core/SkCanvas.h" 16 #include "third_party/skia/include/core/SkCanvas.h"
17 #include "third_party/skia/include/core/SkPixelRef.h"
18 #include "third_party/skia/include/core/SkPixmap.h"
19 17
20 class SkBaseDevice; 18 class SkCanvas;
19 class SkPixmap;
21 20
22 // A PlatformCanvas is a software-rasterized SkCanvas which is *also* 21 // A PlatformCanvas is a software-rasterized SkCanvas which is *also*
23 // addressable by the platform-specific drawing API (GDI, Core Graphics, 22 // addressable by the platform-specific drawing API (GDI, Core Graphics,
24 // Cairo...). 23 // Cairo...).
25 24
26 namespace skia { 25 namespace skia {
27 26
28 // 27 //
29 // Note about error handling. 28 // Note about error handling.
30 // 29 //
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 OnFailureType failure_type); 66 OnFailureType failure_type);
68 #endif 67 #endif
69 68
70 static inline std::unique_ptr<SkCanvas> CreatePlatformCanvas(int width, 69 static inline std::unique_ptr<SkCanvas> CreatePlatformCanvas(int width,
71 int height, 70 int height,
72 bool is_opaque) { 71 bool is_opaque) {
73 #if defined(WIN32) 72 #if defined(WIN32)
74 return CreatePlatformCanvasWithSharedSection(width, height, is_opaque, 0, 73 return CreatePlatformCanvasWithSharedSection(width, height, is_opaque, 0,
75 CRASH_ON_FAILURE); 74 CRASH_ON_FAILURE);
76 #else 75 #else
77 return CreatePlatformCanvasWithPixels(width, height, is_opaque, 0, 76 return CreatePlatformCanvasWithPixels(width, height, is_opaque, nullptr,
78 CRASH_ON_FAILURE); 77 CRASH_ON_FAILURE);
79 #endif 78 #endif
80 } 79 }
81 80
82 SK_API std::unique_ptr<SkCanvas> CreateCanvas(const sk_sp<SkBaseDevice>& device,
83 OnFailureType failure_type);
84
85 static inline std::unique_ptr<SkCanvas> TryCreateBitmapCanvas(int width, 81 static inline std::unique_ptr<SkCanvas> TryCreateBitmapCanvas(int width,
86 int height, 82 int height,
87 bool is_opaque) { 83 bool is_opaque) {
88 #if defined(WIN32) 84 #if defined(WIN32)
89 return CreatePlatformCanvasWithSharedSection(width, height, is_opaque, 0, 85 return CreatePlatformCanvasWithSharedSection(width, height, is_opaque, 0,
90 RETURN_NULL_ON_FAILURE); 86 RETURN_NULL_ON_FAILURE);
91 #else 87 #else
92 return CreatePlatformCanvasWithPixels(width, height, is_opaque, 0, 88 return CreatePlatformCanvasWithPixels(width, height, is_opaque, nullptr,
93 RETURN_NULL_ON_FAILURE); 89 RETURN_NULL_ON_FAILURE);
94 #endif 90 #endif
95 } 91 }
96 92
97 // Return the stride (length of a line in bytes) for the given width. Because 93 // Return the stride (length of a line in bytes) for the given width. Because
98 // we use 32-bits per pixel, this will be roughly 4*width. However, for 94 // we use 32-bits per pixel, this will be roughly 4*width. However, for
99 // alignment reasons we may wish to increase that. 95 // alignment reasons we may wish to increase that.
100 SK_API size_t PlatformCanvasStrideForWidth(unsigned width); 96 SK_API size_t PlatformCanvasStrideForWidth(unsigned width);
101 97
102 // Copies pixels from the SkCanvas into an SkBitmap, fetching pixels from 98 // Copies pixels from the SkCanvas into an SkBitmap, fetching pixels from
(...skipping 17 matching lines...) Expand all
120 SK_API SkMetaData& GetMetaData(const SkCanvas& canvas); 116 SK_API SkMetaData& GetMetaData(const SkCanvas& canvas);
121 117
122 #if defined(OS_MACOSX) 118 #if defined(OS_MACOSX)
123 SK_API void SetIsPreviewMetafile(const SkCanvas& canvas, bool is_preview); 119 SK_API void SetIsPreviewMetafile(const SkCanvas& canvas, bool is_preview);
124 SK_API bool IsPreviewMetafile(const SkCanvas& canvas); 120 SK_API bool IsPreviewMetafile(const SkCanvas& canvas);
125 #endif 121 #endif
126 122
127 } // namespace skia 123 } // namespace skia
128 124
129 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ 125 #endif // SKIA_EXT_PLATFORM_CANVAS_H_
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_win.cc ('k') | skia/ext/platform_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698