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

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

Issue 926843003: Move canvas->surface association to the device subclasses (Closed) Base URL: https://skia.googlesource.com/skia.git@skimage-filters-03-sksurface-set-root-device-simple
Patch Set: Created 5 years, 10 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') | src/core/SkBitmapDevice.cpp » ('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
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 * possibly from SkCanvas' dtor. 116 * possibly from SkCanvas' dtor.
117 */ 117 */
118 virtual void onDetachFromCanvas() { 118 virtual void onDetachFromCanvas() {
119 SkASSERT(fAttachedToCanvas); 119 SkASSERT(fAttachedToCanvas);
120 this->unlockPixels(); 120 this->unlockPixels();
121 #ifdef SK_DEBUG 121 #ifdef SK_DEBUG
122 fAttachedToCanvas = false; 122 fAttachedToCanvas = false;
123 #endif 123 #endif
124 }; 124 };
125 125
126 /** This makes the contents of this device undefined.
127 * See SkCanvas::discard()
128 */
129 virtual void discard() { }
130
126 protected: 131 protected:
127 enum Usage { 132 enum Usage {
128 kGeneral_Usage, 133 kGeneral_Usage,
129 kSaveLayer_Usage, // <! internal use only 134 kSaveLayer_Usage, // <! internal use only
130 kImageFilter_Usage // <! internal use only 135 kImageFilter_Usage // <! internal use only
131 }; 136 };
132 137
133 struct TextFlags { 138 struct TextFlags {
134 uint32_t fFlags; // SkPaint::getFlags() 139 uint32_t fFlags; // SkPaint::getFlags()
135 }; 140 };
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 friend class SkDeviceImageFilterProxy; 370 friend class SkDeviceImageFilterProxy;
366 friend class SkDeferredDevice; // for newSurface 371 friend class SkDeferredDevice; // for newSurface
367 friend class SkNoPixelsBitmapDevice; 372 friend class SkNoPixelsBitmapDevice;
368 373
369 friend class SkSurface_Raster; 374 friend class SkSurface_Raster;
370 375
371 // used to change the backend's pixels (and possibly config/rowbytes) 376 // used to change the backend's pixels (and possibly config/rowbytes)
372 // 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
373 // any clip information. 378 // any clip information.
374 // TODO: move to SkBitmapDevice 379 // TODO: move to SkBitmapDevice
375 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} 380 virtual void replaceBitmapBackend(const SkBitmap&) {}
376 381
377 virtual bool forceConservativeRasterClip() const { return false; } 382 virtual bool forceConservativeRasterClip() const { return false; }
378 383
379 // just called by SkCanvas when built as a layer 384 // just called by SkCanvas when built as a layer
380 void setOrigin(int x, int y) { fOrigin.set(x, y); } 385 void setOrigin(int x, int y) { fOrigin.set(x, y); }
381 386
382 /** Causes any deferred drawing to the device to be completed. 387 /** Causes any deferred drawing to the device to be completed.
383 */ 388 */
384 virtual void flush() {} 389 virtual void flush() {}
385 390
386 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } 391 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; }
387 392
388 SkIPoint fOrigin; 393 SkIPoint fOrigin;
389 SkMetaData* fMetaData; 394 SkMetaData* fMetaData;
390 SkDeviceProperties* fLeakyProperties; // will always exist. 395 SkDeviceProperties* fLeakyProperties; // will always exist.
391 396
392 #ifdef SK_DEBUG 397 #ifdef SK_DEBUG
393 bool fAttachedToCanvas; 398 bool fAttachedToCanvas;
394 #endif 399 #endif
395 400
396 typedef SkRefCnt INHERITED; 401 typedef SkRefCnt INHERITED;
397 }; 402 };
398 403
399 #endif 404 #endif
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698