| 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 | |
| 74 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { | 68 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { |
| 75 const SkBitmap& bitmap = this->onAccessBitmap(); | 69 const SkBitmap& bitmap = this->onAccessBitmap(); |
| 76 if (changePixels) { | 70 if (changePixels) { |
| 77 bitmap.notifyPixelsChanged(); | 71 bitmap.notifyPixelsChanged(); |
| 78 } | 72 } |
| 79 return bitmap; | 73 return bitmap; |
| 80 } | 74 } |
| 81 | 75 |
| 82 bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y, | 76 bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y, |
| 83 SkCanvas::Config8888 config8888) { | 77 SkCanvas::Config8888 config8888) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 srcRect.fLeft, | 110 srcRect.fLeft, |
| 117 srcRect.fTop, | 111 srcRect.fTop, |
| 118 config8888); | 112 config8888); |
| 119 if (result && bmp == &tmp) { | 113 if (result && bmp == &tmp) { |
| 120 tmp.swap(*bitmap); | 114 tmp.swap(*bitmap); |
| 121 } | 115 } |
| 122 return result; | 116 return result; |
| 123 } | 117 } |
| 124 | 118 |
| 125 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&) { return NULL; } | 119 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&) { return NULL; } |
| 126 | |
| 127 const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; } | |
| OLD | NEW |