OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 | 1099 |
1100 const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) { | 1100 const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) { |
1101 return this->onPeekPixels(info, rowBytes); | 1101 return this->onPeekPixels(info, rowBytes); |
1102 } | 1102 } |
1103 | 1103 |
1104 const void* SkCanvas::onPeekPixels(SkImageInfo* info, size_t* rowBytes) { | 1104 const void* SkCanvas::onPeekPixels(SkImageInfo* info, size_t* rowBytes) { |
1105 SkBaseDevice* dev = this->getDevice(); | 1105 SkBaseDevice* dev = this->getDevice(); |
1106 return dev ? dev->peekPixels(info, rowBytes) : NULL; | 1106 return dev ? dev->peekPixels(info, rowBytes) : NULL; |
1107 } | 1107 } |
1108 | 1108 |
1109 void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes) { | 1109 void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoi
nt* origin) { |
1110 return this->onAccessTopLayerPixels(info, rowBytes); | 1110 void* pixels = this->onAccessTopLayerPixels(info, rowBytes); |
| 1111 if (pixels && origin) { |
| 1112 *origin = this->getTopDevice(false)->getOrigin(); |
| 1113 } |
| 1114 return pixels; |
1111 } | 1115 } |
1112 | 1116 |
1113 void* SkCanvas::onAccessTopLayerPixels(SkImageInfo* info, size_t* rowBytes) { | 1117 void* SkCanvas::onAccessTopLayerPixels(SkImageInfo* info, size_t* rowBytes) { |
1114 SkBaseDevice* dev = this->getTopDevice(); | 1118 SkBaseDevice* dev = this->getTopDevice(); |
1115 return dev ? dev->accessPixels(info, rowBytes) : NULL; | 1119 return dev ? dev->accessPixels(info, rowBytes) : NULL; |
1116 } | 1120 } |
1117 | 1121 |
1118 SkAutoROCanvasPixels::SkAutoROCanvasPixels(SkCanvas* canvas) { | 1122 SkAutoROCanvasPixels::SkAutoROCanvasPixels(SkCanvas* canvas) { |
1119 fAddr = canvas->peekPixels(&fInfo, &fRowBytes); | 1123 fAddr = canvas->peekPixels(&fInfo, &fRowBytes); |
1120 if (NULL == fAddr) { | 1124 if (NULL == fAddr) { |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2668 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2672 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
2669 return NULL; | 2673 return NULL; |
2670 } | 2674 } |
2671 | 2675 |
2672 // should this functionality be moved into allocPixels()? | 2676 // should this functionality be moved into allocPixels()? |
2673 if (!bitmap.info().isOpaque()) { | 2677 if (!bitmap.info().isOpaque()) { |
2674 bitmap.eraseColor(0); | 2678 bitmap.eraseColor(0); |
2675 } | 2679 } |
2676 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2680 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2677 } | 2681 } |
OLD | NEW |