| 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 |
| 47 // ----------------------------------------------------------------------------- | 54 // ----------------------------------------------------------------------------- |
| 48 // This is the Linux bitmap backing for Skia. We create a Cairo image surface | 55 // This is the Linux bitmap backing for Skia. We create a Cairo image surface |
| 49 // to store the backing buffer. This buffer is BGRA in memory (on little-endian | 56 // to store the backing buffer. This buffer is BGRA in memory (on little-endian |
| 50 // machines). | 57 // machines). |
| 51 // | 58 // |
| 52 // For now we are also using Cairo to paint to the Drawables so we provide an | 59 // For now we are also using Cairo to paint to the Drawables so we provide an |
| 53 // accessor for getting the surface. | 60 // accessor for getting the surface. |
| 54 // | 61 // |
| 55 // This is all quite ok for test_shell. In the future we will want to use | 62 // This is all quite ok for test_shell. In the future we will want to use |
| 56 // shared memory between the renderer and the main process at least. In this | 63 // shared memory between the renderer and the main process at least. In this |
| (...skipping 22 matching lines...) Expand all Loading... |
| 79 virtual void MakeOpaque(int x, int y, int width, int height); | 86 virtual void MakeOpaque(int x, int y, int width, int height); |
| 80 | 87 |
| 81 // Overridden from SkDevice: | 88 // Overridden from SkDevice: |
| 82 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, | 89 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, |
| 83 const SkClipStack&); | 90 const SkClipStack&); |
| 84 | 91 |
| 85 // Overridden from PlatformDevice: | 92 // Overridden from PlatformDevice: |
| 86 virtual cairo_t* BeginPlatformPaint(); | 93 virtual cairo_t* BeginPlatformPaint(); |
| 87 | 94 |
| 88 protected: | 95 protected: |
| 89 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, | 96 // Override SkDevice. |
| 90 int height, bool isOpaque, | 97 virtual SkDeviceFactory* onNewDeviceFactory(); |
| 91 Usage usage); | |
| 92 | 98 |
| 93 private: | 99 private: |
| 94 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, | 100 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, |
| 95 cairo_surface_t* surface); | 101 cairo_surface_t* surface); |
| 96 | 102 |
| 97 scoped_refptr<BitmapPlatformDeviceData> data_; | 103 scoped_refptr<BitmapPlatformDeviceData> data_; |
| 98 | 104 |
| 99 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); | 105 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); |
| 100 }; | 106 }; |
| 101 | 107 |
| 102 } // namespace skia | 108 } // namespace skia |
| 103 | 109 |
| 104 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ | 110 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ |
| OLD | NEW |