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

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

Issue 2616003003: Revert of Delete Mac & Cairo skia::BitmapPlatformDevice impls (Closed)
Patch Set: Created 3 years, 11 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_mac.cc ('k') | skia/ext/bitmap_platform_device_skia.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SKIA_H_ 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_SKIA_H_
6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_SKIA_H_ 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_SKIA_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "skia/ext/platform_device.h" 13 #include "skia/ext/platform_device.h"
14 14
15 namespace skia { 15 namespace skia {
16 16
17 // ----------------------------------------------------------------------------- 17 // -----------------------------------------------------------------------------
18 // For now we just use SkBitmap for SkBitmapDevice 18 // For now we just use SkBitmap for SkBitmapDevice
19 // 19 //
20 // This is all quite ok for test_shell. In the future we will want to use 20 // This is all quite ok for test_shell. In the future we will want to use
21 // shared memory between the renderer and the main process at least. In this 21 // shared memory between the renderer and the main process at least. In this
22 // case we'll probably create the buffer from a precreated region of memory. 22 // case we'll probably create the buffer from a precreated region of memory.
23 // ----------------------------------------------------------------------------- 23 // -----------------------------------------------------------------------------
24 class BitmapPlatformDevice final : public SkBitmapDevice, 24 class BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice {
25 public PlatformDevice {
26 public: 25 public:
27 // Construct a BitmapPlatformDevice. |is_opaque| should be set if the caller 26 // Construct a BitmapPlatformDevice. |is_opaque| should be set if the caller
28 // knows the bitmap will be completely opaque and allows some optimizations 27 // knows the bitmap will be completely opaque and allows some optimizations.
29 // (the bitmap is not initialized to 0 when is_opaque == true). 28 // The bitmap is not initialized.
30 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque); 29 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque);
31 30
32 // This doesn't take ownership of |data|. If |data| is null and |is_opaque| 31 // This doesn't take ownership of |data|. If |data| is null, the bitmap
33 // is false, the bitmap is initialized to 0. 32 // is not initialized to 0.
34 //
35 // Note: historicaly, BitmapPlatformDevice impls have had diverging
36 // initialization behavior for null |data| (Cairo used to initialize, while
37 // the others did not). For now we stick to the more conservative Cairo
38 // behavior.
39 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, 33 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
40 uint8_t* data); 34 uint8_t* data);
41 35
42 // Create a BitmapPlatformDevice from an already constructed bitmap; 36 // Create a BitmapPlatformDevice from an already constructed bitmap;
43 // you should probably be using Create(). This may become private later if 37 // you should probably be using Create(). This may become private later if
44 // we ever have to share state between some native drawing UI and Skia, like 38 // we ever have to share state between some native drawing UI and Skia, like
45 // the Windows and Mac versions of this class do. 39 // the Windows and Mac versions of this class do.
46 explicit BitmapPlatformDevice(const SkBitmap& other); 40 explicit BitmapPlatformDevice(const SkBitmap& other);
47 ~BitmapPlatformDevice() override; 41 ~BitmapPlatformDevice() override;
48 42
49 protected: 43 protected:
50 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; 44 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
51 45
52 private: 46 private:
47 NativeDrawingContext BeginPlatformPaint(const SkMatrix& transform,
48 const SkIRect& clip_bounds) override;
49
53 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); 50 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice);
54 }; 51 };
55 52
56 } // namespace skia 53 } // namespace skia
57 54
58 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_SKIA_H_ 55 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_SKIA_H_
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.cc ('k') | skia/ext/bitmap_platform_device_skia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698