aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkDevice.cpp')
-rw-r--r--src/core/SkDevice.cpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index b3209b37b7..c79b4f8aa3 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -6,6 +6,7 @@
* found in the LICENSE file.
*/
#include "SkDevice.h"
+#include "SkDeviceProperties.h"
#include "SkDraw.h"
#include "SkImageFilter.h"
#include "SkMetaData.h"
@@ -23,7 +24,17 @@ SK_DEFINE_INST_COUNT(SkDevice)
///////////////////////////////////////////////////////////////////////////////
SkDevice::SkDevice(const SkBitmap& bitmap)
- : fBitmap(bitmap)
+ : fBitmap(bitmap), fLeakyProperties(SkDeviceProperties::MakeDefault())
+#ifdef SK_DEBUG
+ , fAttachedToCanvas(false)
+#endif
+{
+ fOrigin.setZero();
+ fMetaData = NULL;
+}
+
+SkDevice::SkDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
+ : fBitmap(bitmap), fLeakyProperties(deviceProperties)
#ifdef SK_DEBUG
, fAttachedToCanvas(false)
#endif
@@ -33,8 +44,27 @@ SkDevice::SkDevice(const SkBitmap& bitmap)
}
SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque)
+ : fLeakyProperties(SkDeviceProperties::MakeDefault())
+#ifdef SK_DEBUG
+ , fAttachedToCanvas(false)
+#endif
+{
+ fOrigin.setZero();
+ fMetaData = NULL;
+
+ fBitmap.setConfig(config, width, height);
+ fBitmap.allocPixels();
+ fBitmap.setIsOpaque(isOpaque);
+ if (!isOpaque) {
+ fBitmap.eraseColor(SK_ColorTRANSPARENT);
+ }
+}
+
+SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
+ const SkDeviceProperties& deviceProperties)
+ : fLeakyProperties(deviceProperties)
#ifdef SK_DEBUG
- : fAttachedToCanvas(false)
+ , fAttachedToCanvas(false)
#endif
{
fOrigin.setZero();
@@ -77,7 +107,7 @@ SkDevice* SkDevice::onCreateCompatibleDevice(SkBitmap::Config config,
int width, int height,
bool isOpaque,
Usage usage) {
- return SkNEW_ARGS(SkDevice,(config, width, height, isOpaque));
+ return SkNEW_ARGS(SkDevice,(config, width, height, isOpaque, fLeakyProperties));
}
SkMetaData& SkDevice::getMetaData() {