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

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

Issue 1839113002: Limit manual control of platform painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Privatize Created 4 years, 8 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_cairo.h ('k') | skia/ext/bitmap_platform_device_win.h » ('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 class ScopedPlatformPaint;
18
17 // ----------------------------------------------------------------------------- 19 // -----------------------------------------------------------------------------
18 // For now we just use SkBitmap for SkBitmapDevice 20 // For now we just use SkBitmap for SkBitmapDevice
19 // 21 //
20 // This is all quite ok for test_shell. In the future we will want to use 22 // 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 23 // 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. 24 // case we'll probably create the buffer from a precreated region of memory.
23 // ----------------------------------------------------------------------------- 25 // -----------------------------------------------------------------------------
24 class BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice { 26 class BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice {
25 public: 27 public:
26 // Construct a BitmapPlatformDevice. |is_opaque| should be set if the caller 28 // Construct a BitmapPlatformDevice. |is_opaque| should be set if the caller
27 // knows the bitmap will be completely opaque and allows some optimizations. 29 // knows the bitmap will be completely opaque and allows some optimizations.
28 // The bitmap is not initialized. 30 // The bitmap is not initialized.
29 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque); 31 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque);
30 32
31 // This doesn't take ownership of |data|. If |data| is null, the bitmap 33 // This doesn't take ownership of |data|. If |data| is null, the bitmap
32 // is not initialized to 0. 34 // is not initialized to 0.
33 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, 35 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
34 uint8_t* data); 36 uint8_t* data);
35 37
36 // Create a BitmapPlatformDevice from an already constructed bitmap; 38 // Create a BitmapPlatformDevice from an already constructed bitmap;
37 // you should probably be using Create(). This may become private later if 39 // you should probably be using Create(). This may become private later if
38 // we ever have to share state between some native drawing UI and Skia, like 40 // we ever have to share state between some native drawing UI and Skia, like
39 // the Windows and Mac versions of this class do. 41 // the Windows and Mac versions of this class do.
40 explicit BitmapPlatformDevice(const SkBitmap& other); 42 explicit BitmapPlatformDevice(const SkBitmap& other);
41 ~BitmapPlatformDevice() override; 43 ~BitmapPlatformDevice() override;
42 44
43 PlatformSurface BeginPlatformPaint() override;
44
45 protected: 45 protected:
46 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; 46 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
47 47
48 private: 48 private:
49 PlatformSurface BeginPlatformPaint() override;
50
49 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); 51 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice);
52
53 friend class ScopedPlatformPaint;
50 }; 54 };
51 55
52 } // namespace skia 56 } // namespace skia
53 57
54 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_SKIA_H_ 58 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_SKIA_H_
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_cairo.h ('k') | skia/ext/bitmap_platform_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698