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