Chromium Code Reviews| 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 #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 // The platform-specific device will include the necessary platform headers | 8 // The platform-specific device will include the necessary platform headers |
| 9 // to get the surface type. | 9 // to get the surface type. |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 // To allow the caller to handle the failure, every Create... factory takes an | 28 // To allow the caller to handle the failure, every Create... factory takes an |
| 29 // enum as its last parameter. The default value is kCrashOnFailure. If the | 29 // enum as its last parameter. The default value is kCrashOnFailure. If the |
| 30 // caller passes kReturnNullOnFailure, then the caller is responsible to check | 30 // caller passes kReturnNullOnFailure, then the caller is responsible to check |
| 31 // the return result. | 31 // the return result. |
| 32 // | 32 // |
| 33 enum OnFailureType { | 33 enum OnFailureType { |
| 34 CRASH_ON_FAILURE, | 34 CRASH_ON_FAILURE, |
| 35 RETURN_NULL_ON_FAILURE | 35 RETURN_NULL_ON_FAILURE |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 #if defined(WIN32) | 38 #if defined(SK_BUILD_FOR_WIN32) |
|
Mark Seaborn
2015/12/16 21:20:37
Nit: you might need to #include include/core/SkPre
Sean Klein
2015/12/16 22:34:03
Going with the "#include" option for now.
| |
| 39 // The shared_section parameter is passed to gfx::PlatformDevice::create. | 39 // The shared_section parameter is passed to gfx::PlatformDevice::create. |
| 40 // See it for details. | 40 // See it for details. |
| 41 SK_API SkCanvas* CreatePlatformCanvas(int width, | 41 SK_API SkCanvas* CreatePlatformCanvas(int width, |
| 42 int height, | 42 int height, |
| 43 bool is_opaque, | 43 bool is_opaque, |
| 44 HANDLE shared_section, | 44 HANDLE shared_section, |
| 45 OnFailureType failure_type); | 45 OnFailureType failure_type); |
| 46 | 46 |
| 47 // Draws the top layer of the canvas into the specified HDC. Only works | 47 // Draws the top layer of the canvas into the specified HDC. Only works |
| 48 // with a PlatformCanvas with a BitmapPlatformDevice. | 48 // with a PlatformCanvas with a BitmapPlatformDevice. |
| 49 SK_API void DrawToNativeContext(SkCanvas* canvas, | 49 SK_API void DrawToNativeContext(SkCanvas* canvas, |
| 50 HDC hdc, | 50 HDC hdc, |
| 51 int x, | 51 int x, |
| 52 int y, | 52 int y, |
| 53 const RECT* src_rect); | 53 const RECT* src_rect); |
| 54 #elif defined(__APPLE__) | 54 #elif defined(SK_BUILD_FOR_MAC) |
| 55 SK_API SkCanvas* CreatePlatformCanvas(CGContextRef context, | 55 SK_API SkCanvas* CreatePlatformCanvas(CGContextRef context, |
| 56 int width, | 56 int width, |
| 57 int height, | 57 int height, |
| 58 bool is_opaque, | 58 bool is_opaque, |
| 59 OnFailureType failure_type); | 59 OnFailureType failure_type); |
| 60 | 60 |
| 61 SK_API SkCanvas* CreatePlatformCanvas(int width, | 61 SK_API SkCanvas* CreatePlatformCanvas(int width, |
| 62 int height, | 62 int height, |
| 63 bool is_opaque, | 63 bool is_opaque, |
| 64 uint8_t* context, | 64 uint8_t* context, |
| 65 OnFailureType failure_type); | 65 OnFailureType failure_type); |
| 66 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ | 66 #elif defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_UNIX) |
| 67 defined(__sun) || defined(ANDROID) | |
| 68 // Linux --------------------------------------------------------------------- | 67 // Linux --------------------------------------------------------------------- |
| 69 | 68 |
| 70 // Construct a canvas from the given memory region. The memory is not cleared | 69 // Construct a canvas from the given memory region. The memory is not cleared |
| 71 // first. @data must be, at least, @height * StrideForWidth(@width) bytes. | 70 // first. @data must be, at least, @height * StrideForWidth(@width) bytes. |
| 72 SK_API SkCanvas* CreatePlatformCanvas(int width, | 71 SK_API SkCanvas* CreatePlatformCanvas(int width, |
| 73 int height, | 72 int height, |
| 74 bool is_opaque, | 73 bool is_opaque, |
| 75 uint8_t* data, | 74 uint8_t* data, |
| 76 OnFailureType failure_type); | 75 OnFailureType failure_type); |
| 77 #endif | 76 #endif |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 SkBitmap bitmap_; | 177 SkBitmap bitmap_; |
| 179 PlatformSurface surface_; // initialized to 0 | 178 PlatformSurface surface_; // initialized to 0 |
| 180 intptr_t platform_extra_; // platform specific, initialized to 0 | 179 intptr_t platform_extra_; // platform specific, initialized to 0 |
| 181 | 180 |
| 182 DISALLOW_COPY_AND_ASSIGN(PlatformBitmap); | 181 DISALLOW_COPY_AND_ASSIGN(PlatformBitmap); |
| 183 }; | 182 }; |
| 184 | 183 |
| 185 } // namespace skia | 184 } // namespace skia |
| 186 | 185 |
| 187 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ | 186 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ |
| OLD | NEW |