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 void getGlobalBounds(SkIRect* bounds) const { | 86 virtual void getGlobalBounds(SkIRect* bounds) const = 0; |
87 SkASSERT(bounds); | |
88 const SkIPoint& origin = this->getOrigin(); | |
89 bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); | |
90 } | |
91 | |
92 | 87 |
93 /** Returns true if the device's bitmap's config treats every pixel as | 88 /** Returns true if the device's bitmap's config treats every pixel as |
94 implicitly opaque. | 89 implicitly opaque. |
95 */ | 90 */ |
96 virtual bool isOpaque() const = 0; | 91 virtual bool isOpaque() const = 0; |
97 | 92 |
98 /** Return the bitmap config of the device's pixels | 93 /** Return the bitmap config of the device's pixels |
99 */ | 94 */ |
100 SK_ATTR_DEPRECATED("want to hide configness of the device -- don't use") | 95 SK_ATTR_DEPRECATED("want to hide configness of the device -- don't use") |
101 virtual SkBitmap::Config config() const = 0; | 96 virtual SkBitmap::Config config() const = 0; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 friend class SkDraw; | 376 friend class SkDraw; |
382 friend class SkDrawIter; | 377 friend class SkDrawIter; |
383 friend class SkDeviceFilteredPaint; | 378 friend class SkDeviceFilteredPaint; |
384 friend class SkDeviceImageFilterProxy; | 379 friend class SkDeviceImageFilterProxy; |
385 | 380 |
386 friend class SkSurface_Raster; | 381 friend class SkSurface_Raster; |
387 | 382 |
388 // used to change the backend's pixels (and possibly config/rowbytes) | 383 // used to change the backend's pixels (and possibly config/rowbytes) |
389 // but cannot change the width/height, so there should be no change to | 384 // but cannot change the width/height, so there should be no change to |
390 // any clip information. | 385 // any clip information. |
391 // TODO: move to SkBitmapDevice | |
392 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) = 0; | 386 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) = 0; |
393 | 387 |
394 // just called by SkCanvas when built as a layer | 388 // just called by SkCanvas when built as a layer |
395 void setOrigin(int x, int y) { fOrigin.set(x, y); } | 389 void setOrigin(int x, int y) { fOrigin.set(x, y); } |
396 // just called by SkCanvas for saveLayer | 390 // just called by SkCanvas for saveLayer |
397 SkBaseDevice* createCompatibleDeviceForSaveLayer(SkBitmap::Config config, | 391 SkBaseDevice* createCompatibleDeviceForSaveLayer(SkBitmap::Config config, |
398 int width, int height, | 392 int width, int height, |
399 bool isOpaque); | 393 bool isOpaque); |
400 | 394 |
401 /** | 395 /** |
(...skipping 19 matching lines...) Expand all Loading... |
421 SkDeviceProperties fLeakyProperties; | 415 SkDeviceProperties fLeakyProperties; |
422 | 416 |
423 #ifdef SK_DEBUG | 417 #ifdef SK_DEBUG |
424 bool fAttachedToCanvas; | 418 bool fAttachedToCanvas; |
425 #endif | 419 #endif |
426 | 420 |
427 typedef SkRefCnt INHERITED; | 421 typedef SkRefCnt INHERITED; |
428 }; | 422 }; |
429 | 423 |
430 #endif | 424 #endif |
OLD | NEW |