OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
3 * | 3 * |
4 * 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 |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkDevice_DEFINED | 8 #ifndef SkDevice_DEFINED |
9 #define SkDevice_DEFINED | 9 #define SkDevice_DEFINED |
10 | 10 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 * a device that it knows how to draw, and that it knows how to identify if
it is not of the | 371 * a device that it knows how to draw, and that it knows how to identify if
it is not of the |
372 * same subclass (since drawDevice is passed a SkBaseDevice*). If the subcl
ass cannot fulfill | 372 * same subclass (since drawDevice is passed a SkBaseDevice*). If the subcl
ass cannot fulfill |
373 * that contract (e.g. PDF cannot support some settings on the paint) it sh
ould return NULL, | 373 * that contract (e.g. PDF cannot support some settings on the paint) it sh
ould return NULL, |
374 * and the caller may then decide to explicitly create a bitmapdevice, know
ing that later | 374 * and the caller may then decide to explicitly create a bitmapdevice, know
ing that later |
375 * it could not call drawDevice with it (but it could call drawSprite or dr
awBitmap). | 375 * it could not call drawDevice with it (but it could call drawSprite or dr
awBitmap). |
376 */ | 376 */ |
377 virtual SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) { | 377 virtual SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) { |
378 return NULL; | 378 return NULL; |
379 } | 379 } |
380 | 380 |
| 381 /** |
| 382 * Calls through to drawSprite, processing imagefilter as needed. |
| 383 */ |
| 384 virtual void drawBitmapAsSprite(const SkDraw&, const SkBitmap&, int x, int y
, const SkPaint&); |
| 385 |
381 private: | 386 private: |
382 friend class SkCanvas; | 387 friend class SkCanvas; |
383 friend struct DeviceCM; //for setMatrixClip | 388 friend struct DeviceCM; //for setMatrixClip |
384 friend class SkDraw; | 389 friend class SkDraw; |
385 friend class SkDrawIter; | 390 friend class SkDrawIter; |
386 friend class SkDeviceFilteredPaint; | 391 friend class SkDeviceFilteredPaint; |
387 friend class SkImageFilter::DeviceProxy; | 392 friend class SkImageFilter::DeviceProxy; |
388 friend class SkNoPixelsBitmapDevice; | 393 friend class SkNoPixelsBitmapDevice; |
389 friend class SkSurface_Raster; | 394 friend class SkSurface_Raster; |
390 | 395 |
391 /** | |
392 * Calls through to drawSprite, processing imagefilter as needed. | |
393 */ | |
394 void drawBitmapAsSprite(const SkDraw&, const SkBitmap&, int x, int y, const
SkPaint&); | |
395 | |
396 // used to change the backend's pixels (and possibly config/rowbytes) | 396 // used to change the backend's pixels (and possibly config/rowbytes) |
397 // but cannot change the width/height, so there should be no change to | 397 // but cannot change the width/height, so there should be no change to |
398 // any clip information. | 398 // any clip information. |
399 // TODO: move to SkBitmapDevice | 399 // TODO: move to SkBitmapDevice |
400 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} | 400 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} |
401 | 401 |
402 virtual bool forceConservativeRasterClip() const { return false; } | 402 virtual bool forceConservativeRasterClip() const { return false; } |
403 | 403 |
404 // just called by SkCanvas when built as a layer | 404 // just called by SkCanvas when built as a layer |
405 void setOrigin(int x, int y) { fOrigin.set(x, y); } | 405 void setOrigin(int x, int y) { fOrigin.set(x, y); } |
406 | 406 |
407 /** Causes any deferred drawing to the device to be completed. | 407 /** Causes any deferred drawing to the device to be completed. |
408 */ | 408 */ |
409 virtual void flush() {} | 409 virtual void flush() {} |
410 | 410 |
411 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } | 411 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } |
412 | 412 |
413 SkIPoint fOrigin; | 413 SkIPoint fOrigin; |
414 SkMetaData* fMetaData; | 414 SkMetaData* fMetaData; |
415 SkSurfaceProps fSurfaceProps; | 415 SkSurfaceProps fSurfaceProps; |
416 | 416 |
417 #ifdef SK_DEBUG | 417 #ifdef SK_DEBUG |
418 bool fAttachedToCanvas; | 418 bool fAttachedToCanvas; |
419 #endif | 419 #endif |
420 | 420 |
421 typedef SkRefCnt INHERITED; | 421 typedef SkRefCnt INHERITED; |
422 }; | 422 }; |
423 | 423 |
424 #endif | 424 #endif |
OLD | NEW |