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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 */ | 70 */ |
71 virtual int height() const = 0; | 71 virtual int height() const = 0; |
72 | 72 |
73 /** Return the image properties of the device. */ | 73 /** Return the image properties of the device. */ |
74 virtual const SkDeviceProperties& getDeviceProperties() const { | 74 virtual const SkDeviceProperties& getDeviceProperties() const { |
75 //Currently, all the properties are leaky. | 75 //Currently, all the properties are leaky. |
76 return fLeakyProperties; | 76 return fLeakyProperties; |
77 } | 77 } |
78 | 78 |
79 /** | 79 /** |
80 * Return ImageInfo for this device. If the canvas is not backed by pixels | |
81 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. | |
82 */ | |
83 virtual SkImageInfo imageInfo() const; | |
84 | |
85 /** | |
86 * Return the bounds of the device in the coordinate space of the root | 80 * Return the bounds of the device in the coordinate space of the root |
87 * canvas. The root device will have its top-left at 0,0, but other devices | 81 * canvas. The root device will have its top-left at 0,0, but other devices |
88 * such as those associated with saveLayer may have a non-zero origin. | 82 * such as those associated with saveLayer may have a non-zero origin. |
89 */ | 83 */ |
90 void getGlobalBounds(SkIRect* bounds) const { | 84 void getGlobalBounds(SkIRect* bounds) const { |
91 SkASSERT(bounds); | 85 SkASSERT(bounds); |
92 const SkIPoint& origin = this->getOrigin(); | 86 const SkIPoint& origin = this->getOrigin(); |
93 bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); | 87 bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height()); |
94 } | 88 } |
95 | 89 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkMatr
ix&, | 362 virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkMatr
ix&, |
369 SkBitmap* result, SkIPoint* offset) = 0; | 363 SkBitmap* result, SkIPoint* offset) = 0; |
370 | 364 |
371 // This is equal kBGRA_Premul_Config8888 or kRGBA_Premul_Config8888 if | 365 // This is equal kBGRA_Premul_Config8888 or kRGBA_Premul_Config8888 if |
372 // either is identical to kNative_Premul_Config8888. Otherwise, -1. | 366 // either is identical to kNative_Premul_Config8888. Otherwise, -1. |
373 static const SkCanvas::Config8888 kPMColorAlias; | 367 static const SkCanvas::Config8888 kPMColorAlias; |
374 | 368 |
375 protected: | 369 protected: |
376 // default impl returns NULL | 370 // default impl returns NULL |
377 virtual SkSurface* newSurface(const SkImageInfo&); | 371 virtual SkSurface* newSurface(const SkImageInfo&); |
378 | 372 |
379 // default impl returns NULL | |
380 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); | |
381 | |
382 /** | 373 /** |
383 * Leaky properties are those which the device should be applying but it is
n't. | 374 * Leaky properties are those which the device should be applying but it is
n't. |
384 * These properties will be applied by the draw, when and as it can. | 375 * These properties will be applied by the draw, when and as it can. |
385 * If the device does handle a property, that property should be set to the
identity value | 376 * If the device does handle a property, that property should be set to the
identity value |
386 * for that property, effectively making it non-leaky. | 377 * for that property, effectively making it non-leaky. |
387 */ | 378 */ |
388 SkDeviceProperties fLeakyProperties; | 379 SkDeviceProperties fLeakyProperties; |
389 | 380 |
390 private: | 381 private: |
391 friend class SkCanvas; | 382 friend class SkCanvas; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 SkMetaData* fMetaData; | 418 SkMetaData* fMetaData; |
428 | 419 |
429 #ifdef SK_DEBUG | 420 #ifdef SK_DEBUG |
430 bool fAttachedToCanvas; | 421 bool fAttachedToCanvas; |
431 #endif | 422 #endif |
432 | 423 |
433 typedef SkRefCnt INHERITED; | 424 typedef SkRefCnt INHERITED; |
434 }; | 425 }; |
435 | 426 |
436 #endif | 427 #endif |
OLD | NEW |