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

Side by Side Diff: skia/ext/bitmap_platform_device_mac.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 | « skia/ext/bitmap_platform_device_linux.cc ('k') | skia/ext/bitmap_platform_device_mac.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_MAC_H_ 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_
6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_
7 #pragma once 7 #pragma once
8 8
9 #include "skia/ext/platform_device_mac.h" 9 #include "skia/ext/platform_device_mac.h"
10 10
11 namespace skia { 11 namespace skia {
12 12
13 class SkBitmapPlatformDeviceFactory : public SkRasterDeviceFactory {
14 public:
15 virtual SkDevice* newDevice(SkBitmap::Config config, int width, int height,
16 bool isOpaque, bool isForLayer);
17 };
18
19
13 // A device is basically a wrapper around SkBitmap that provides a surface for 20 // A device is basically a wrapper around SkBitmap that provides a surface for
14 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also 21 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also
15 // write to. BitmapPlatformDevice creates a bitmap using 22 // write to. BitmapPlatformDevice creates a bitmap using
16 // CGCreateBitmapContext() in a format that Skia supports and can then use this 23 // CGCreateBitmapContext() in a format that Skia supports and can then use this
17 // to draw text into, etc. This pixel data is provided to the bitmap that the 24 // to draw text into, etc. This pixel data is provided to the bitmap that the
18 // device contains so that it can be shared. 25 // device contains so that it can be shared.
19 // 26 //
20 // The device owns the pixel data, when the device goes away, the pixel data 27 // The device owns the pixel data, when the device goes away, the pixel data
21 // also becomes invalid. THIS IS DIFFERENT THAN NORMAL SKIA which uses 28 // also becomes invalid. THIS IS DIFFERENT THAN NORMAL SKIA which uses
22 // reference counting for the pixel data. In normal Skia, you could assign 29 // reference counting for the pixel data. In normal Skia, you could assign
(...skipping 20 matching lines...) Expand all
43 // 50 //
44 // This means it will NOT work to duplicate a device and assign it to a 51 // This means it will NOT work to duplicate a device and assign it to a
45 // canvas, because the two canvases will each set their own clip rects, and 52 // canvas, because the two canvases will each set their own clip rects, and
46 // the resulting CoreGraphics drawing state will be unpredictable. 53 // the resulting CoreGraphics drawing state will be unpredictable.
47 // 54 //
48 // Copy constucting and "=" is designed for saving the device or passing it 55 // Copy constucting and "=" is designed for saving the device or passing it
49 // around to another routine willing to deal with the bitmap data directly. 56 // around to another routine willing to deal with the bitmap data directly.
50 BitmapPlatformDevice(const BitmapPlatformDevice& other); 57 BitmapPlatformDevice(const BitmapPlatformDevice& other);
51 virtual ~BitmapPlatformDevice(); 58 virtual ~BitmapPlatformDevice();
52 59
60 virtual SkDeviceFactory* getDeviceFactory() {
61 return SkNEW(SkBitmapPlatformDeviceFactory);
62 }
63
53 // See warning for copy constructor above. 64 // See warning for copy constructor above.
54 BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other); 65 BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other);
55 66
56 virtual CGContextRef GetBitmapContext(); 67 virtual CGContextRef GetBitmapContext();
57 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region); 68 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region);
58 69
59 virtual void DrawToContext(CGContextRef context, int x, int y, 70 virtual void DrawToContext(CGContextRef context, int x, int y,
60 const CGRect* src_rect); 71 const CGRect* src_rect);
61 virtual void makeOpaque(int x, int y, int width, int height); 72 virtual void makeOpaque(int x, int y, int width, int height);
62 virtual bool IsVectorial() { return false; } 73 virtual bool IsVectorial() { return false; }
(...skipping 17 matching lines...) Expand all
80 virtual void onAccessBitmap(SkBitmap*); 91 virtual void onAccessBitmap(SkBitmap*);
81 92
82 // Data associated with this device, guaranteed non-null. We hold a reference 93 // Data associated with this device, guaranteed non-null. We hold a reference
83 // to this object. 94 // to this object.
84 BitmapPlatformDeviceData* data_; 95 BitmapPlatformDeviceData* data_;
85 }; 96 };
86 97
87 } // namespace skia 98 } // namespace skia
88 99
89 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ 100 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_linux.cc ('k') | skia/ext/bitmap_platform_device_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698