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