| 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 the imagefilter. |
| 383 */ |
| 384 virtual void drawBitmapAsSpriteWithImageFilter(const SkDraw&, const SkBitmap
&, |
| 385 int x, int y, const SkPaint&)
; |
| 386 |
| 381 private: | 387 private: |
| 382 friend class SkCanvas; | 388 friend class SkCanvas; |
| 383 friend struct DeviceCM; //for setMatrixClip | 389 friend struct DeviceCM; //for setMatrixClip |
| 384 friend class SkDraw; | 390 friend class SkDraw; |
| 385 friend class SkDrawIter; | 391 friend class SkDrawIter; |
| 386 friend class SkDeviceFilteredPaint; | 392 friend class SkDeviceFilteredPaint; |
| 387 friend class SkImageFilter::DeviceProxy; | 393 friend class SkImageFilter::DeviceProxy; |
| 388 friend class SkNoPixelsBitmapDevice; | 394 friend class SkNoPixelsBitmapDevice; |
| 389 friend class SkSurface_Raster; | 395 friend class SkSurface_Raster; |
| 390 | 396 |
| 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) | 397 // 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 | 398 // but cannot change the width/height, so there should be no change to |
| 398 // any clip information. | 399 // any clip information. |
| 399 // TODO: move to SkBitmapDevice | 400 // TODO: move to SkBitmapDevice |
| 400 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} | 401 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} |
| 401 | 402 |
| 402 virtual bool forceConservativeRasterClip() const { return false; } | 403 virtual bool forceConservativeRasterClip() const { return false; } |
| 403 | 404 |
| 404 // just called by SkCanvas when built as a layer | 405 // just called by SkCanvas when built as a layer |
| 405 void setOrigin(int x, int y) { fOrigin.set(x, y); } | 406 void setOrigin(int x, int y) { fOrigin.set(x, y); } |
| 406 | 407 |
| 407 /** Causes any deferred drawing to the device to be completed. | 408 /** Causes any deferred drawing to the device to be completed. |
| 408 */ | 409 */ |
| 409 virtual void flush() {} | 410 virtual void flush() {} |
| 410 | 411 |
| 411 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } | 412 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } |
| 412 | 413 |
| 413 SkIPoint fOrigin; | 414 SkIPoint fOrigin; |
| 414 SkMetaData* fMetaData; | 415 SkMetaData* fMetaData; |
| 415 SkSurfaceProps fSurfaceProps; | 416 SkSurfaceProps fSurfaceProps; |
| 416 | 417 |
| 417 #ifdef SK_DEBUG | 418 #ifdef SK_DEBUG |
| 418 bool fAttachedToCanvas; | 419 bool fAttachedToCanvas; |
| 419 #endif | 420 #endif |
| 420 | 421 |
| 421 typedef SkRefCnt INHERITED; | 422 typedef SkRefCnt INHERITED; |
| 422 }; | 423 }; |
| 423 | 424 |
| 424 #endif | 425 #endif |
| OLD | NEW |