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

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

Issue 9416017: Optionally clear PlatformCanvas instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Address comments & add BitmapPlatformDevice::CreateAndClear. Created 8 years, 9 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
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" 10 #include "base/compiler_specific.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 public: 64 public:
65 // Create a BitmapPlatformDeviceLinux from an already constructed bitmap; 65 // Create a BitmapPlatformDeviceLinux from an already constructed bitmap;
66 // you should probably be using Create(). This may become private later if 66 // 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 67 // we ever have to share state between some native drawing UI and Skia, like
68 // the Windows and Mac versions of this class do. 68 // the Windows and Mac versions of this class do.
69 // 69 //
70 // This object takes ownership of @data. 70 // This object takes ownership of @data.
71 BitmapPlatformDevice(const SkBitmap& other, BitmapPlatformDeviceData* data); 71 BitmapPlatformDevice(const SkBitmap& other, BitmapPlatformDeviceData* data);
72 virtual ~BitmapPlatformDevice(); 72 virtual ~BitmapPlatformDevice();
73 73
74 // Constructs a device with size |width| * |height|.with contents initialized
Alexei Svitkine (slow) 2012/03/16 05:57:56 Replace the . after |height| with a space.
Jeff Timanus 2012/03/16 15:52:42 Done.
75 // to zero. |is_opaque| should be set if the caller knows the bitmap will be
76 // completely opaque and allows some optimizations.
74 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque); 77 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque);
75 78
76 // This doesn't take ownership of |data| 79 // Performs the same construction as Create.
80 // Other ports require a separate construction routine because Create does not
81 // initialize the bitmap to 0.
82 static BitmapPlatformDevice* CreateAndClear(int width, int height,
83 bool is_opaque);
84
85 // This doesn't take ownership of |data|. If |data| is NULL, the contents
msw 2012/03/16 07:13:22 is this contingent on |data|'s value? sounds like
Jeff Timanus 2012/03/16 15:52:42 My understanding of this code is that if |data| is
86 // of the device are initialized to 0.
77 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, 87 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
78 uint8_t* data); 88 uint8_t* data);
79 89
80 // Overridden from SkDevice: 90 // Overridden from SkDevice:
81 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, 91 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region,
82 const SkClipStack&) OVERRIDE; 92 const SkClipStack&) OVERRIDE;
83 93
84 // Overridden from PlatformDevice: 94 // Overridden from PlatformDevice:
85 virtual cairo_t* BeginPlatformPaint() OVERRIDE; 95 virtual cairo_t* BeginPlatformPaint() OVERRIDE;
86 virtual void DrawToNativeContext(PlatformSurface surface, int x, int y, 96 virtual void DrawToNativeContext(PlatformSurface surface, int x, int y,
87 const PlatformRect* src_rect) OVERRIDE; 97 const PlatformRect* src_rect) OVERRIDE;
88 98
89 protected: 99 protected:
90 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, 100 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
91 int height, bool isOpaque, 101 int height, bool isOpaque,
92 Usage usage) OVERRIDE; 102 Usage usage) OVERRIDE;
93 103
94 private: 104 private:
95 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, 105 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
96 cairo_surface_t* surface); 106 cairo_surface_t* surface);
97 107
98 scoped_refptr<BitmapPlatformDeviceData> data_; 108 scoped_refptr<BitmapPlatformDeviceData> data_;
99 109
100 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); 110 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice);
101 }; 111 };
102 112
103 } // namespace skia 113 } // namespace skia
104 114
105 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ 115 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698