| 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 SkRegion; | 24 class SkRegion; |
| 25 class SkSpecialImage; |
| 25 class GrRenderTarget; | 26 class GrRenderTarget; |
| 26 | 27 |
| 27 class SK_API SkBaseDevice : public SkRefCnt { | 28 class SK_API SkBaseDevice : public SkRefCnt { |
| 28 public: | 29 public: |
| 29 /** | 30 /** |
| 30 * Construct a new device. | 31 * Construct a new device. |
| 31 */ | 32 */ |
| 32 explicit SkBaseDevice(const SkSurfaceProps&); | 33 explicit SkBaseDevice(const SkSurfaceProps&); |
| 33 virtual ~SkBaseDevice(); | 34 virtual ~SkBaseDevice(); |
| 34 | 35 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 onCreateDevice on this device with kNeverTile_TileExpectation. | 270 onCreateDevice on this device with kNeverTile_TileExpectation. |
| 270 */ | 271 */ |
| 271 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, | 272 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, |
| 272 const SkPaint&) = 0; | 273 const SkPaint&) = 0; |
| 273 | 274 |
| 274 virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len, con
st SkPath&, | 275 virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len, con
st SkPath&, |
| 275 const SkMatrix*, const SkPaint&); | 276 const SkMatrix*, const SkPaint&); |
| 276 virtual void drawTextRSXform(const SkDraw&, const void* text, size_t len, co
nst SkRSXform[], | 277 virtual void drawTextRSXform(const SkDraw&, const void* text, size_t len, co
nst SkRSXform[], |
| 277 const SkPaint&); | 278 const SkPaint&); |
| 278 | 279 |
| 280 virtual void drawSpecial(const SkDraw&, SkSpecialImage*, int x, int y, const
SkPaint&); |
| 281 virtual sk_sp<SkSpecialImage> makeSpecial(const SkBitmap&); |
| 282 virtual sk_sp<SkSpecialImage> makeSpecial(SkImage*); |
| 283 virtual sk_sp<SkSpecialImage> snapSpecial(); |
| 284 |
| 279 bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y
); | 285 bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y
); |
| 280 | 286 |
| 281 /////////////////////////////////////////////////////////////////////////// | 287 /////////////////////////////////////////////////////////////////////////// |
| 282 | 288 |
| 283 /** Update as needed the pixel value in the bitmap, so that the caller can | 289 /** Update as needed the pixel value in the bitmap, so that the caller can |
| 284 access the pixels directly. | 290 access the pixels directly. |
| 285 @return The device contents as a bitmap | 291 @return The device contents as a bitmap |
| 286 */ | 292 */ |
| 287 virtual const SkBitmap& onAccessBitmap() = 0; | 293 virtual const SkBitmap& onAccessBitmap() = 0; |
| 288 | 294 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 static void LogDrawScaleFactor(const SkMatrix&, SkFilterQuality); | 370 static void LogDrawScaleFactor(const SkMatrix&, SkFilterQuality); |
| 365 | 371 |
| 366 private: | 372 private: |
| 367 friend class SkCanvas; | 373 friend class SkCanvas; |
| 368 friend struct DeviceCM; //for setMatrixClip | 374 friend struct DeviceCM; //for setMatrixClip |
| 369 friend class SkDraw; | 375 friend class SkDraw; |
| 370 friend class SkDrawIter; | 376 friend class SkDrawIter; |
| 371 friend class SkDeviceFilteredPaint; | 377 friend class SkDeviceFilteredPaint; |
| 372 friend class SkNoPixelsBitmapDevice; | 378 friend class SkNoPixelsBitmapDevice; |
| 373 friend class SkSurface_Raster; | 379 friend class SkSurface_Raster; |
| 380 friend class DeviceTestingAccess; |
| 374 | 381 |
| 375 // used to change the backend's pixels (and possibly config/rowbytes) | 382 // used to change the backend's pixels (and possibly config/rowbytes) |
| 376 // but cannot change the width/height, so there should be no change to | 383 // but cannot change the width/height, so there should be no change to |
| 377 // any clip information. | 384 // any clip information. |
| 378 // TODO: move to SkBitmapDevice | 385 // TODO: move to SkBitmapDevice |
| 379 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} | 386 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} |
| 380 | 387 |
| 381 virtual bool forceConservativeRasterClip() const { return false; } | 388 virtual bool forceConservativeRasterClip() const { return false; } |
| 382 | 389 |
| 383 // just called by SkCanvas when built as a layer | 390 // just called by SkCanvas when built as a layer |
| (...skipping 10 matching lines...) Expand all Loading... |
| 394 SkSurfaceProps fSurfaceProps; | 401 SkSurfaceProps fSurfaceProps; |
| 395 | 402 |
| 396 #ifdef SK_DEBUG | 403 #ifdef SK_DEBUG |
| 397 bool fAttachedToCanvas; | 404 bool fAttachedToCanvas; |
| 398 #endif | 405 #endif |
| 399 | 406 |
| 400 typedef SkRefCnt INHERITED; | 407 typedef SkRefCnt INHERITED; |
| 401 }; | 408 }; |
| 402 | 409 |
| 403 #endif | 410 #endif |
| OLD | NEW |