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