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 "SkMetaData.h" | 9 #include "SkMetaData.h" |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 SkMetaData& SkBaseDevice::getMetaData() { | 59 SkMetaData& SkBaseDevice::getMetaData() { |
60 // metadata users are rare, so we lazily allocate it. If that changes we | 60 // metadata users are rare, so we lazily allocate it. If that changes we |
61 // can decide to just make it a field in the device (rather than a ptr) | 61 // can decide to just make it a field in the device (rather than a ptr) |
62 if (NULL == fMetaData) { | 62 if (NULL == fMetaData) { |
63 fMetaData = new SkMetaData; | 63 fMetaData = new SkMetaData; |
64 } | 64 } |
65 return *fMetaData; | 65 return *fMetaData; |
66 } | 66 } |
67 | 67 |
| 68 // TODO: should make this guy pure-virtual. |
| 69 SkImageInfo SkBaseDevice::imageInfo() const { |
| 70 return SkImageInfo::Make(this->width(), this->height(), |
| 71 kUnknown_SkColorType, kIgnore_SkAlphaType); |
| 72 } |
| 73 |
68 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { | 74 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { |
69 const SkBitmap& bitmap = this->onAccessBitmap(); | 75 const SkBitmap& bitmap = this->onAccessBitmap(); |
70 if (changePixels) { | 76 if (changePixels) { |
71 bitmap.notifyPixelsChanged(); | 77 bitmap.notifyPixelsChanged(); |
72 } | 78 } |
73 return bitmap; | 79 return bitmap; |
74 } | 80 } |
75 | 81 |
76 bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y, | 82 bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y, |
77 SkCanvas::Config8888 config8888) { | 83 SkCanvas::Config8888 config8888) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 srcRect.fLeft, | 116 srcRect.fLeft, |
111 srcRect.fTop, | 117 srcRect.fTop, |
112 config8888); | 118 config8888); |
113 if (result && bmp == &tmp) { | 119 if (result && bmp == &tmp) { |
114 tmp.swap(*bitmap); | 120 tmp.swap(*bitmap); |
115 } | 121 } |
116 return result; | 122 return result; |
117 } | 123 } |
118 | 124 |
119 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&) { return NULL; } | 125 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&) { return NULL; } |
| 126 |
| 127 const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; } |
OLD | NEW |