| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 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 #include "SkDevice.h" | 8 #include "SkDevice.h" |
| 9 #include "SkDeviceProperties.h" |
| 9 #include "SkDraw.h" | 10 #include "SkDraw.h" |
| 10 #include "SkMetaData.h" | 11 #include "SkMetaData.h" |
| 11 #include "SkPatchUtils.h" | 12 #include "SkPatchUtils.h" |
| 12 #include "SkTextBlob.h" | 13 #include "SkTextBlob.h" |
| 13 | 14 |
| 14 SkBaseDevice::SkBaseDevice() | 15 SkBaseDevice::SkBaseDevice() |
| 15 : fLeakyProperties(SkDeviceProperties::MakeDefault()) | 16 : fLeakyProperties(SkNEW_ARGS(SkDeviceProperties, (SkDeviceProperties::MakeD
efault()))) |
| 16 #ifdef SK_DEBUG | 17 #ifdef SK_DEBUG |
| 17 , fAttachedToCanvas(false) | 18 , fAttachedToCanvas(false) |
| 18 #endif | 19 #endif |
| 19 { | |
| 20 fOrigin.setZero(); | |
| 21 fMetaData = NULL; | |
| 22 } | |
| 23 | |
| 24 SkBaseDevice::SkBaseDevice(const SkDeviceProperties& deviceProperties) | |
| 25 : fLeakyProperties(deviceProperties) | |
| 26 #ifdef SK_DEBUG | |
| 27 , fAttachedToCanvas(false) | |
| 28 #endif | |
| 29 { | 20 { |
| 30 fOrigin.setZero(); | 21 fOrigin.setZero(); |
| 31 fMetaData = NULL; | 22 fMetaData = NULL; |
| 32 } | 23 } |
| 33 | 24 |
| 34 SkBaseDevice::~SkBaseDevice() { | 25 SkBaseDevice::~SkBaseDevice() { |
| 35 delete fMetaData; | 26 SkDELETE(fLeakyProperties); |
| 27 SkDELETE(fMetaData); |
| 36 } | 28 } |
| 37 | 29 |
| 38 SkBaseDevice* SkBaseDevice::createCompatibleDevice(const SkImageInfo& info) { | 30 SkBaseDevice* SkBaseDevice::createCompatibleDevice(const SkImageInfo& info) { |
| 39 return this->onCreateDevice(info, kGeneral_Usage); | 31 return this->onCreateDevice(info, kGeneral_Usage); |
| 40 } | 32 } |
| 41 | 33 |
| 42 SkBaseDevice* SkBaseDevice::createCompatibleDeviceForSaveLayer(const SkImageInfo
& info) { | 34 SkBaseDevice* SkBaseDevice::createCompatibleDeviceForSaveLayer(const SkImageInfo
& info) { |
| 43 return this->onCreateDevice(info, kSaveLayer_Usage); | 35 return this->onCreateDevice(info, kSaveLayer_Usage); |
| 44 } | 36 } |
| 45 | 37 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 180 |
| 189 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { | 181 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { |
| 190 // The base class doesn't perform any analysis but derived classes may | 182 // The base class doesn't perform any analysis but derived classes may |
| 191 } | 183 } |
| 192 | 184 |
| 193 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
kMatrix*, | 185 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
kMatrix*, |
| 194 const SkPaint*) { | 186 const SkPaint*) { |
| 195 // The base class doesn't perform any accelerated picture rendering | 187 // The base class doesn't perform any accelerated picture rendering |
| 196 return false; | 188 return false; |
| 197 } | 189 } |
| OLD | NEW |