| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_BITMAP_PLATFORM_DEVICE_WIN_H_ |
| 6 #define SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ | 6 #define SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ |
| 7 | 7 |
| 8 #include "skia/ext/platform_device_win.h" | 8 #include "skia/ext/platform_device_win.h" |
| 9 | 9 |
| 10 namespace skia { | 10 namespace skia { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 // See warning for copy constructor above. | 55 // See warning for copy constructor above. |
| 56 BitmapPlatformDeviceWin& operator=(const BitmapPlatformDeviceWin& other); | 56 BitmapPlatformDeviceWin& operator=(const BitmapPlatformDeviceWin& other); |
| 57 | 57 |
| 58 // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The | 58 // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The |
| 59 // bitmap DC is lazy created. | 59 // bitmap DC is lazy created. |
| 60 virtual HDC getBitmapDC(); | 60 virtual HDC getBitmapDC(); |
| 61 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region); | 61 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region); |
| 62 | 62 |
| 63 virtual void drawToHDC(HDC dc, int x, int y, const RECT* src_rect); | 63 virtual void drawToHDC(HDC dc, int x, int y, const RECT* src_rect); |
| 64 virtual void prepareForGDI(int x, int y, int width, int height); | |
| 65 virtual void postProcessGDI(int x, int y, int width, int height); | |
| 66 virtual void makeOpaque(int x, int y, int width, int height); | 64 virtual void makeOpaque(int x, int y, int width, int height); |
| 67 virtual void fixupAlphaBeforeCompositing(); | |
| 68 virtual bool IsVectorial() { return false; } | 65 virtual bool IsVectorial() { return false; } |
| 69 | 66 |
| 70 // Returns the color value at the specified location. This does not | 67 // Returns the color value at the specified location. This does not |
| 71 // consider any transforms that may be set on the device. | 68 // consider any transforms that may be set on the device. |
| 72 SkColor getColorAt(int x, int y); | 69 SkColor getColorAt(int x, int y); |
| 73 | 70 |
| 74 protected: | 71 protected: |
| 75 // Flushes the Windows device context so that the pixel data can be accessed | 72 // Flushes the Windows device context so that the pixel data can be accessed |
| 76 // directly by Skia. Overridden from SkDevice, this is called when Skia | 73 // directly by Skia. Overridden from SkDevice, this is called when Skia |
| 77 // starts accessing pixel data. | 74 // starts accessing pixel data. |
| 78 virtual void onAccessBitmap(SkBitmap* bitmap); | 75 virtual void onAccessBitmap(SkBitmap* bitmap); |
| 79 | 76 |
| 80 private: | 77 private: |
| 81 // Function pointer used by the processPixels method for setting the alpha | |
| 82 // value of a particular pixel. | |
| 83 typedef void (*adjustAlpha)(uint32_t* pixel); | |
| 84 | |
| 85 // Reference counted data that can be shared between multiple devices. This | 78 // Reference counted data that can be shared between multiple devices. This |
| 86 // allows copy constructors and operator= for devices to work properly. The | 79 // allows copy constructors and operator= for devices to work properly. The |
| 87 // bitmaps used by the base device class are already refcounted and copyable. | 80 // bitmaps used by the base device class are already refcounted and copyable. |
| 88 class BitmapPlatformDeviceWinData; | 81 class BitmapPlatformDeviceWinData; |
| 89 | 82 |
| 90 // Private constructor. The data should already be ref'ed for us. | 83 // Private constructor. The data should already be ref'ed for us. |
| 91 BitmapPlatformDeviceWin(BitmapPlatformDeviceWinData* data, | 84 BitmapPlatformDeviceWin(BitmapPlatformDeviceWinData* data, |
| 92 const SkBitmap& bitmap); | 85 const SkBitmap& bitmap); |
| 93 | 86 |
| 94 // Loops through each of the pixels in the specified range, invoking | |
| 95 // adjustor for the alpha value of each pixel. If |width| or |height| are -1, | |
| 96 // the available width/height is used. | |
| 97 template<adjustAlpha adjustor> | |
| 98 void processPixels(int x, | |
| 99 int y, | |
| 100 int width, | |
| 101 int height); | |
| 102 | |
| 103 // Data associated with this device, guaranteed non-null. We hold a reference | 87 // Data associated with this device, guaranteed non-null. We hold a reference |
| 104 // to this object. | 88 // to this object. |
| 105 BitmapPlatformDeviceWinData* data_; | 89 BitmapPlatformDeviceWinData* data_; |
| 106 }; | 90 }; |
| 107 | 91 |
| 108 } // namespace skia | 92 } // namespace skia |
| 109 | 93 |
| 110 #endif // SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ | 94 #endif // SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ |
| 111 | 95 |
| OLD | NEW |