| 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 |
| 11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
| 12 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
| 13 #include "SkColor.h" | 13 #include "SkColor.h" |
| 14 #include "SkSurfaceProps.h" | 14 #include "SkSurfaceProps.h" |
| 15 | 15 |
| 16 class SkBitmap; | 16 class SkBitmap; |
| 17 class SkClipStack; | 17 class SkClipStack; |
| 18 class SkDraw; | 18 class SkDraw; |
| 19 class SkDrawFilter; | 19 class SkDrawFilter; |
| 20 class SkImageFilterCache; | 20 class SkImageFilterCache; |
| 21 struct SkIRect; | 21 struct SkIRect; |
| 22 class SkMatrix; | 22 class SkMatrix; |
| 23 class SkMetaData; | 23 class SkMetaData; |
| 24 class SkRasterCanvasLayerAllocator; |
| 24 class SkRegion; | 25 class SkRegion; |
| 25 class SkSpecialImage; | 26 class SkSpecialImage; |
| 26 class GrRenderTarget; | 27 class GrRenderTarget; |
| 27 | 28 |
| 28 class SK_API SkBaseDevice : public SkRefCnt { | 29 class SK_API SkBaseDevice : public SkRefCnt { |
| 29 public: | 30 public: |
| 30 /** | 31 /** |
| 31 * Construct a new device. | 32 * Construct a new device. |
| 32 */ | 33 */ |
| 33 explicit SkBaseDevice(const SkImageInfo&, const SkSurfaceProps&); | 34 explicit SkBaseDevice(const SkImageInfo&, const SkSurfaceProps&); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 * Create a new device based on CreateInfo. If the paint is not null, then
it represents a | 309 * Create a new device based on CreateInfo. If the paint is not null, then
it represents a |
| 309 * preview of how the new device will be composed with its creator device (
this). | 310 * preview of how the new device will be composed with its creator device (
this). |
| 310 * | 311 * |
| 311 * The subclass may be handed this device in drawDevice(), so it must alway
s return | 312 * The subclass may be handed this device in drawDevice(), so it must alway
s return |
| 312 * a device that it knows how to draw, and that it knows how to identify if
it is not of the | 313 * a device that it knows how to draw, and that it knows how to identify if
it is not of the |
| 313 * same subclass (since drawDevice is passed a SkBaseDevice*). If the subcl
ass cannot fulfill | 314 * same subclass (since drawDevice is passed a SkBaseDevice*). If the subcl
ass cannot fulfill |
| 314 * that contract (e.g. PDF cannot support some settings on the paint) it sh
ould return NULL, | 315 * that contract (e.g. PDF cannot support some settings on the paint) it sh
ould return NULL, |
| 315 * and the caller may then decide to explicitly create a bitmapdevice, know
ing that later | 316 * and the caller may then decide to explicitly create a bitmapdevice, know
ing that later |
| 316 * it could not call drawDevice with it (but it could call drawSprite or dr
awBitmap). | 317 * it could not call drawDevice with it (but it could call drawSprite or dr
awBitmap). |
| 317 */ | 318 */ |
| 318 virtual SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) { | 319 virtual SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*, |
| 320 SkRasterCanvasLayerAllocator*) { |
| 319 return NULL; | 321 return NULL; |
| 320 } | 322 } |
| 321 | 323 |
| 322 // A helper function used by derived classes to log the scale factor of a bi
tmap or image draw. | 324 // A helper function used by derived classes to log the scale factor of a bi
tmap or image draw. |
| 323 static void LogDrawScaleFactor(const SkMatrix&, SkFilterQuality); | 325 static void LogDrawScaleFactor(const SkMatrix&, SkFilterQuality); |
| 324 | 326 |
| 325 private: | 327 private: |
| 326 friend class SkCanvas; | 328 friend class SkCanvas; |
| 327 friend struct DeviceCM; //for setMatrixClip | 329 friend struct DeviceCM; //for setMatrixClip |
| 328 friend class SkDraw; | 330 friend class SkDraw; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 const SkSurfaceProps fSurfaceProps; | 367 const SkSurfaceProps fSurfaceProps; |
| 366 | 368 |
| 367 #ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP | 369 #ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP |
| 368 SkBitmap fLegacyBitmap; | 370 SkBitmap fLegacyBitmap; |
| 369 #endif | 371 #endif |
| 370 | 372 |
| 371 typedef SkRefCnt INHERITED; | 373 typedef SkRefCnt INHERITED; |
| 372 }; | 374 }; |
| 373 | 375 |
| 374 #endif | 376 #endif |
| OLD | NEW |