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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 * Return the bounds of the device in the coordinate space of the root | 46 * Return the bounds of the device in the coordinate space of the root |
47 * canvas. The root device will have its top-left at 0,0, but other devices | 47 * canvas. The root device will have its top-left at 0,0, but other devices |
48 * such as those associated with saveLayer may have a non-zero origin. | 48 * such as those associated with saveLayer may have a non-zero origin. |
49 */ | 49 */ |
50 void getGlobalBounds(SkIRect* bounds) const { | 50 void getGlobalBounds(SkIRect* bounds) const { |
51 SkASSERT(bounds); | 51 SkASSERT(bounds); |
52 const SkIPoint& origin = this->getOrigin(); | 52 const SkIPoint& origin = this->getOrigin(); |
53 bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); | 53 bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); |
54 } | 54 } |
55 | 55 |
| 56 SkIRect getGlobalBounds() const { |
| 57 SkIRect bounds; |
| 58 this->getGlobalBounds(&bounds); |
| 59 return bounds; |
| 60 } |
| 61 |
56 int width() const { | 62 int width() const { |
57 return this->imageInfo().width(); | 63 return this->imageInfo().width(); |
58 } | 64 } |
59 | 65 |
60 int height() const { | 66 int height() const { |
61 return this->imageInfo().height(); | 67 return this->imageInfo().height(); |
62 } | 68 } |
63 | 69 |
64 bool isOpaque() const { | 70 bool isOpaque() const { |
65 return this->imageInfo().isOpaque(); | 71 return this->imageInfo().isOpaque(); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 virtual void initForRootLayer(SkPixelGeometry geo); | 365 virtual void initForRootLayer(SkPixelGeometry geo); |
360 | 366 |
361 private: | 367 private: |
362 friend class SkCanvas; | 368 friend class SkCanvas; |
363 friend struct DeviceCM; //for setMatrixClip | 369 friend struct DeviceCM; //for setMatrixClip |
364 friend class SkDraw; | 370 friend class SkDraw; |
365 friend class SkDrawIter; | 371 friend class SkDrawIter; |
366 friend class SkDeviceFilteredPaint; | 372 friend class SkDeviceFilteredPaint; |
367 friend class SkDeviceImageFilterProxy; | 373 friend class SkDeviceImageFilterProxy; |
368 friend class SkDeferredDevice; // for newSurface | 374 friend class SkDeferredDevice; // for newSurface |
| 375 friend class SkNoPixelsBitmapDevice; |
369 | 376 |
370 friend class SkSurface_Raster; | 377 friend class SkSurface_Raster; |
371 | 378 |
372 // used to change the backend's pixels (and possibly config/rowbytes) | 379 // used to change the backend's pixels (and possibly config/rowbytes) |
373 // but cannot change the width/height, so there should be no change to | 380 // but cannot change the width/height, so there should be no change to |
374 // any clip information. | 381 // any clip information. |
375 // TODO: move to SkBitmapDevice | 382 // TODO: move to SkBitmapDevice |
376 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} | 383 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} |
377 | 384 |
378 virtual bool forceConservativeRasterClip() const { return false; } | 385 virtual bool forceConservativeRasterClip() const { return false; } |
(...skipping 12 matching lines...) Expand all Loading... |
391 SkDeviceProperties* fLeakyProperties; // will always exist. | 398 SkDeviceProperties* fLeakyProperties; // will always exist. |
392 | 399 |
393 #ifdef SK_DEBUG | 400 #ifdef SK_DEBUG |
394 bool fAttachedToCanvas; | 401 bool fAttachedToCanvas; |
395 #endif | 402 #endif |
396 | 403 |
397 typedef SkRefCnt INHERITED; | 404 typedef SkRefCnt INHERITED; |
398 }; | 405 }; |
399 | 406 |
400 #endif | 407 #endif |
OLD | NEW |