OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
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 | 9 |
10 #ifndef SkDevice_DEFINED | 10 #ifndef SkDevice_DEFINED |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 virtual const SkDeviceProperties& getDeviceProperties() const { | 76 virtual const SkDeviceProperties& getDeviceProperties() const { |
77 //Currently, all the properties are leaky. | 77 //Currently, all the properties are leaky. |
78 return fLeakyProperties; | 78 return fLeakyProperties; |
79 } | 79 } |
80 | 80 |
81 /** | 81 /** |
82 * Return the bounds of the device in the coordinate space of the root | 82 * Return the bounds of the device in the coordinate space of the root |
83 * canvas. The root device will have its top-left at 0,0, but other devices | 83 * canvas. The root device will have its top-left at 0,0, but other devices |
84 * such as those associated with saveLayer may have a non-zero origin. | 84 * such as those associated with saveLayer may have a non-zero origin. |
85 */ | 85 */ |
86 virtual void getGlobalBounds(SkIRect* bounds) const = 0; | 86 void getGlobalBounds(SkIRect* bounds) const { |
| 87 SkASSERT(bounds); |
| 88 const SkIPoint& origin = this->getOrigin(); |
| 89 bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); |
| 90 } |
| 91 |
87 | 92 |
88 /** Returns true if the device's bitmap's config treats every pixel as | 93 /** Returns true if the device's bitmap's config treats every pixel as |
89 implicitly opaque. | 94 implicitly opaque. |
90 */ | 95 */ |
91 virtual bool isOpaque() const = 0; | 96 virtual bool isOpaque() const = 0; |
92 | 97 |
93 /** Return the bitmap config of the device's pixels | 98 /** Return the bitmap config of the device's pixels |
94 */ | 99 */ |
95 SK_ATTR_DEPRECATED("want to hide configness of the device -- don't use") | 100 SK_ATTR_DEPRECATED("want to hide configness of the device -- don't use") |
96 virtual SkBitmap::Config config() const = 0; | 101 virtual SkBitmap::Config config() const = 0; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 friend class SkDraw; | 381 friend class SkDraw; |
377 friend class SkDrawIter; | 382 friend class SkDrawIter; |
378 friend class SkDeviceFilteredPaint; | 383 friend class SkDeviceFilteredPaint; |
379 friend class SkDeviceImageFilterProxy; | 384 friend class SkDeviceImageFilterProxy; |
380 | 385 |
381 friend class SkSurface_Raster; | 386 friend class SkSurface_Raster; |
382 | 387 |
383 // used to change the backend's pixels (and possibly config/rowbytes) | 388 // used to change the backend's pixels (and possibly config/rowbytes) |
384 // but cannot change the width/height, so there should be no change to | 389 // but cannot change the width/height, so there should be no change to |
385 // any clip information. | 390 // any clip information. |
| 391 // TODO: move to SkBitmapDevice |
386 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) = 0; | 392 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) = 0; |
387 | 393 |
388 // just called by SkCanvas when built as a layer | 394 // just called by SkCanvas when built as a layer |
389 void setOrigin(int x, int y) { fOrigin.set(x, y); } | 395 void setOrigin(int x, int y) { fOrigin.set(x, y); } |
390 // just called by SkCanvas for saveLayer | 396 // just called by SkCanvas for saveLayer |
391 SkBaseDevice* createCompatibleDeviceForSaveLayer(SkBitmap::Config config, | 397 SkBaseDevice* createCompatibleDeviceForSaveLayer(SkBitmap::Config config, |
392 int width, int height, | 398 int width, int height, |
393 bool isOpaque); | 399 bool isOpaque); |
394 | 400 |
395 /** | 401 /** |
(...skipping 19 matching lines...) Expand all Loading... |
415 SkDeviceProperties fLeakyProperties; | 421 SkDeviceProperties fLeakyProperties; |
416 | 422 |
417 #ifdef SK_DEBUG | 423 #ifdef SK_DEBUG |
418 bool fAttachedToCanvas; | 424 bool fAttachedToCanvas; |
419 #endif | 425 #endif |
420 | 426 |
421 typedef SkRefCnt INHERITED; | 427 typedef SkRefCnt INHERITED; |
422 }; | 428 }; |
423 | 429 |
424 #endif | 430 #endif |
OLD | NEW |