Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(693)

Side by Side Diff: skia/ext/bitmap_platform_device_linux.h

Issue 125109: Refactor the PlatformContext layer to have only one class. (Closed)
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « skia/ext/bitmap_platform_device.h ('k') | skia/ext/bitmap_platform_device_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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 7
8 #include "base/ref_counted.h" 8 #include "base/ref_counted.h"
9 #include "skia/ext/platform_device_linux.h" 9 #include "skia/ext/platform_device_linux.h"
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // to store the backing buffer. This buffer is BGRA in memory (on little-endian 47 // to store the backing buffer. This buffer is BGRA in memory (on little-endian
48 // machines). 48 // machines).
49 // 49 //
50 // For now we are also using Cairo to paint to the Drawables so we provide an 50 // For now we are also using Cairo to paint to the Drawables so we provide an
51 // accessor for getting the surface. 51 // accessor for getting the surface.
52 // 52 //
53 // This is all quite ok for test_shell. In the future we will want to use 53 // This is all quite ok for test_shell. In the future we will want to use
54 // shared memory between the renderer and the main process at least. In this 54 // shared memory between the renderer and the main process at least. In this
55 // case we'll probably create the buffer from a precreated region of memory. 55 // case we'll probably create the buffer from a precreated region of memory.
56 // ----------------------------------------------------------------------------- 56 // -----------------------------------------------------------------------------
57 class BitmapPlatformDeviceLinux : public PlatformDeviceLinux { 57 class BitmapPlatformDevice : public PlatformDevice {
58 // A reference counted cairo surface 58 // A reference counted cairo surface
59 class BitmapPlatformDeviceLinuxData; 59 class BitmapPlatformDeviceData;
60 60
61 public: 61 public:
62 static BitmapPlatformDeviceLinux* Create(int width, int height, 62 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque);
63 bool is_opaque); 63
64 // This doesn't take ownership of |data| 64 // This doesn't take ownership of |data|
65 static BitmapPlatformDeviceLinux* Create(int width, int height, 65 static BitmapPlatformDevice* Create(int width, int height,
66 bool is_opaque, uint8_t* data); 66 bool is_opaque, uint8_t* data);
67 static BitmapPlatformDeviceLinux* Create(int width, int height, 67 static BitmapPlatformDevice* Create(int width, int height,
68 bool is_opaque, 68 bool is_opaque, cairo_surface_t* surface);
69 cairo_surface_t* surface);
70 69
71 // Create a BitmapPlatformDeviceLinux from an already constructed bitmap; 70 // Create a BitmapPlatformDeviceLinux from an already constructed bitmap;
72 // you should probably be using Create(). This may become private later if 71 // you should probably be using Create(). This may become private later if
73 // we ever have to share state between some native drawing UI and Skia, like 72 // we ever have to share state between some native drawing UI and Skia, like
74 // the Windows and Mac versions of this class do. 73 // the Windows and Mac versions of this class do.
75 // 74 //
76 // This object takes ownership of @data. 75 // This object takes ownership of @data.
77 BitmapPlatformDeviceLinux(const SkBitmap& other, 76 BitmapPlatformDevice(const SkBitmap& other, BitmapPlatformDeviceData* data);
78 BitmapPlatformDeviceLinuxData* data); 77 virtual ~BitmapPlatformDevice();
79 virtual ~BitmapPlatformDeviceLinux(); 78 BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other);
80 BitmapPlatformDeviceLinux& operator=(const BitmapPlatformDeviceLinux& other);
81 79
82 // A stub copy constructor. Needs to be properly implemented. 80 // A stub copy constructor. Needs to be properly implemented.
83 BitmapPlatformDeviceLinux(const BitmapPlatformDeviceLinux& other); 81 BitmapPlatformDevice(const BitmapPlatformDevice& other);
84 82
85 // Bitmaps aren't vector graphics. 83 // Bitmaps aren't vector graphics.
86 virtual bool IsVectorial() { return false; } 84 virtual bool IsVectorial() { return false; }
87 85
88 // If someone wants to paint on a Cairo surface version of our 86 // If someone wants to paint on a Cairo surface version of our
89 // buffer, then give them the surface we're already using. 87 // buffer, then give them the surface we're already using.
90 virtual cairo_surface_t* beginPlatformPaint() { return surface(); } 88 virtual cairo_surface_t* beginPlatformPaint() { return surface(); }
91 89
92 cairo_surface_t* surface() const; 90 cairo_surface_t* surface() const;
93 91
94 private: 92 private:
95 scoped_refptr<BitmapPlatformDeviceLinuxData> data_; 93 scoped_refptr<BitmapPlatformDeviceData> data_;
96 }; 94 };
97 95
98 } // namespace skia 96 } // namespace skia
99 97
100 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ 98 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device.h ('k') | skia/ext/bitmap_platform_device_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698