OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef SkBitmapDevice_DEFINED | 9 #ifndef SkBitmapDevice_DEFINED |
10 #define SkBitmapDevice_DEFINED | 10 #define SkBitmapDevice_DEFINED |
(...skipping 17 matching lines...) Expand all Loading... |
28 * valid for the bitmap to have no pixels associated with it. In that case, | 28 * valid for the bitmap to have no pixels associated with it. In that case, |
29 * any drawing to this device will have no effect. | 29 * any drawing to this device will have no effect. |
30 */ | 30 */ |
31 SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& devicePrope
rties); | 31 SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& devicePrope
rties); |
32 static SkBitmapDevice* Create(const SkImageInfo&, const SkDeviceProperties*)
; | 32 static SkBitmapDevice* Create(const SkImageInfo&, const SkDeviceProperties*)
; |
33 public: | 33 public: |
34 static SkBitmapDevice* Create(const SkImageInfo& info) { | 34 static SkBitmapDevice* Create(const SkImageInfo& info) { |
35 return Create(info, NULL); | 35 return Create(info, NULL); |
36 } | 36 } |
37 | 37 |
38 virtual SkImageInfo imageInfo() const SK_OVERRIDE; | 38 SkImageInfo imageInfo() const SK_OVERRIDE; |
39 | 39 |
40 protected: | 40 protected: |
41 bool onShouldDisableLCD(const SkPaint&) const SK_OVERRIDE; | 41 bool onShouldDisableLCD(const SkPaint&) const SK_OVERRIDE; |
42 | 42 |
43 /** These are called inside the per-device-layer loop for each draw call. | 43 /** These are called inside the per-device-layer loop for each draw call. |
44 When these are called, we have already applied any saveLayer operations, | 44 When these are called, we have already applied any saveLayer operations, |
45 and are handling any looping from the paint, and any effects from the | 45 and are handling any looping from the paint, and any effects from the |
46 DrawFilter. | 46 DrawFilter. |
47 */ | 47 */ |
48 virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE; | 48 void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE; |
49 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun
t, | 49 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun
t, |
50 const SkPoint[], const SkPaint& paint) SK_OVERRIDE; | 50 const SkPoint[], const SkPaint& paint) SK_OVERRIDE; |
51 virtual void drawRect(const SkDraw&, const SkRect& r, | 51 virtual void drawRect(const SkDraw&, const SkRect& r, |
52 const SkPaint& paint) SK_OVERRIDE; | 52 const SkPaint& paint) SK_OVERRIDE; |
53 virtual void drawOval(const SkDraw&, const SkRect& oval, | 53 virtual void drawOval(const SkDraw&, const SkRect& oval, |
54 const SkPaint& paint) SK_OVERRIDE; | 54 const SkPaint& paint) SK_OVERRIDE; |
55 virtual void drawRRect(const SkDraw&, const SkRRect& rr, | 55 virtual void drawRRect(const SkDraw&, const SkRRect& rr, |
56 const SkPaint& paint) SK_OVERRIDE; | 56 const SkPaint& paint) SK_OVERRIDE; |
57 | 57 |
58 /** | 58 /** |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, | 107 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, |
108 const SkPaint&) SK_OVERRIDE; | 108 const SkPaint&) SK_OVERRIDE; |
109 | 109 |
110 /////////////////////////////////////////////////////////////////////////// | 110 /////////////////////////////////////////////////////////////////////////// |
111 | 111 |
112 /** Update as needed the pixel value in the bitmap, so that the caller can | 112 /** Update as needed the pixel value in the bitmap, so that the caller can |
113 access the pixels directly. Note: only the pixels field should be | 113 access the pixels directly. Note: only the pixels field should be |
114 altered. The config/width/height/rowbytes must remain unchanged. | 114 altered. The config/width/height/rowbytes must remain unchanged. |
115 @return the device contents as a bitmap | 115 @return the device contents as a bitmap |
116 */ | 116 */ |
117 virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE; | 117 const SkBitmap& onAccessBitmap() SK_OVERRIDE; |
118 | 118 |
119 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } | 119 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } |
120 // just for subclasses, to assign a custom pixelref | 120 // just for subclasses, to assign a custom pixelref |
121 SkPixelRef* setPixelRef(SkPixelRef* pr) { | 121 SkPixelRef* setPixelRef(SkPixelRef* pr) { |
122 fBitmap.setPixelRef(pr); | 122 fBitmap.setPixelRef(pr); |
123 return pr; | 123 return pr; |
124 } | 124 } |
125 | 125 |
126 virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) S
K_OVERRIDE; | 126 bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) SK_OVERRI
DE; |
127 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int
) SK_OVERRIDE; | 127 bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) SK_OVE
RRIDE; |
128 virtual void* onAccessPixels(SkImageInfo* info, size_t* rowBytes) SK_OVERRID
E; | 128 void* onAccessPixels(SkImageInfo* info, size_t* rowBytes) SK_OVERRIDE; |
129 | 129 |
130 /** Called when this device is installed into a Canvas. Balanced by a call | 130 /** Called when this device is installed into a Canvas. Balanced by a call |
131 to unlockPixels() when the device is removed from a Canvas. | 131 to unlockPixels() when the device is removed from a Canvas. |
132 */ | 132 */ |
133 virtual void lockPixels() SK_OVERRIDE; | 133 void lockPixels() SK_OVERRIDE; |
134 virtual void unlockPixels() SK_OVERRIDE; | 134 void unlockPixels() SK_OVERRIDE; |
135 | 135 |
136 private: | 136 private: |
137 friend class SkCanvas; | 137 friend class SkCanvas; |
138 friend struct DeviceCM; //for setMatrixClip | 138 friend struct DeviceCM; //for setMatrixClip |
139 friend class SkDraw; | 139 friend class SkDraw; |
140 friend class SkDrawIter; | 140 friend class SkDrawIter; |
141 friend class SkDeviceFilteredPaint; | 141 friend class SkDeviceFilteredPaint; |
142 friend class SkDeviceImageFilterProxy; | 142 friend class SkDeviceImageFilterProxy; |
143 | 143 |
144 friend class SkSurface_Raster; | 144 friend class SkSurface_Raster; |
145 | 145 |
146 // used to change the backend's pixels (and possibly config/rowbytes) | 146 // used to change the backend's pixels (and possibly config/rowbytes) |
147 // but cannot change the width/height, so there should be no change to | 147 // but cannot change the width/height, so there should be no change to |
148 // any clip information. | 148 // any clip information. |
149 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI
DE; | 149 void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE; |
150 | 150 |
151 virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRID
E; | 151 SkBaseDevice* onCreateCompatibleDevice(const CreateInfo&) SK_OVERRIDE; |
152 | 152 |
153 virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_
OVERRIDE; | 153 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRIDE
; |
154 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; | 154 const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; |
155 | 155 |
156 virtual SkImageFilter::Cache* getImageFilterCache() SK_OVERRIDE; | 156 SkImageFilter::Cache* getImageFilterCache() SK_OVERRIDE; |
157 | 157 |
158 SkBitmap fBitmap; | 158 SkBitmap fBitmap; |
159 | 159 |
160 typedef SkBaseDevice INHERITED; | 160 typedef SkBaseDevice INHERITED; |
161 }; | 161 }; |
162 | 162 |
163 #endif // SkBitmapDevice_DEFINED | 163 #endif // SkBitmapDevice_DEFINED |
OLD | NEW |