| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef SkBitmapDevice_DEFINED | 9 #ifndef SkBitmapDevice_DEFINED |
| 10 #define SkBitmapDevice_DEFINED | 10 #define SkBitmapDevice_DEFINED |
| 11 | 11 |
| 12 #include "SkDevice.h" | 12 #include "SkDevice.h" |
| 13 | 13 |
| 14 /////////////////////////////////////////////////////////////////////////////// | 14 /////////////////////////////////////////////////////////////////////////////// |
| 15 class SK_API SkBitmapDevice : public SkBaseDevice { | 15 class SK_API SkBitmapDevice : public SkBaseDevice { |
| 16 public: | 16 public: |
| 17 SK_DECLARE_INST_COUNT(SkBitmapDevice) | 17 SK_DECLARE_INST_COUNT(SkBitmapDevice) |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Construct a new device with the specified bitmap as its backend. It is | 20 * Construct a new device with the specified bitmap as its backend. It is |
| 21 * valid for the bitmap to have no pixels associated with it. In that case, | 21 * valid for the bitmap to have no pixels associated with it. In that case, |
| 22 * any drawing to this device will have no effect. | 22 * any drawing to this device will have no effect. |
| 23 */ | 23 */ |
| 24 SkBitmapDevice(const SkBitmap& bitmap); | 24 SkBitmapDevice(const SkBitmap& bitmap); |
| 25 protected: | 25 |
| 26 /** |
| 27 * Create a new device along with its requisite pixel memory using |
| 28 * default SkSurfaceProps (i.e., kLegacyFontHost_InitType-style). |
| 29 * Note: this entry point is slated for removal - no one should call it. |
| 30 */ |
| 31 static SkBitmapDevice* Create(const SkImageInfo& info); |
| 32 |
| 26 /** | 33 /** |
| 27 * Construct a new device with the specified bitmap as its backend. It is | 34 * Construct a new device with the specified bitmap as its backend. It is |
| 28 * valid for the bitmap to have no pixels associated with it. In that case, | 35 * valid for the bitmap to have no pixels associated with it. In that case, |
| 29 * any drawing to this device will have no effect. | 36 * any drawing to this device will have no effect. |
| 30 */ | 37 */ |
| 31 SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps& surfaceProps); | 38 SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps& surfaceProps); |
| 32 private: | 39 |
| 33 static SkBitmapDevice* Create(const SkImageInfo&, const SkSurfaceProps*); | 40 static SkBitmapDevice* Create(const SkImageInfo&, const SkSurfaceProps&); |
| 34 public: | |
| 35 static SkBitmapDevice* Create(const SkImageInfo& info) { | |
| 36 return Create(info, NULL); | |
| 37 } | |
| 38 | 41 |
| 39 SkImageInfo imageInfo() const override; | 42 SkImageInfo imageInfo() const override; |
| 40 | 43 |
| 41 protected: | 44 protected: |
| 42 bool onShouldDisableLCD(const SkPaint&) const override; | 45 bool onShouldDisableLCD(const SkPaint&) const override; |
| 43 | 46 |
| 44 /** These are called inside the per-device-layer loop for each draw call. | 47 /** These are called inside the per-device-layer loop for each draw call. |
| 45 When these are called, we have already applied any saveLayer operations, | 48 When these are called, we have already applied any saveLayer operations, |
| 46 and are handling any looping from the paint, and any effects from the | 49 and are handling any looping from the paint, and any effects from the |
| 47 DrawFilter. | 50 DrawFilter. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 SkImageFilter::Cache* getImageFilterCache() override; | 148 SkImageFilter::Cache* getImageFilterCache() override; |
| 146 | 149 |
| 147 SkBitmap fBitmap; | 150 SkBitmap fBitmap; |
| 148 | 151 |
| 149 void setNewSize(const SkISize&); // Used by SkCanvas for resetForNextPictur
e(). | 152 void setNewSize(const SkISize&); // Used by SkCanvas for resetForNextPictur
e(). |
| 150 | 153 |
| 151 typedef SkBaseDevice INHERITED; | 154 typedef SkBaseDevice INHERITED; |
| 152 }; | 155 }; |
| 153 | 156 |
| 154 #endif // SkBitmapDevice_DEFINED | 157 #endif // SkBitmapDevice_DEFINED |
| OLD | NEW |