Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: src/core/SkDevice.cpp

Issue 227643005: remove SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkMetaData.h" 9 #include "SkMetaData.h"
10 10
(...skipping 15 matching lines...) Expand all
26 { 26 {
27 fOrigin.setZero(); 27 fOrigin.setZero();
28 fMetaData = NULL; 28 fMetaData = NULL;
29 } 29 }
30 30
31 SkBaseDevice::~SkBaseDevice() { 31 SkBaseDevice::~SkBaseDevice() {
32 delete fMetaData; 32 delete fMetaData;
33 } 33 }
34 34
35 SkBaseDevice* SkBaseDevice::createCompatibleDevice(const SkImageInfo& info) { 35 SkBaseDevice* SkBaseDevice::createCompatibleDevice(const SkImageInfo& info) {
36 #ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
37 // We call the old method to support older subclasses.
38 // If they have, we return their device, else we use the new impl.
39 SkBitmap::Config config = SkColorTypeToBitmapConfig(info.colorType());
40 SkBaseDevice* dev = this->onCreateCompatibleDevice(config,
41 info.width(),
42 info.height(),
43 info.isOpaque(),
44 kGeneral_Usage);
45 if (dev) {
46 return dev;
47 }
48 // fall through to new impl
49 #endif
50 return this->onCreateDevice(info, kGeneral_Usage); 36 return this->onCreateDevice(info, kGeneral_Usage);
51 } 37 }
52 38
53 SkBaseDevice* SkBaseDevice::createCompatibleDeviceForSaveLayer(const SkImageInfo & info) { 39 SkBaseDevice* SkBaseDevice::createCompatibleDeviceForSaveLayer(const SkImageInfo & info) {
54 #ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
55 // We call the old method to support older subclasses.
56 // If they have, we return their device, else we use the new impl.
57 SkBitmap::Config config = SkColorTypeToBitmapConfig(info.colorType());
58 SkBaseDevice* dev = this->onCreateCompatibleDevice(config,
59 info.width(),
60 info.height(),
61 info.isOpaque(),
62 kSaveLayer_Usage);
63 if (dev) {
64 return dev;
65 }
66 // fall through to new impl
67 #endif
68 return this->onCreateDevice(info, kSaveLayer_Usage); 40 return this->onCreateDevice(info, kSaveLayer_Usage);
69 } 41 }
70 42
71 #ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
72 SkBaseDevice* SkBaseDevice::createCompatibleDevice(SkBitmap::Config config,
73 int width, int height,
74 bool isOpaque) {
75 SkImageInfo info = SkImageInfo::Make(width, height,
76 SkBitmapConfigToColorType(config),
77 isOpaque ? kOpaque_SkAlphaType
78 : kPremul_SkAlphaType);
79 return this->createCompatibleDevice(info);
80 }
81 #endif
82
83 SkMetaData& SkBaseDevice::getMetaData() { 43 SkMetaData& SkBaseDevice::getMetaData() {
84 // metadata users are rare, so we lazily allocate it. If that changes we 44 // metadata users are rare, so we lazily allocate it. If that changes we
85 // can decide to just make it a field in the device (rather than a ptr) 45 // can decide to just make it a field in the device (rather than a ptr)
86 if (NULL == fMetaData) { 46 if (NULL == fMetaData) {
87 fMetaData = new SkMetaData; 47 fMetaData = new SkMetaData;
88 } 48 }
89 return *fMetaData; 49 return *fMetaData;
90 } 50 }
91 51
92 // TODO: should make this guy pure-virtual. 52 // TODO: should make this guy pure-virtual.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 132 }
173 133
174 void SkBaseDevice::EXPERIMENTAL_optimize(SkPicture* picture) { 134 void SkBaseDevice::EXPERIMENTAL_optimize(SkPicture* picture) {
175 // The base class doesn't perform any analysis but derived classes may 135 // The base class doesn't perform any analysis but derived classes may
176 } 136 }
177 137
178 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkPicture* picture) { 138 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkPicture* picture) {
179 // The base class doesn't perform any accelerated picture rendering 139 // The base class doesn't perform any accelerated picture rendering
180 return false; 140 return false;
181 } 141 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698