| 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_BITMAP_PLATFORM_DEVICE_WIN_H_ | 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
| 6 #define SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ | 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "skia/ext/platform_device_win.h" | 9 #include "skia/ext/platform_device_win.h" |
| 10 | 10 |
| 11 namespace skia { | 11 namespace skia { |
| 12 | 12 |
| 13 class BitmapPlatformDeviceFactory : public SkDeviceFactory { | 13 class BitmapPlatformDeviceFactory : public SkDeviceFactory { |
| 14 public: | 14 public: |
| 15 virtual SkDevice* newDevice(SkCanvas* ignored, SkBitmap::Config config, | 15 virtual SkDevice* newDevice(SkCanvas* ignored, SkBitmap::Config config, |
| 16 int width, int height, | 16 int width, int height, |
| 17 bool isOpaque, bool isForLayer); | 17 bool isOpaque, bool isForLayer); |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 // A device is basically a wrapper around SkBitmap that provides a surface for | 20 // A device is basically a wrapper around SkBitmap that provides a surface for |
| 21 // SkCanvas to draw into. Our device provides a surface Windows can also write | 21 // SkCanvas to draw into. Our device provides a surface Windows can also write |
| 22 // to. BitmapPlatformDevice creates a bitmap using CreateDIBSection() in a | 22 // to. BitmapPlatformDevice creates a bitmap using CreateDIBSection() in a |
| 23 // format that Skia supports and can then use this to draw ClearType into, etc. | 23 // format that Skia supports and can then use this to draw ClearType into, etc. |
| 24 // This pixel data is provided to the bitmap that the device contains so that it | 24 // This pixel data is provided to the bitmap that the device contains so that it |
| 25 // can be shared. | 25 // can be shared. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // around to another routine willing to deal with the bitmap data directly. | 65 // around to another routine willing to deal with the bitmap data directly. |
| 66 BitmapPlatformDevice(const BitmapPlatformDevice& other); | 66 BitmapPlatformDevice(const BitmapPlatformDevice& other); |
| 67 virtual ~BitmapPlatformDevice(); | 67 virtual ~BitmapPlatformDevice(); |
| 68 | 68 |
| 69 // See warning for copy constructor above. | 69 // See warning for copy constructor above. |
| 70 BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other); | 70 BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other); |
| 71 | 71 |
| 72 // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The | 72 // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The |
| 73 // bitmap DC is lazy created. | 73 // bitmap DC is lazy created. |
| 74 virtual PlatformSurface BeginPlatformPaint(); | 74 virtual PlatformSurface BeginPlatformPaint(); |
| 75 virtual void EndPlatformPaint(); |
| 75 | 76 |
| 76 // Loads the given transform and clipping region into the HDC. This is | 77 // Loads the given transform and clipping region into the HDC. This is |
| 77 // overridden from SkDevice. | 78 // overridden from SkDevice. |
| 78 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, | 79 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, |
| 79 const SkClipStack&); | 80 const SkClipStack&); |
| 80 | 81 |
| 81 virtual void drawToHDC(HDC dc, int x, int y, const RECT* src_rect); | 82 virtual void drawToHDC(HDC dc, int x, int y, const RECT* src_rect); |
| 82 virtual void makeOpaque(int x, int y, int width, int height); | 83 virtual void makeOpaque(int x, int y, int width, int height); |
| 83 virtual bool IsVectorial() { return false; } | 84 virtual bool IsVectorial() { return false; } |
| 84 | 85 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 101 // bitmaps used by the base device class are already refcounted and copyable. | 102 // bitmaps used by the base device class are already refcounted and copyable. |
| 102 class BitmapPlatformDeviceData; | 103 class BitmapPlatformDeviceData; |
| 103 | 104 |
| 104 // Private constructor. The data should already be ref'ed for us. | 105 // Private constructor. The data should already be ref'ed for us. |
| 105 BitmapPlatformDevice(BitmapPlatformDeviceData* data, | 106 BitmapPlatformDevice(BitmapPlatformDeviceData* data, |
| 106 const SkBitmap& bitmap); | 107 const SkBitmap& bitmap); |
| 107 | 108 |
| 108 // Data associated with this device, guaranteed non-null. We hold a reference | 109 // Data associated with this device, guaranteed non-null. We hold a reference |
| 109 // to this object. | 110 // to this object. |
| 110 BitmapPlatformDeviceData* data_; | 111 BitmapPlatformDeviceData* data_; |
| 112 |
| 113 #ifdef SK_DEBUG |
| 114 int begin_paint_count_; |
| 115 #endif |
| 111 }; | 116 }; |
| 112 | 117 |
| 113 } // namespace skia | 118 } // namespace skia |
| 114 | 119 |
| 115 #endif // SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ | 120 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
| 116 | 121 |
| OLD | NEW |