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

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

Issue 3590011: Update use of SkCanvas and SkDevice to match change in Skia (Closed)
Patch Set: Bump deps again to bring in fix for memory leak Created 10 years, 2 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 | « DEPS ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "skia/ext/platform_device_linux.h" 10 #include "skia/ext/platform_device_linux.h"
(...skipping 25 matching lines...) Expand all
36 // typically don't do alpha blending of drawables at the user level. Composite 36 // typically don't do alpha blending of drawables at the user level. Composite
37 // extensions aside.) 37 // extensions aside.)
38 // 38 //
39 // We don't use GdkPixbuf because its byte order differs from the rest. Most 39 // We don't use GdkPixbuf because its byte order differs from the rest. Most
40 // importantly, it differs from Cairo which, being a system library, is 40 // importantly, it differs from Cairo which, being a system library, is
41 // something that we can't easily change. 41 // something that we can't easily change.
42 // ----------------------------------------------------------------------------- 42 // -----------------------------------------------------------------------------
43 43
44 namespace skia { 44 namespace skia {
45 45
46 class SkBitmapPlatformDeviceFactory : public SkRasterDeviceFactory {
47 public:
48 virtual SkDevice* newDevice(SkBitmap::Config config, int width, int height,
49 bool isOpaque, bool isForLayer);
50 };
51
46 // ----------------------------------------------------------------------------- 52 // -----------------------------------------------------------------------------
47 // This is the Linux bitmap backing for Skia. We create a Cairo image surface 53 // This is the Linux bitmap backing for Skia. We create a Cairo image surface
48 // to store the backing buffer. This buffer is BGRA in memory (on little-endian 54 // to store the backing buffer. This buffer is BGRA in memory (on little-endian
49 // machines). 55 // machines).
50 // 56 //
51 // For now we are also using Cairo to paint to the Drawables so we provide an 57 // For now we are also using Cairo to paint to the Drawables so we provide an
52 // accessor for getting the surface. 58 // accessor for getting the surface.
53 // 59 //
54 // This is all quite ok for test_shell. In the future we will want to use 60 // This is all quite ok for test_shell. In the future we will want to use
55 // shared memory between the renderer and the main process at least. In this 61 // shared memory between the renderer and the main process at least. In this
(...skipping 16 matching lines...) Expand all
72 // the Windows and Mac versions of this class do. 78 // the Windows and Mac versions of this class do.
73 // 79 //
74 // This object takes ownership of @data. 80 // This object takes ownership of @data.
75 BitmapPlatformDevice(const SkBitmap& other, BitmapPlatformDeviceData* data); 81 BitmapPlatformDevice(const SkBitmap& other, BitmapPlatformDeviceData* data);
76 virtual ~BitmapPlatformDevice(); 82 virtual ~BitmapPlatformDevice();
77 BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other); 83 BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other);
78 84
79 // A stub copy constructor. Needs to be properly implemented. 85 // A stub copy constructor. Needs to be properly implemented.
80 BitmapPlatformDevice(const BitmapPlatformDevice& other); 86 BitmapPlatformDevice(const BitmapPlatformDevice& other);
81 87
88 virtual SkDeviceFactory* getDeviceFactory() {
89 return SkNEW(SkBitmapPlatformDeviceFactory);
90 }
91
82 virtual void makeOpaque(int x, int y, int width, int height); 92 virtual void makeOpaque(int x, int y, int width, int height);
83 93
84 // Bitmaps aren't vector graphics. 94 // Bitmaps aren't vector graphics.
85 virtual bool IsVectorial() { return false; } 95 virtual bool IsVectorial() { return false; }
86 96
87 // If someone wants to paint on a Cairo surface version of our 97 // If someone wants to paint on a Cairo surface version of our
88 // buffer, then give them the surface we're already using. 98 // buffer, then give them the surface we're already using.
89 virtual cairo_t* beginPlatformPaint(); 99 virtual cairo_t* beginPlatformPaint();
90 100
91 // Loads the given transform and clipping region into the HDC. This is 101 // Loads the given transform and clipping region into the HDC. This is
92 // overridden from SkDevice. 102 // overridden from SkDevice.
93 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region); 103 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region);
94 104
95 private: 105 private:
96 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, 106 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
97 cairo_surface_t* surface); 107 cairo_surface_t* surface);
98 108
99 scoped_refptr<BitmapPlatformDeviceData> data_; 109 scoped_refptr<BitmapPlatformDeviceData> data_;
100 }; 110 };
101 111
102 } // namespace skia 112 } // namespace skia
103 113
104 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ 114 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_
OLDNEW
« no previous file with comments | « DEPS ('k') | skia/ext/bitmap_platform_device_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698