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_BITMAP_PLATFORM_DEVICE_LINUX_H_ | 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ |
6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ | 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // typically don't do alpha blending of drawables at the user level. Composite | 37 // typically don't do alpha blending of drawables at the user level. Composite |
38 // extensions aside.) | 38 // extensions aside.) |
39 // | 39 // |
40 // We don't use GdkPixbuf because its byte order differs from the rest. Most | 40 // We don't use GdkPixbuf because its byte order differs from the rest. Most |
41 // importantly, it differs from Cairo which, being a system library, is | 41 // importantly, it differs from Cairo which, being a system library, is |
42 // something that we can't easily change. | 42 // something that we can't easily change. |
43 // ----------------------------------------------------------------------------- | 43 // ----------------------------------------------------------------------------- |
44 | 44 |
45 namespace skia { | 45 namespace skia { |
46 | 46 |
47 class BitmapPlatformDeviceFactory : public SkDeviceFactory { | |
48 public: | |
49 virtual SkDevice* newDevice(SkCanvas* ignored, SkBitmap::Config config, | |
50 int width, int height, | |
51 bool isOpaque, bool isForLayer); | |
52 }; | |
53 | |
54 // ----------------------------------------------------------------------------- | 47 // ----------------------------------------------------------------------------- |
55 // This is the Linux bitmap backing for Skia. We create a Cairo image surface | 48 // This is the Linux bitmap backing for Skia. We create a Cairo image surface |
56 // to store the backing buffer. This buffer is BGRA in memory (on little-endian | 49 // to store the backing buffer. This buffer is BGRA in memory (on little-endian |
57 // machines). | 50 // machines). |
58 // | 51 // |
59 // For now we are also using Cairo to paint to the Drawables so we provide an | 52 // For now we are also using Cairo to paint to the Drawables so we provide an |
60 // accessor for getting the surface. | 53 // accessor for getting the surface. |
61 // | 54 // |
62 // This is all quite ok for test_shell. In the future we will want to use | 55 // This is all quite ok for test_shell. In the future we will want to use |
63 // shared memory between the renderer and the main process at least. In this | 56 // shared memory between the renderer and the main process at least. In this |
(...skipping 22 matching lines...) Expand all Loading... |
86 virtual void MakeOpaque(int x, int y, int width, int height); | 79 virtual void MakeOpaque(int x, int y, int width, int height); |
87 | 80 |
88 // Overridden from SkDevice: | 81 // Overridden from SkDevice: |
89 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, | 82 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, |
90 const SkClipStack&); | 83 const SkClipStack&); |
91 | 84 |
92 // Overridden from PlatformDevice: | 85 // Overridden from PlatformDevice: |
93 virtual cairo_t* BeginPlatformPaint(); | 86 virtual cairo_t* BeginPlatformPaint(); |
94 | 87 |
95 protected: | 88 protected: |
96 // Override SkDevice. | 89 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, |
97 virtual SkDeviceFactory* onNewDeviceFactory(); | 90 int height, bool isOpaque, |
| 91 Usage usage); |
98 | 92 |
99 private: | 93 private: |
100 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, | 94 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, |
101 cairo_surface_t* surface); | 95 cairo_surface_t* surface); |
102 | 96 |
103 scoped_refptr<BitmapPlatformDeviceData> data_; | 97 scoped_refptr<BitmapPlatformDeviceData> data_; |
104 | 98 |
105 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); | 99 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); |
106 }; | 100 }; |
107 | 101 |
108 } // namespace skia | 102 } // namespace skia |
109 | 103 |
110 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ | 104 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ |
OLD | NEW |