OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 | |
10 #ifndef SkDevice_DEFINED | 8 #ifndef SkDevice_DEFINED |
11 #define SkDevice_DEFINED | 9 #define SkDevice_DEFINED |
12 | 10 |
13 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
14 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
15 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
16 #include "SkColor.h" | 14 #include "SkColor.h" |
17 #include "SkDeviceProperties.h" | 15 #include "SkDeviceProperties.h" |
18 #include "SkImageFilter.h" | 16 #include "SkImageFilter.h" |
19 | 17 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 * Return the bounds of the device in the coordinate space of the root | 67 * Return the bounds of the device in the coordinate space of the root |
70 * canvas. The root device will have its top-left at 0,0, but other devices | 68 * canvas. The root device will have its top-left at 0,0, but other devices |
71 * such as those associated with saveLayer may have a non-zero origin. | 69 * such as those associated with saveLayer may have a non-zero origin. |
72 */ | 70 */ |
73 void getGlobalBounds(SkIRect* bounds) const { | 71 void getGlobalBounds(SkIRect* bounds) const { |
74 SkASSERT(bounds); | 72 SkASSERT(bounds); |
75 const SkIPoint& origin = this->getOrigin(); | 73 const SkIPoint& origin = this->getOrigin(); |
76 bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); | 74 bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); |
77 } | 75 } |
78 | 76 |
79 | |
80 /** Returns true if the device's bitmap's config treats every pixel as | 77 /** Returns true if the device's bitmap's config treats every pixel as |
81 implicitly opaque. | 78 implicitly opaque. |
82 */ | 79 */ |
83 virtual bool isOpaque() const = 0; | 80 virtual bool isOpaque() const = 0; |
84 | 81 |
85 #ifdef SK_SUPPORT_LEGACY_DEVICE_CONFIG | |
86 /** Return the bitmap config of the device's pixels | |
87 */ | |
88 virtual SkBitmap::Config config() const = 0; | |
89 #endif | |
90 | |
91 /** Return the bitmap associated with this device. Call this each time you n
eed | 82 /** Return the bitmap associated with this device. Call this each time you n
eed |
92 to access the bitmap, as it notifies the subclass to perform any flushin
g | 83 to access the bitmap, as it notifies the subclass to perform any flushin
g |
93 etc. before you examine the pixels. | 84 etc. before you examine the pixels. |
94 @param changePixels set to true if the caller plans to change the pixels | 85 @param changePixels set to true if the caller plans to change the pixels |
95 @return the device's bitmap | 86 @return the device's bitmap |
96 */ | 87 */ |
97 const SkBitmap& accessBitmap(bool changePixels); | 88 const SkBitmap& accessBitmap(bool changePixels); |
98 | 89 |
99 bool writePixels(const SkImageInfo&, const void*, size_t rowBytes, int x, in
t y); | 90 bool writePixels(const SkImageInfo&, const void*, size_t rowBytes, int x, in
t y); |
100 | 91 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 SkMetaData* fMetaData; | 389 SkMetaData* fMetaData; |
399 | 390 |
400 #ifdef SK_DEBUG | 391 #ifdef SK_DEBUG |
401 bool fAttachedToCanvas; | 392 bool fAttachedToCanvas; |
402 #endif | 393 #endif |
403 | 394 |
404 typedef SkRefCnt INHERITED; | 395 typedef SkRefCnt INHERITED; |
405 }; | 396 }; |
406 | 397 |
407 #endif | 398 #endif |
OLD | NEW |