| 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 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ | 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
| 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ | 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "skia/ext/platform_device.h" | 10 #include "skia/ext/platform_device.h" |
| 11 #include "skia/ext/refptr.h" | 11 #include "skia/ext/refptr.h" |
| 12 | 12 |
| 13 namespace skia { | 13 namespace skia { |
| 14 | 14 |
| 15 // A device is basically a wrapper around SkBitmap that provides a surface for | 15 // A device is basically a wrapper around SkBitmap that provides a surface for |
| 16 // SkCanvas to draw into. Our device provides a surface Windows can also write | 16 // SkCanvas to draw into. Our device provides a surface Windows can also write |
| 17 // to. BitmapPlatformDevice creates a bitmap using CreateDIBSection() in a | 17 // to. BitmapPlatformDevice creates a bitmap using CreateDIBSection() in a |
| 18 // format that Skia supports and can then use this to draw ClearType into, etc. | 18 // format that Skia supports and can then use this to draw ClearType into, etc. |
| 19 // This pixel data is provided to the bitmap that the device contains so that it | 19 // This pixel data is provided to the bitmap that the device contains so that it |
| 20 // can be shared. | 20 // can be shared. |
| 21 // | |
| 22 // The GDI bitmap created for drawing is actually owned by a | |
| 23 // PlatformBitmapPixelRef, and stored in an SkBitmap via the normal skia | |
| 24 // SkPixelRef refcounting mechanism. In this way, the GDI bitmap can outlive | |
| 25 // the device created to draw into it. So it is safe to call accessBitmap() on | |
| 26 // the device, and retain the returned SkBitmap. | |
| 27 class SK_API BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice
{ | 21 class SK_API BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice
{ |
| 28 public: | 22 public: |
| 29 // Factory function. is_opaque should be set if the caller knows the bitmap | 23 // Factory function. is_opaque should be set if the caller knows the bitmap |
| 30 // will be completely opaque and allows some optimizations. | 24 // will be completely opaque and allows some optimizations. |
| 31 // | 25 // |
| 32 // The |shared_section| parameter is optional (pass NULL for default | 26 // The |shared_section| parameter is optional (pass NULL for default |
| 33 // behavior). If |shared_section| is non-null, then it must be a handle to a | 27 // behavior). If |shared_section| is non-null, then it must be a handle to a |
| 34 // file-mapping object returned by CreateFileMapping. See CreateDIBSection | 28 // file-mapping object returned by CreateFileMapping. See CreateDIBSection |
| 35 // for details. If |shared_section| is null, the bitmap backing store is not | 29 // for details. If |shared_section| is null, the bitmap backing store is not |
| 36 // initialized. | 30 // initialized. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 #ifdef SK_DEBUG | 106 #ifdef SK_DEBUG |
| 113 int begin_paint_count_; | 107 int begin_paint_count_; |
| 114 #endif | 108 #endif |
| 115 | 109 |
| 116 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); | 110 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); |
| 117 }; | 111 }; |
| 118 | 112 |
| 119 } // namespace skia | 113 } // namespace skia |
| 120 | 114 |
| 121 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ | 115 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
| OLD | NEW |