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

Side by Side Diff: include/core/SkDevice.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 | « include/core/SkCanvas.h ('k') | include/core/SkSurface.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 * Copyright 2010 The Android Open Source Project 2 * Copyright 2010 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkDevice_DEFINED 8 #ifndef SkDevice_DEFINED
9 #define SkDevice_DEFINED 9 #define SkDevice_DEFINED
10 10
11 #include "SkRefCnt.h" 11 #include "SkRefCnt.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkCanvas.h" 13 #include "SkCanvas.h"
14 #include "SkColor.h" 14 #include "SkColor.h"
15 #include "SkImageFilter.h" 15 #include "SkImageFilter.h"
16 16
17 class SkClipStack; 17 class SkClipStack;
18 class SkDraw; 18 class SkDraw;
19 class SkDrawFilter; 19 class SkDrawFilter;
20 class SkImage;
20 struct SkIRect; 21 struct SkIRect;
21 class SkMatrix; 22 class SkMatrix;
22 class SkMetaData; 23 class SkMetaData;
23 class SkRegion; 24 class SkRegion;
24 struct SkDeviceProperties; 25 struct SkDeviceProperties;
25 class GrRenderTarget; 26 class GrRenderTarget;
26 27
27 class SK_API SkBaseDevice : public SkRefCnt { 28 class SK_API SkBaseDevice : public SkRefCnt {
28 public: 29 public:
29 SK_DECLARE_INST_COUNT(SkBaseDevice) 30 SK_DECLARE_INST_COUNT(SkBaseDevice)
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 * possibly from SkCanvas' dtor. 118 * possibly from SkCanvas' dtor.
118 */ 119 */
119 virtual void onDetachFromCanvas() { 120 virtual void onDetachFromCanvas() {
120 SkASSERT(fAttachedToCanvas); 121 SkASSERT(fAttachedToCanvas);
121 this->unlockPixels(); 122 this->unlockPixels();
122 #ifdef SK_DEBUG 123 #ifdef SK_DEBUG
123 fAttachedToCanvas = false; 124 fAttachedToCanvas = false;
124 #endif 125 #endif
125 }; 126 };
126 127
128 virtual SkImage* newImageSnapshot() { return NULL; }
129
130 /** This makes the contents of this device undefined.
131 * See SkCanvas::discard()
132 */
133 virtual void discard() { }
134
127 protected: 135 protected:
128 enum TileUsage { 136 enum TileUsage {
129 kPossible_TileUsage, //!< the created device may be drawn tiled 137 kPossible_TileUsage, //!< the created device may be drawn tiled
130 kNever_TileUsage, //!< the created device will never be drawn tile d 138 kNever_TileUsage, //!< the created device will never be drawn tile d
131 }; 139 };
132 140
133 struct TextFlags { 141 struct TextFlags {
134 uint32_t fFlags; // SkPaint::getFlags() 142 uint32_t fFlags; // SkPaint::getFlags()
135 }; 143 };
136 144
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 friend class SkDeviceImageFilterProxy; 370 friend class SkDeviceImageFilterProxy;
363 friend class SkDeferredDevice; // for newSurface 371 friend class SkDeferredDevice; // for newSurface
364 friend class SkNoPixelsBitmapDevice; 372 friend class SkNoPixelsBitmapDevice;
365 373
366 friend class SkSurface_Raster; 374 friend class SkSurface_Raster;
367 375
368 // used to change the backend's pixels (and possibly config/rowbytes) 376 // used to change the backend's pixels (and possibly config/rowbytes)
369 // but cannot change the width/height, so there should be no change to 377 // but cannot change the width/height, so there should be no change to
370 // any clip information. 378 // any clip information.
371 // TODO: move to SkBitmapDevice 379 // TODO: move to SkBitmapDevice
372 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} 380 virtual void replaceBitmapBackend(const SkBitmap&) {}
373 381
374 virtual bool forceConservativeRasterClip() const { return false; } 382 virtual bool forceConservativeRasterClip() const { return false; }
375 383
376 // just called by SkCanvas when built as a layer 384 // just called by SkCanvas when built as a layer
377 void setOrigin(int x, int y) { fOrigin.set(x, y); } 385 void setOrigin(int x, int y) { fOrigin.set(x, y); }
378 386
379 /** Causes any deferred drawing to the device to be completed. 387 /** Causes any deferred drawing to the device to be completed.
380 */ 388 */
381 virtual void flush() {} 389 virtual void flush() {}
382 390
383 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } 391 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; }
384 392
385 SkIPoint fOrigin; 393 SkIPoint fOrigin;
386 SkMetaData* fMetaData; 394 SkMetaData* fMetaData;
387 SkDeviceProperties* fLeakyProperties; // will always exist. 395 SkDeviceProperties* fLeakyProperties; // will always exist.
388 396
389 #ifdef SK_DEBUG 397 #ifdef SK_DEBUG
390 bool fAttachedToCanvas; 398 bool fAttachedToCanvas;
391 #endif 399 #endif
392 400
393 typedef SkRefCnt INHERITED; 401 typedef SkRefCnt INHERITED;
394 }; 402 };
395 403
396 #endif 404 #endif
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/core/SkSurface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698