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

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

Issue 7754001: Revert 98230 - CL removing inheritance of SkDevice from PlatformDevice. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « printing/pdf_metafile_skia.cc ('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) 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/compiler_specific.h"
11 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
12 #include "skia/ext/platform_device.h" 11 #include "skia/ext/platform_device_linux.h"
13 12
14 typedef struct _cairo_surface cairo_surface_t; 13 typedef struct _cairo_surface cairo_surface_t;
15 14
16 // ----------------------------------------------------------------------------- 15 // -----------------------------------------------------------------------------
17 // Image byte ordering on Linux: 16 // Image byte ordering on Linux:
18 // 17 //
19 // Pixels are packed into 32-bit words these days. Even for 24-bit images, 18 // Pixels are packed into 32-bit words these days. Even for 24-bit images,
20 // often 8-bits will be left unused for alignment reasons. Thus, when you see 19 // often 8-bits will be left unused for alignment reasons. Thus, when you see
21 // ARGB as the byte order you have to wonder if that's in memory order or 20 // ARGB as the byte order you have to wonder if that's in memory order or
22 // little-endian order. Here I'll write A.R.G.B to specifiy the memory order. 21 // little-endian order. Here I'll write A.R.G.B to specifiy the memory order.
(...skipping 27 matching lines...) Expand all
50 // 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
51 // machines). 50 // machines).
52 // 51 //
53 // 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
54 // accessor for getting the surface. 53 // accessor for getting the surface.
55 // 54 //
56 // 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
57 // 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
58 // case we'll probably create the buffer from a precreated region of memory. 57 // case we'll probably create the buffer from a precreated region of memory.
59 // ----------------------------------------------------------------------------- 58 // -----------------------------------------------------------------------------
60 class BitmapPlatformDevice : public PlatformDevice, public SkDevice { 59 class BitmapPlatformDevice : public PlatformDevice {
61 // A reference counted cairo surface 60 // A reference counted cairo surface
62 class BitmapPlatformDeviceData; 61 class BitmapPlatformDeviceData;
63 62
64 public: 63 public:
65 // Create a BitmapPlatformDeviceLinux from an already constructed bitmap; 64 // Create a BitmapPlatformDeviceLinux from an already constructed bitmap;
66 // you should probably be using Create(). This may become private later if 65 // you should probably be using Create(). This may become private later if
67 // we ever have to share state between some native drawing UI and Skia, like 66 // we ever have to share state between some native drawing UI and Skia, like
68 // the Windows and Mac versions of this class do. 67 // the Windows and Mac versions of this class do.
69 // 68 //
70 // This object takes ownership of @data. 69 // This object takes ownership of @data.
71 BitmapPlatformDevice(const SkBitmap& other, BitmapPlatformDeviceData* data); 70 BitmapPlatformDevice(const SkBitmap& other, BitmapPlatformDeviceData* data);
72 virtual ~BitmapPlatformDevice(); 71 virtual ~BitmapPlatformDevice();
73 72
74 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque); 73 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque);
75 74
76 // This doesn't take ownership of |data| 75 // This doesn't take ownership of |data|
77 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, 76 static BitmapPlatformDevice* Create(int width, int height,
78 uint8_t* data); 77 bool is_opaque, uint8_t* data);
79 78
80 virtual void MakeOpaque(int x, int y, int width, int height) OVERRIDE; 79 virtual void MakeOpaque(int x, int y, int width, int height);
81 80
82 // Overridden from SkDevice: 81 // Overridden from SkDevice:
83 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, 82 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region,
84 const SkClipStack&) OVERRIDE; 83 const SkClipStack&);
85 84
86 // Overridden from PlatformDevice: 85 // Overridden from PlatformDevice:
87 virtual cairo_t* BeginPlatformPaint() OVERRIDE; 86 virtual cairo_t* BeginPlatformPaint();
88 virtual void DrawToNativeContext(PlatformSurface surface, int x, int y,
89 const PlatformRect* src_rect) OVERRIDE;
90 87
91 protected: 88 protected:
92 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, 89 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
93 int height, bool isOpaque, 90 int height, bool isOpaque,
94 Usage usage) OVERRIDE; 91 Usage usage);
95 92
96 private: 93 private:
97 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, 94 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
98 cairo_surface_t* surface); 95 cairo_surface_t* surface);
99 96
100 scoped_refptr<BitmapPlatformDeviceData> data_; 97 scoped_refptr<BitmapPlatformDeviceData> data_;
101 98
102 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); 99 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice);
103 }; 100 };
104 101
105 } // namespace skia 102 } // namespace skia
106 103
107 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ 104 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_
OLDNEW
« no previous file with comments | « printing/pdf_metafile_skia.cc ('k') | skia/ext/bitmap_platform_device_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698