OLD | NEW |
---|---|
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 | 98 |
99 /** | 99 /** |
100 * Try to get read-only-access to the pixels behind the device. If successf ul, this returns | 100 * Try to get read-only-access to the pixels behind the device. If successf ul, this returns |
101 * true and fills-out the pixmap parameter. | 101 * true and fills-out the pixmap parameter. |
102 * | 102 * |
103 * On failure, returns false and ignores the pixmap parameter. | 103 * On failure, returns false and ignores the pixmap parameter. |
104 */ | 104 */ |
105 bool peekPixels(SkPixmap*); | 105 bool peekPixels(SkPixmap*); |
106 | 106 |
107 /** | 107 /** |
108 * Return the device's associated gpu render target, or NULL. | |
109 */ | |
110 virtual GrRenderTarget* accessRenderTarget() { return nullptr; } | |
111 | |
112 /** | |
113 * Don't call this! | |
114 */ | |
115 virtual GrDrawContext* accessDrawContext() { return nullptr; } | |
116 | |
117 /** | |
118 * Return the device's origin: its offset in device coordinates from | 108 * Return the device's origin: its offset in device coordinates from |
119 * the default origin in its canvas' matrix/clip | 109 * the default origin in its canvas' matrix/clip |
120 */ | 110 */ |
121 const SkIPoint& getOrigin() const { return fOrigin; } | 111 const SkIPoint& getOrigin() const { return fOrigin; } |
122 | 112 |
123 /** | 113 /** |
124 * onAttachToCanvas is invoked whenever a device is installed in a canvas | 114 * onAttachToCanvas is invoked whenever a device is installed in a canvas |
125 * (i.e., setDevice, saveLayer (for the new device created by the save), | 115 * (i.e., setDevice, saveLayer (for the new device created by the save), |
126 * and SkCanvas' SkBaseDevice & SkBitmap -taking ctors). It allows the | 116 * and SkCanvas' SkBaseDevice & SkBitmap -taking ctors). It allows the |
127 * devices to prepare for drawing (e.g., locking their pixels, etc.) | 117 * devices to prepare for drawing (e.g., locking their pixels, etc.) |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 friend class DeviceTestingAccess; | 368 friend class DeviceTestingAccess; |
379 | 369 |
380 // used to change the backend's pixels (and possibly config/rowbytes) | 370 // used to change the backend's pixels (and possibly config/rowbytes) |
381 // but cannot change the width/height, so there should be no change to | 371 // but cannot change the width/height, so there should be no change to |
382 // any clip information. | 372 // any clip information. |
383 // TODO: move to SkBitmapDevice | 373 // TODO: move to SkBitmapDevice |
384 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} | 374 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} |
385 | 375 |
386 virtual bool forceConservativeRasterClip() const { return false; } | 376 virtual bool forceConservativeRasterClip() const { return false; } |
387 | 377 |
378 /** | |
379 * Don't call this! | |
380 */ | |
381 virtual GrDrawContext* accessDrawContext() { return nullptr; } | |
bsalomon
2016/07/20 14:34:13
Should we allow SkSurface_Gpu (and others) to down
robertphillips
2016/07/20 14:49:13
Yeah - that would be better. I'll do that in anoth
| |
382 | |
388 // just called by SkCanvas when built as a layer | 383 // just called by SkCanvas when built as a layer |
389 void setOrigin(int x, int y) { fOrigin.set(x, y); } | 384 void setOrigin(int x, int y) { fOrigin.set(x, y); } |
390 | 385 |
391 /** Causes any deferred drawing to the device to be completed. | 386 /** Causes any deferred drawing to the device to be completed. |
392 */ | 387 */ |
393 virtual void flush() {} | 388 virtual void flush() {} |
394 | 389 |
395 virtual SkImageFilterCache* getImageFilterCache() { return NULL; } | 390 virtual SkImageFilterCache* getImageFilterCache() { return NULL; } |
396 | 391 |
397 SkIPoint fOrigin; | 392 SkIPoint fOrigin; |
398 SkMetaData* fMetaData; | 393 SkMetaData* fMetaData; |
399 SkSurfaceProps fSurfaceProps; | 394 SkSurfaceProps fSurfaceProps; |
400 | 395 |
401 #ifdef SK_DEBUG | 396 #ifdef SK_DEBUG |
402 bool fAttachedToCanvas; | 397 bool fAttachedToCanvas; |
403 #endif | 398 #endif |
404 | 399 |
405 typedef SkRefCnt INHERITED; | 400 typedef SkRefCnt INHERITED; |
406 }; | 401 }; |
407 | 402 |
408 #endif | 403 #endif |
OLD | NEW |