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

Side by Side Diff: include/core/SkBitmapDevice.h

Issue 933043006: Implement SkBaseDevice snapshot support Base URL: https://skia.googlesource.com/skia.git@skimage-filters-04-snapshot-devices
Patch Set: Created 5 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
« no previous file with comments | « no previous file | include/core/SkCanvas.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 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 16 matching lines...) Expand all
27 * Construct a new device with the specified bitmap as its backend. It is 27 * Construct a new device with the specified bitmap as its backend. It is
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 ~SkBitmapDevice();
38 SkImageInfo imageInfo() const SK_OVERRIDE; 38 SkImageInfo imageInfo() const SK_OVERRIDE;
39 39
40 SkImage* newImageSnapshot() SK_OVERRIDE;
41 void discard() SK_OVERRIDE;
40 protected: 42 protected:
41 bool onShouldDisableLCD(const SkPaint&) const SK_OVERRIDE; 43 bool onShouldDisableLCD(const SkPaint&) const SK_OVERRIDE;
42 44
43 /** These are called inside the per-device-layer loop for each draw call. 45 /** 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, 46 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 47 and are handling any looping from the paint, and any effects from the
46 DrawFilter. 48 DrawFilter.
47 */ 49 */
48 void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE; 50 void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
49 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun t, 51 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun t,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 132
131 private: 133 private:
132 friend class SkCanvas; 134 friend class SkCanvas;
133 friend struct DeviceCM; //for setMatrixClip 135 friend struct DeviceCM; //for setMatrixClip
134 friend class SkDraw; 136 friend class SkDraw;
135 friend class SkDrawIter; 137 friend class SkDrawIter;
136 friend class SkDeviceFilteredPaint; 138 friend class SkDeviceFilteredPaint;
137 friend class SkDeviceImageFilterProxy; 139 friend class SkDeviceImageFilterProxy;
138 140
139 friend class SkSurface_Raster; 141 friend class SkSurface_Raster;
142 friend class SkRasterDevice;
140 143
141 // used to change the backend's pixels (and possibly config/rowbytes) 144 // used to change the backend's pixels (and possibly config/rowbytes)
142 // but cannot change the width/height, so there should be no change to 145 // but cannot change the width/height, so there should be no change to
143 // any clip information. 146 // any clip information.
144 void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE; 147 void deepCopyBackendIfNeeded();
145 148
146 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) SK_OVERRIDE; 149 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) SK_OVERRIDE;
150 virtual SkImage* onNewImageSnapshot();
147 151
148 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRIDE ; 152 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRIDE ;
149 const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; 153 const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE;
150 154
151 SkImageFilter::Cache* getImageFilterCache() SK_OVERRIDE; 155 SkImageFilter::Cache* getImageFilterCache() SK_OVERRIDE;
152 156
153 SkBitmap fBitmap; 157 SkBitmap fBitmap;
154 158 SkAutoTUnref<SkImage> fSnapshot;
155 typedef SkBaseDevice INHERITED; 159 typedef SkBaseDevice INHERITED;
156 }; 160 };
157 161
158 #endif // SkBitmapDevice_DEFINED 162 #endif // SkBitmapDevice_DEFINED
OLDNEW
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698